NAME

Sort::Key::OID - sort OIDs very fast

SYNOPSIS

  use Sort::Key::OID qw(oidsort);
  my @data = qw(1 1.2 1.1.3 1.4.1.1 1.5.235.2356 1.1);
  my @sorted = oidsort @data;

DESCRIPTION

This module extends the Sort::Key family of modules to support sorting of OID values.

Also, once this module is loaded, the new type oid will be available from Sort::Key::Maker.

Valid OIDs are sequences of unsigned integers separated by some symbol. For instance:

   1.2.3.45  # valid
   1-2-3-45  # valid
   1 2 3 45  # valid
   1:2:3:45  # valid

   1..2.3.45 # invalid
   1  2 3 45 # invalid
   1:2.3 45  # invalid

FUNCTIONS

The functions that can be imported from this module are:

oidsort @data

returns the OID values in @data sorted.

roidsort @data

returns the OID values in @data sorted in descending order.

oidkeysort { CALC_KEY($_) } @data

returns the elements on @array sorted by the OID keys resulting from applying them CALC_KEY.

roidkeysort { CALC_KEY($_) } @data

is similar to oidkeysort but sorts the elements in descending order.

oidsort_inplace @data
roidsort_inplace @data
oidkeysort_inplace { CALC_KEY($_) } @data
roidkeysort_inplace { CALC_KEY($_) } @data

these functions are similar respectively to oidsort, roidsort, oidsortkey and roidsortkey, but they sort the array @data in place.

SEE ALSO

Sort::Key, Sort::Key::Maker

COPYRIGHT AND LICENSE

Copyright © 2007-2009 by Salvador Fandiño <sfandino@yahoo.com>.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.