Hi,

Jan Eden wrote on 27.07.2005:

>In other words, I would like to have something like the %actions
>hash to construct a more flexible version of the $item->$mode()
>construct, where I can pass different additional parameters to each
>method.

I finally came up with something myself:

my %actions = (
    display => sub { $item->display() },
    move_picture => sub { $item->move_picture($item->{id}, 
$item->{parameters}->{position}) },
    commit => sub { $item->commit() }
);

$actions{$parameters{mode}}->();

Thanks,

Jan
-- 
I used to have a Heisenbergmobile. Every time I looked at the speedometer, I 
got lost.

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to