Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
...inside the cgi { ... } codeblock. I have "$cgi->param()" calls scattered across a multitude of subroutines

Per the CGI::Tiny documentation, that $cgi object is only valid inside the cgi { ... } codeblock. "There is no CGI::Tiny object constructor; the object is accessible within the cgi block, only reads request data from the environment once it is accessed, and ensures that a valid response is rendered to avoid gateway errors even in the event of an exception or premature exit." You might be able to rework it so that the code in the cgi {...} block is calling all your subroutines, and you pass the $cgi object as an argument to each of those subroutines, but that may be a lot of refactoring.

As I said, if you're really looking for a drop-in replacement for CGI.pm, where you can use the $cgi object throughout your code with the same syntax you are used to from CGI.pm, you will likely want to use something like CGI::Simple instead of CGI::Tiny.


In reply to Re^3: CGI::Tiny versus undefined parameter/form field by pryrt
in thread CGI::Tiny versus undefined parameter/form field by Polyglot

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 chilling in the Monastery: (7)
As of 2024-04-24 03:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found