Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: CGI with nested apps, each calling param() to get their args

by Anonymous Monk
on Oct 12, 2012 at 02:04 UTC ( #998588=note: print w/ replies, xml ) Need Help??


in reply to CGI with nested apps, each calling param() to get their args

This behavior is naively unexpected by me; can somebody please explain this mechanism?

You're expecting too much from a debugging feature of CGI.pm

The CGI protocol communicates through %ENV , and each child process gets the same %ENV as parent process, so to CGI.pm won't use the debugging freature and look at @ARGV

But since CGI programs don't populate @ARGV you can use

#!/usr/bin/perl -- use strict; use warnings; use CGI (); Main( @ARGV ); exit( 0 ); sub Main { my $cgi = @_ ? CGI->new(@_) : CGI->new; }

Or it might be prudent to use GetOpt::Long / --query=a=1;b=2;c=3... instead of testing only for @ARGV


Comment on Re: CGI with nested apps, each calling param() to get their args
Download Code
Re^2: CGI with nested apps, each calling param() to get their args
by Zforgetaboutit (Initiate) on Oct 12, 2012 at 14:34 UTC

    Thank you very much for the simple & elegant solution to my problem. I understand your code.

    I'll be looking in the CGI man page to see where (the equivalent of?) this permitted type of arg-passing is mentioned since I totally missed it.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (15)
As of 2014-10-30 14:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (208 votes), past polls