Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: CHECKING IF HEADER DEFINED

by trwww (Priest)
on Jul 30, 2010 at 22:50 UTC ( #852186=note: print w/replies, xml ) Need Help??


in reply to CHECKING IF HEADER DEFINED

It looks to me like you are using a poorly engineered home grown web app framework and you've got it bursting at the seams.

You should check out CGI::Application, a whole host of problems like this one simply disappear.

Replies are listed 'Best First'.
Re^2: CHECKING IF HEADER DEFINED
by DrHyde (Prior) on Aug 02, 2010 at 11:16 UTC
    And after checking out CGI::Application, you should choose not to use it. It's just a way of replacing a long if/elsif/elsif/else statement with some different and equally verbose boilerplate. IMO it's pointless.
      It's just a way of replacing a long if/elsif/elsif/else statement with some different and equally verbose boilerplate. IMO it's pointless.

      Nope, CGI::Application is a way of modularizing your code by splitting it up into screens (one sub per screen/action).

      Not having to write a giant if/elsif/elsif/else to separate your screens is a huge timesaver.

      Very pointy

        Working on the assumption that you would already have one sub per action (which probably calls several other subs in turn) and merely use the id/elsif/sleif/else to decide which to dispatch to, then I still fail to see what benefits CGI::Application gives you.

        From the documentation, you are expected to do this:

        sub setup { my $self = shift; $self->start_mode('mode1'); $self->mode_param('rm'); $self->run_modes( 'mode1' => 'do_stuff', 'mode2' => 'do_more_stuff', 'mode3' => 'do_something_else' ); }
        which really is just another way of writing this:
        if ($cgi{rm} eq 'mode1') { do_stuff } elsif($cgi{rm} eq 'mode2') { do_more_stuff } ...
        it's just different boilerplate.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://852186]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2019-03-19 03:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How do you Carpe diem?





    Results (89 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!