Sort::Key::Maker - Online Linux Manual PageSection : 3
Updated : 2022-01-21
Source : perl v5.34.0
Note : User Contributed Perl Documentation
NAMESort::Key::Maker − multi−key sorter creator
SYNOPSIS # create a function that sorts strings by length:
use Sort::Key::Maker sort_by_length => sub { length $_}, qw(integer);
# create a multi−key sort function;
# first key is integer sorted in descending order,
# second key is a string in default (ascending) order:
use Sort::Key::Maker ri_s_keysort => qw(−integer string);
# some sample data...
my @foo = qw(foo bar t too tood mama);
# and now, use the sorter functions previously made:
# get the values on @foo sorted by length:
my @sorted = sort_by_length @foo;
# sort @foo inplace by its length and then by its value:
ri_s_keysort_inplace { length $_, $_ } @foo;
DESCRIPTIONSort::Key::Maker is a pragmatic module that provides an easy to use interface to Sort::Key multi-key sorting functionality. It creates multi-key sorting functions on the fly for any key type combination and exports them to the caller package. The key types natively accepted are: string, str, locale, loc, integer, int,
unsigned_integer, uint, number, num
and support for other types can be added via Sort::Key::Register (or also via Sort::Key::register_type()).
USAGEuse Sort::Key::Maker foo_sort => @keys; exports two subroutines to the caller package: foo_sort (&@) and foo_sort_inplace (&\@). Those two subroutines require a sub reference as their first argument and then respectively, the list to be sorted or an array. For instance: use Sort::Key::Maker bar_sort => qw(int int str);
@bar=qw(doo tomo 45s tio);
@sorted = bar_sort { unpack "CCs", $_ } @bar;
# or sorting @bar inplace
bar_sort_inplace { unpack "CCs", $_ } @bar;
use Sort::Key::Maker foo_sort => \&genmultikey, @keys; when the first argument after the sorter name is a reference to a subroutine it is used as the multi-key extraction function. The generated sorter functions doesn't require neither accept one, i.e.: use Sort::Key::Maker sort_by_length => sub { length $_ }, 'int';
my @sorted = sort_by_length qw(foo goo h mama picasso);
SEE ALSOSort::Key, Sort::Key::Register. Sort::Maker also available from CPAN provides similar functionality.
AUTHORSalvador Fandiño, <sfandino@yahoo.com>
COPYRIGHT AND LICENSECopyright (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. 0
Johanes Gumabo
Data Size : 8,460 byte
man-Sort::Key::Maker.3pmBuild : 2024-12-05, 20:55 :
Visitor Screen : x
Visitor Counter ( page / site ) : 4 / 181,191
Visitor ID : :
Visitor IP : 3.144.6.9 :
Visitor Provider : AMAZON-02 :
Provider Position ( lat x lon ) : 39.962500 x -83.006100 : x
Provider Accuracy Radius ( km ) : 1000 :
Provider City : Columbus :
Provider Province : Ohio , : ,
Provider Country : United States :
Provider Continent : North America :
Visitor Recorder : Version :
Visitor Recorder : Library :
Online Linux Manual Page : Version : Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.05
Online Linux Manual Page : Library : lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page : Library : lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base : Version : Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base : Library : lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36
Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.
ERROR : Need New Coding : (parse_manual_page_|249|Sort::Key::Maker.3pm|36/37|el══─{─══.|.el══─{─══. ds -- \|\(em\|
) (htmlprn|149|Sort::Key::Maker.3pm|36/37|.el══─{─══. ds -- — |.el══─{─══. ds -- \|\(em\|
) (parse_manual_page_|249|Sort::Key::Maker.3pm|43|br══─}─══|'br══─}─══
) (htmlprn|149|Sort::Key::Maker.3pm|43|'br══─}─══ |'br══─}─══
)