Ken Clarke wrote:
Hi Folks,
With the release of mod_perl 2 (all say "Yeah Stas!" :) I decided to
dive in. It'll be a change of mindset for me since I've coded perl
scripts for mod_cgi for years.
I have a library of perl modules which occasionally make reference to
package main:: (EG $main::ScriptGlobalHash{'hashkey'} or my $result =
&main::SomeSubroutine(\%args)) However, if my understanding of the docs
is correct, my "main" script now belongs to a request URL specific
package namespace. How should I properly (read safely/portably) refer
to my "main" package? Put another way, how should my packages refer to
variables, subroutines, handles etc which belong to the "top level script".
Ken, I suppose you are talking about registry scripts.
To move your code into the main:: package (which as you've noticed
ModPerl::RegistryCooker moves into a unique-per-script namespace), all you
need to do is declare it at the top of your script. So if you had:
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "mod_perl is easy";
now it'll look like:
#!/usr/bin/perl
package main;
print "Content-type: text/html\n\n";
print "mod_perl is easy";
I haven't tried that, but I think it should do the trick.
--
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com