1Sort::Key::Register(3)User Contributed Perl DocumentationSort::Key::Register(3)
2
3
4

NAME

6       Sort::Key::Register - tell Sort::Key how to sort new data types.
7

SYNOPSIS

9         use Sort::Key::Register Person =>
10             sub { $_->surname, $_->name },
11             qw(string string);
12
13         use Sort::Key::Register 'Color::Component' => 'integer';
14
15         use Sort::Key::Register Color =>
16             sub { $_->R, $_->G, $_->B },
17             ('Color::Component') x 3;
18

DESCRIPTION

20       Sort::Key::Register allows one to register new data types with
21       Sort::Key so that they can be sorted as natively supported ones.
22
23       It works as a pragma module and doesn't export any function, all its
24       functionality is provided via "use":
25
26         use Sort::Key::Register ...
27
28       To avoid collisions between modules registering types with the same
29       name, you should qualify them with the package name.
30
31         use Sort::Key::Register 'MyPkg::foo' => sub { $_ }, '-int';
32
33         # or using __PACKAGE__:
34         use Sort::Key::Register __PACKAGE__, sub { $_ }, '-int';
35
36   USAGE
37       use Sort::Key::Register $name => \&multikeygen, @keytypes;
38           registers type $name.
39
40           &multikeygen is the multi-key extraction function for the type and
41           @keytypes are the types of the extracted keys.
42
43       use Sort::Key::Register $name => $keytype;
44           this 'use' is useful for simple types that are sorted as another
45           type already registered, maybe changing the direction of the sort
46           (ascending or descending).
47

SEE ALSO

49       Sort::Key, Sort::Key::Maker.
50

AUTHOR

52       Salvador Fandiño, <sfandino@yahoo.com>
53
55       Copyright (C) 2005, 2014 by Salvador Fandiño
56
57       This library is free software; you can redistribute it and/or modify it
58       under the same terms as Perl itself, either Perl version 5.8.4 or, at
59       your option, any later version of Perl 5 you may have available.
60
61
62
63perl v5.32.0                      2020-07-28            Sort::Key::Register(3)
Impressum