in reply to CGI.pm and frames
When PerlJam sends an action parameter with the 'displayCards' value, he gets uninitialized value errors in the $Pages{$page} call.my %Pages = ( 'Login' => \&validateAccount, 'Create Account' => \&createAccount, 'User Options' => \&userOptions, 'View Flashcards' => \&displayCards, ); if ( !$q->param ) { loginPage(); } elsif ($q->param('action')) { my $page = $q->param('action'); $Pages{$page}->(); } else { noSuchPage(); }
My solution would be to say:
This would reveal that there's no key in %Pages named 'displayCards'. Instead, it's 'View Flashcards'. :)my $action = $query->param('action'); if (exists $Pages{$action}) { $Pages{$action}->(); } else { noSuchPage(); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: CGI.pm and frames
by PerlJam (Sexton) on Feb 23, 2001 at 12:55 UTC |