Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

CGI.pm and frames

by PerlJam (Sexton)
on Feb 23, 2001 at 05:49 UTC ( [id://60412]=perlquestion: print w/replies, xml ) Need Help??

PerlJam has asked for the wisdom of the Perl Monks concerning the following question:

Help me obi-wan you're my only hope. I am making a flashcards script where users can create accounts and store subjects, etc. Well, I have come to a problem diplaying frames using CGI.pm. I have written up a small page that details the problems I am having the errors I have received and that has the code listing (too long for discussion group). If any would be so kind to take a look it would be greatly appreciated. You can find it here.
--Jason Sperry
-------------------------------------------------------
Nothing in the world can take the place of persistence. Talent will not; nothing is more common than unsuccessful men with talent. Genius will not; unrewarded genius is almost a proverb. Education will not; the world is full of educated failures. Persistence and determination alone are omnipotent. --Calvin Coolidge (1872-1933)

Replies are listed 'Best First'.
Re: CGI.pm and frames
by chromatic (Archbishop) on Feb 23, 2001 at 07:16 UTC
    Here's the relevant snippet having errors:
    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(); }
    When PerlJam sends an action parameter with the 'displayCards' value, he gets uninitialized value errors in the $Pages{$page} call.

    My solution would be to say:

    my $action = $query->param('action'); if (exists $Pages{$action}) { $Pages{$action}->(); } else { noSuchPage(); }
    This would reveal that there's no key in %Pages named 'displayCards'. Instead, it's 'View Flashcards'. :)
      Thank you so much kind sir. I can't believe I didn't notice that :)
      ----
      Nothing in the world can take the place of persistence. Talent will not; nothing is more common than unsuccessful men with talent. Genius will not; unrewarded genius is almost a proverb. Education will not; the world is full of educated failures. Persistence and determination alone are omnipotent. --Calvin Coolidge (1872-1933)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://60412]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2024-03-29 02:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found