in reply to First Perl CGI app; desirous of peer review.
However, you would need to modify each sub to take the same arguments, which isn't that hard (see below). In addition, while your script does not do anything if the action type is unknown beyond print out header and footer (even though you have checked for it at check_param), you should still cover it here, so that your function calling routine can look like:my %functions = ( default => \&write_default, warning => \&write_warning, confirm => \&write_confirm, commit => \&write_commit );
# This is outside of main, in the 'global' block my %function = ( # see above ); # The rest is inside of main $action = ( $function{ $action } ) ? $action : 'default'; # you could also have an 'invalid' block here for an invalid # parameter &$function{ $action } ( $script_loc, $email, $name, $warning_msg );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: First Perl CGI app; desirous of peer review.
by legLess (Hermit) on Jun 24, 2001 at 21:56 UTC |