Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
From the CGI docs:
If you create the CGI object in one package e.g. "main") and then obtain the filehandle in a different package (e.g. "foo"), the filehandle will be accessible through "main" but not "foo".
An outline of what I am currently doing:
in Foo.cgi:
and then in Bar.pm:use Bar; use CGI; our $q = CGI->new(); Bar::do_stuff(\$q);
This works, however since I would like 'Bar.pm' to be a general-purpose module, I would prefer not to have to refer to 'main::q' being that the CGI object may not always be named '$q'. Any thoughts would be greatly appreciated.sub do_stuff { # the issue is here my $uf = $main::q->upload($fh); open (FH, "> $uld/$name") while (<$uf>) {print FH}; close(FH); return; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Yet Another CGI File Upload Question
by BUU (Prior) on Aug 01, 2003 at 23:10 UTC | |
by tachyon (Chancellor) on Aug 02, 2003 at 11:33 UTC | |
|
Re: Yet Another CGI File Upload Question
by tachyon (Chancellor) on Aug 02, 2003 at 11:41 UTC | |
|
Re: Yet Another CGI File Upload Question
by sgifford (Prior) on Aug 02, 2003 at 09:17 UTC |