bradcathey has asked for the wisdom of the Perl Monks concerning the following question:
or by some hard links, like:<input type="submit" name="funct" value="View Books">
CGI parses the input values, including $funct, which then directs the processing to one of a number of subroutines.<a href="cgi-bin/script.pl?funct=view%20books>View Books</a>
I left all that "switching" code in there so you could see just how many subs need to be called and how they are called.SWITCH: for ($funct){ /save news/i && do { &savenews; last; }; /save book/i && do { &addbook; last; }; /save observ/i && do { &addobserv; last; }; /save rule/i && do { &addrule; last; }; /update book/i && do { &updatebook; last; }; /update observ/i && do { &updateobserv; last; }; /update rule/i && do { &updaterule; last; }; /edit news/i && do { &editnews; last; }; /edit book/i && do { &editbook; last; }; /edit observ/i && do { &editobserv; last; }; /edit rule/i && do { &editrule; last; }; /add book/i && do { &addbkform; last; }; /add observ/i && do { &addobform; last; }; /add rule/i && do { &addruform; last; }; /list authors/i && do { &listall; last; }; /list titles/i && do { &listall; last; }; /view news/i && do { &viewnews; last; }; /view book/i && do { &viewbooks; last; }; /view observ/i && do { &viewobserv; last; }; /view rule/i && do { &viewrules; last; }; /next/i && do { &viewbooks; last; }; /prev/i && do { &viewbooks; last; }; $funct = ""; } print "Content-type: text/html\n\n"; print $template->output; #display html #end
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Redirection within a Perl script
by Zaxo (Archbishop) on Dec 04, 2003 at 02:26 UTC | |
by bradcathey (Prior) on Dec 04, 2003 at 03:18 UTC | |
|
Re: Redirection within a Perl script
by runrig (Abbot) on Dec 04, 2003 at 02:17 UTC | |
by simonm (Vicar) on Dec 04, 2003 at 04:17 UTC | |
by bradcathey (Prior) on Dec 04, 2003 at 03:13 UTC |