http://qs321.pair.com?node_id=11148788


in reply to Re^2: CGI::Tiny versus undefined parameter/form field
in thread CGI::Tiny versus undefined parameter/form field

...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.