After you get the param info (from using CGI.pm, of course), if you wanted to execute a particular sub based on a param, you could do something like this (untested):
my %nodes = (
'page1' => \&home,
'something' => \&something,
'another' => \&another
);
##later on...
##stolen from The Perl Cookbook
##assuming that page wanted is in $current_screen
while(my ($wanted_screen, $function) = each %nodes) {
$function->($wanted_screen eq $current_screen);
}
sub page1($) {
my $active = shift;
##do stuff here based on whether its active or not
}
##declare other subs here, taking a true or false value as an arg as s
+hown above
Sorry if this seems too offtopic, but I found it very helpful in situations like yours. Also note that appropiate function is called the way above instead of a simpler way so that if you needed to keep smacking hidden values into the html of your page that are called as params too, you can do it every time the script is invoked.
Hope it helps!!
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.