Sort::K...Register(3)

πŸ’– Sort::K...Register(3) πŸ’–

okay so bestie, this page is from User Contributed Perl Documentation, and it's all about Sort::Key::Register. the way this module just tells Sort::Key how to sort new data types? iconic. ✨


πŸ’– NAME πŸ’–

Sort::Key::Register β€” tell Sort::Key how to sort new data types. periodt. πŸ’…


✨ SYNOPSIS ✨

okay so here's the group-chat screenshot of how you use it, no cap:

use Sort::Key::Register Person =>
    sub { $_->surname, $_->name },
    qw(string string);

use Sort::Key::Register 'Color::Component' => 'integer';

use Sort::Key::Register Color =>
    sub { $_->R, $_->G, $_->B },
    ('Color::Component') x 3;

🌸 DESCRIPTION 🌸

Sort::Key::Register allows one to register new data types with Sort::Key so that they can be sorted as natively supported ones. literally the glow-up those types needed. πŸ’–

It works as a pragma module and doesn't export any function, all its functionality is provided via use. fr fr, it's giving:

use Sort::Key::Register ...

To avoid collisions between modules registering types with the same name, you should qualify them with the package name. bestie, do not skip this part:

use Sort::Key::Register 'MyPkg::foo' => sub { $_ }, '-int';

# or using __PACKAGE__:
use Sort::Key::Register __PACKAGE__, sub { $_ }, '-int';

πŸŽ€ USAGE πŸŽ€

okay the two usable forms are giving:

  • use Sort::Key::Register $name => \&multikeygen, @keytypes; β€” registers type $name. &multikeygen is the multi-key extraction function for the type, and @keytypes are the types of the extracted keys. 🫢
  • use Sort::Key::Register $name => $keytype; β€” this use is useful for simple types that are sorted as another type already registered, maybe changing the direction of the sort (ascending or descending). 🌈

πŸ¦‹ SEE ALSO πŸ¦‹

go look at Sort::Key and Sort::Key::Maker, bestie. iykyk πŸ’–


πŸ‘‘ AUTHOR πŸ‘‘

Salvador FandiΓ±o, <sfandino@yahoo.com> πŸ‘‘


Copyright (C) 2005, 2014 by Salvador FandiΓ±o. πŸ’œ

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.4 or, at your option, any later version of Perl 5 you may have available.


πŸ’… that's the whole manual page, bestie! source/version: perl v5.42.0; date: 2015-04-14. mwah 🫢

πŸ“¦ where this page comes from