Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Passing arrays and references to arrays

by davorg (Chancellor)
on Aug 10, 2005 at 11:23 UTC ( [id://482569]=note: print w/replies, xml ) Need Help??


in reply to Passing arrays and references to arrays

You're exactly right in your analysis of what is going on and I'd consider that a serious bug in the documentation of the module. It actually gets worse when you see the rest of that code sample:

my @choices = [ qw/one one.green one.blue one.yellow two.blue two.green two.cyan three.red three.white three.yellow/ ]; $mw->Button->pack(-side => 'left'); my $me = $mw->MatchEntry( -choices => @choices, -fixedwidth => 1, -ignorecase => 1, -maxheight => 5, -entercmd => sub { print "callback: -entercmd\n"; }, -onecmd => sub { print "callback: -onecmd \n"; }, -tabcmd => sub { print "callback: -tabcmd \n"; }, -zerocmd => sub { print "callback: -zerocmd \n"; }, )->pack(-side => 'left', -padx => 50);

Now consider what happens if @choices contains more than one element (as you'd expect to be able to do with an array). It gets particularly bad if the array has an even number of elements - all of the following parameters will be broken.

I recommend you raise a bug on rt.cpan.org and, in the meantime, make a note of the problem on AnnoCPAN.

--
<http://dave.org.uk>

"The first rule of Perl club is you do not talk about Perl club."
-- Chip Salzenberg

Replies are listed 'Best First'.
Re^2: Passing arrays and references to arrays
by GrandFather (Saint) on Aug 10, 2005 at 20:39 UTC

    I already raised a bug, but without fully understanding the code. I'll go back and modify the bug report.


    Perl is Huffman encoded by design.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://482569]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-04-18 18:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found