Click here to get back home

Sort::Maker: style => 'plain' difficulty

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Sort::Maker: style => 'plain' difficulty Mumia W. (on aioe) 12-14-2006
Posted by Mumia W. (on aioe) on December 14, 2006, 4:35 am
Please log in for more thread options


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.


Posted by Mumia W. (on aioe) on December 14, 2006, 6:09 am
Please log in for more thread options


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-------------------



Posted by Uri Guttman on December 14, 2006, 2:04 pm
Please log in for more thread options



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

Posted by Mumia W. (on aioe) on December 14, 2006, 2:41 pm
Please log in for more thread options


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] =~ /^(\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/


Similar ThreadsPosted
Sort::Maker: (Notes) The plain and the orcish don't include the "init_code" December 14, 2006, 7:32 am
ANNOUNCE: Sort::Maker .02 September 2, 2004, 5:09 am
Sort::Maker : anonymous sub is compiled outside of my module December 5, 2006, 8:25 am
Accomodate for poor db design using Sort::Maker? December 9, 2006, 12:48 am
Convert MS-Word to plain text May 9, 2008, 1:29 pm
module to convert wiki-style to html June 16, 2005, 3:09 pm
Module setup style and BEGIN blocks May 7, 2006, 8:53 pm
Parsing function args in Getopt::Long style January 11, 2008, 4:11 pm
How to write Delphi 2005 XML-style project files (.bdsproj)? February 23, 2005, 10:48 am
trying to use HTML::Mason on apache2 but scripts come up as plain text in the browser October 23, 2006, 1:50 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap