Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

That's because POST data comes into the program on STDIN, as opposed to the environment table which is used for GET data ($ENV{QUERY_STRING}). STDIN can only be read once, and so the first CGI object instantiated will suck it all up.

friedo++

Also, this is why app frameworks like CGI::Application and Catalyst are pure genious. In the case of CGI::Application, one says:

$self->query

and knows he has the right object.

If a code base has this particular type of bug, I'd probably be willing to bet there is a host of other worse ones lurking. I know because I've written them :-)

At a minimum, if CGI->new is being called more than once per request there are troubles. If it is being done with the session object, (sometimes) there are serious troubles.

The session manager I use is used in production on a large quantity of computers. It has probably been debugged by more than 100 people. The following is an example usage:

CGI::Application::Plugin::Session example

Building frameworks is fun, but if you're trying to up your productivity, check out a perl web app framework.

If you didnt read the link above, at least consider the following:

http://search.cpan.org/search?query=CGI::Application::Plugin&mode=all

There you'll find a html popup dbi profiler, database driven session based auth, heck even a CAPTCHA plugin.

trwww
-- beating on the perl web app framework drum

In reply to Re^4: Uploading Files with CGI.pm results in 0 byte files by trwww
in thread Uploading Files with CGI.pm results in 0 byte files by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2024-04-24 06:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found