in reply to Yet Another CGI File Upload Question

Either have Bar.pm create it's own CGI object ( I forget whether or not CGI is a Singleton and so would have multiple objects access the same param code ) or just pass in a cgi object, either when you load it or when you call the func:
use CGI; my $c = new CGI; use Bar ($c); Bar::do_stuff(); package Bar; my $cgi; sub import { $cgi = $_[1]; } sub do_stuff { $cgi->foo; #etc }

Replies are listed 'Best First'.
Re: Re: Yet Another CGI File Upload Question
by tachyon (Chancellor) on Aug 02, 2003 at 11:33 UTC

    You can only really call new() once with either CGI.pm or CGI::Simple.pm and probably all the rest of the CGI:: modules.

    REASON: You have to parse the query string with a GET (you can do this over and over) BUT with POST you are reading from STDIN - once you read the data it is GONE so your new objects will exist OK, but they will have no data in them if it was a POST as STDIN will be NULL after the first instantiation.

    cheers

    tachyon

    s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print