dimmesdale has asked for the wisdom of the Perl Monks concerning the following question:
$canvas->bind($dk_img, "<Button-1>", [\&frst_clk, { deck => $deck, waste => $waste, img => $dk_img }]);
Well, after some experimentation, I realized the placement of how I get at the arguments is VERY important (i.e., if I don't shift the first arg off--an implicit Tk object, in this case a canvas--getting at the other one is a mess).
However, even after this, I cannot seem to get at the other argument. I'm getting unitialized errors, so I 'Data::Dumped' it, resulting in this:
$VAR1 = { 'deck' => bless( { 'next' => 0, 'num' => 0, 'max' => 52, 'cards' => [ bless( { 'state' => 'up', 'where' => $VAR1->{ +'deck'}, 'value' => 'j', 'suit' => 's' }, 'Card' ), ...more blessed cards... bless( { 'state' => 'down', 'where' => $VAR1->{ +'deck'}, 'value' => 5, 'suit' => 'c' }, 'Card' ) ] }, 'Pile' ), 'img' => 12, 'waste' => bless( { 'next' => 0, 'num' => 0, 'max' => 52 }, 'Pile' ) };
Well, I know I have what I want, so its a tricky matter of dereferencing, or what not. I figured it was an anonymous array, so I tried:
$_->{deck} ## to no avail, so then I tried: $_{deck} ## then: ${@_{deck}} ## and a bunch of other big and baggy monsters ...
How do I get at the data?
(incidentally, this is the result of a rewrite of some code I posted before about a solitaire program, viewable on my sketch pad...soon)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: anonymous hashes as arguments in Tk
by svad (Pilgrim) on Jul 11, 2002 at 00:08 UTC | |
Re: anonymous hashes as arguments in Tk
by stefp (Vicar) on Jul 11, 2002 at 00:09 UTC | |
by herveus (Prior) on Jul 12, 2002 at 15:19 UTC | |
Re: anonymous hashes as arguments in Tk
by herveus (Prior) on Jul 11, 2002 at 15:00 UTC | |
Re: anonymous hashes as arguments in Tk
by dimmesdale (Friar) on Jul 11, 2002 at 17:53 UTC |