Sort::Maker: style => "plain" difficulty
Sort::Maker: style => "plain" difficulty
am 14.12.2006 10:35:36 von paduille.4060.mumia.w
I'm having trouble getting this program to work:
-----------code---------
#!/usr/bin/perl
use strict;
use warnings;
use Sort::Maker qw(make_sorter sorter_source);
my $sorter = make_sorter (
style => 'plain',
string => '$_',
);
die($@) unless $sorter;
print sorter_source($sorter);
-----------end----------
The response is this:
----------output---------
make_sorter: Unknown option or key 'style'
----------end------------
I tried this in two different accounts. Sort::Maker was downloaded from
CPAN. Does this work for other people? Could my system be this totally
messed up?
I'm using Perl 5.8.4 and Sort::Maker 0.05 on Debian 3.1.
Re: Sort::Maker: style => "plain" difficulty
am 14.12.2006 12:09:35 von paduille.4060.mumia.w
On 12/14/2006 03:35 AM, Mumia W. (on aioe) wrote:
> I'm having trouble getting this program to work:
>
> -----------code---------
> #!/usr/bin/perl
>
> use strict;
> use warnings;
> use Sort::Maker qw(make_sorter sorter_source);
>
> my $sorter = make_sorter (
> style => 'plain',
> string => '$_',
> );
>
> die($@) unless $sorter;
>
> print sorter_source($sorter);
> -----------end----------
>
> The response is this:
> ----------output---------
> make_sorter: Unknown option or key 'style'
> ----------end------------
>
> I tried this in two different accounts. Sort::Maker was downloaded from
> CPAN. Does this work for other people? Could my system be this totally
> messed up?
>
> I'm using Perl 5.8.4 and Sort::Maker 0.05 on Debian 3.1.
>
When I make the following change to Sort/Maker.pm, the program works:
----------------patch------------------
*** Maker.src Wed Dec 6 06:27:46 2006
--- Maker.pm Thu Dec 14 05:04:30 2006
***************
*** 72,77 ****
--- 72,78 ----
my @value_args = qw(
name
init_code
+ style
) ;
# all the attributes can be set with defaults
-----------------end-------------------
Re: Sort::Maker: style => "plain" difficulty
am 14.12.2006 20:04:17 von Uri Guttman
>>>>> "MW(a" == Mumia W (on aioe) writes:
MW(a> On 12/14/2006 03:35 AM, Mumia W. (on aioe) wrote:
>> I'm having trouble getting this program to work:
>> -----------code---------
>> #!/usr/bin/perl
>> use strict;
>> use warnings;
>> use Sort::Maker qw(make_sorter sorter_source);
>> my $sorter = make_sorter (
>> style => 'plain',
>> string => '$_',
>> );
>> die($@) unless $sorter;
>> print sorter_source($sorter);
>> -----------end----------
>> The response is this:
>> ----------output---------
>> make_sorter: Unknown option or key 'style'
>> ----------end------------
>> I tried this in two different accounts. Sort::Maker was downloaded
>> from CPAN. Does this work for other people? Could my system be this
>> totally messed up?
>> I'm using Perl 5.8.4 and Sort::Maker 0.05 on Debian 3.1.
>>
MW(a> When I make the following change to Sort/Maker.pm, the program works:
MW(a> ----------------patch------------------
MW(a> *** Maker.src Wed Dec 6 06:27:46 2006
MW(a> --- Maker.pm Thu Dec 14 05:04:30 2006
MW(a> ***************
MW(a> *** 72,77 ****
MW(a> --- 72,78 ----
MW(a> my @value_args = qw(
MW(a> name
MW(a> init_code
MW(a> + style
MW(a> ) ;
MW(a> # all the attributes can be set with defaults
MW(a> -----------------end-------------------
this is due to a doc bug more than a coding bug. the section on
selecting a style doesn't use the 'style' option. i originally thought i
would use that but dropped it. you just need 'plain' (or another style)
for the style value. and you must have seen another example (which i
found) which incorrectly uses 'style'. so i can either edit the text
(easy) and leave style out or i can add your fix and the tests for it
and the new docs for it. which should i do? hmmmm. easy edit or lots of
annoying detail work? tough choice! :)
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
Re: Sort::Maker: style => "plain" difficulty
am 14.12.2006 20:41:48 von paduille.4060.mumia.w
On 12/14/2006 01:04 PM, Uri Guttman wrote:
>
> this is due to a doc bug more than a coding bug. the section on
> selecting a style doesn't use the 'style' option. i originally thought i
> would use that but dropped it. you just need 'plain' (or another style)
> for the style value. and you must have seen another example (which i
> found) which incorrectly uses 'style'. so i can either edit the text
> (easy) and leave style out or i can add your fix and the tests for it
> and the new docs for it. which should i do? hmmmm. easy edit or lots of
> annoying detail work? tough choice! :)
>
> uri
>
I vote for changing the docs.
:-)
I changed them in my copy:
> my $sorter = make_sorter(
> 'ST',
> init_code => 'my( $str, $num ) ;',
> string => 'do{( $str, $num ) =
> $_->[0][0]{a} =~ /^(\w+):(\d+)$/; $str}',
> number => '$num'
> ) ;
>
And I got rid of the option in @value_args.
--
paduille.4060.mumia.w@earthlink.net
http://home.earthlink.net/~mumia.w.18.spam/