in reply to Avoiding user-input in sub calls.
Hi pekkhum,
There are indeed many ways of doing this, avoid using Switch.pm as that is too buggy.
There are indeed many ways of doing this, avoid using Switch.pm as that is too buggy.
What I normally do in this situation is create an HTML drop down like so (which takes away 'true' user input like a text form):
Then in the script have a hash pointing to functions:<select name="foo"> <option value="">Please make a selection <option value="first">First <option value="second">Second </select>
This can then be called by dereferencing the sub:my $doit = $q->param('foo'); my %functions = ('first' => \&one, 'second' => \&two );
Obviously it would probably be wise to have a default to act as an error trap but hopefully the above might give you some ideas.&{ $functions{$doit} };
Another alternative would be to look at CGI::Application which is a handy tool for this kind of thing.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Avoiding user-input in sub calls.
by pekkhum (Sexton) on Nov 01, 2003 at 13:34 UTC | |
by bobn (Chaplain) on Nov 01, 2003 at 14:23 UTC | |
by barrd (Canon) on Nov 01, 2003 at 13:45 UTC | |
by edan (Curate) on Nov 03, 2003 at 07:41 UTC | |
Re: Avoiding user-input in sub calls.
by skx (Parson) on Nov 02, 2003 at 15:14 UTC |
In Section
Seekers of Perl Wisdom