U
usenet
Uri reminded me (in another thread: http://tinyurl.com/nyclh) of his
module, Sort::Maker, which Damian Conway praised in "Perl Best
Practices" (page 164-165), and which I have been meaning to learn more
about.
However, I am having difficulty with Damian's example.
Kindly consider this small sample program wrapped around some PBP
example code which I have retyped verbatum (adding only my own
statement to populate sample @names):
#!/usr/bin/perl
use strict; use warnings;
use Sort::Maker;
my @names = qw{ Fred Barney Wilma Betty };
make_sorter(name => 'sort_len', code => sub{ length }, ST => 1);
# and later...
my @names_shortest_first = sort_len(@names);
__END__
The script fails with:
Undefined subroutine &main::sort_len...
But, according to the Sort::Maker perldocs, 'name' is
So I believe that sort_len should be exported when the make_sorter
statement is executed. But it doesn't seem to be working.
What am I doing wrong?
(perl, v5.8.4 built for aix, $Sort::Maker::VERSION == 0.05)
module, Sort::Maker, which Damian Conway praised in "Perl Best
Practices" (page 164-165), and which I have been meaning to learn more
about.
However, I am having difficulty with Damian's example.
Kindly consider this small sample program wrapped around some PBP
example code which I have retyped verbatum (adding only my own
statement to populate sample @names):
#!/usr/bin/perl
use strict; use warnings;
use Sort::Maker;
my @names = qw{ Fred Barney Wilma Betty };
make_sorter(name => 'sort_len', code => sub{ length }, ST => 1);
# and later...
my @names_shortest_first = sort_len(@names);
__END__
The script fails with:
Undefined subroutine &main::sort_len...
But, according to the Sort::Maker perldocs, 'name' is
So I believe that sort_len should be exported when the make_sorter
statement is executed. But it doesn't seem to be working.
What am I doing wrong?
(perl, v5.8.4 built for aix, $Sort::Maker::VERSION == 0.05)