Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^2: importing functions with "PerlModule" Apache directive

by acanfora (Novice)
on May 09, 2012 at 11:34 UTC ( #969602=note: print w/ replies, xml ) Need Help??


in reply to Re: importing functions with "PerlModule" Apache directive
in thread importing functions with "PerlModule" Apache directive

I was just thinking about to use the PerlPostConfigRequire directive, I actually just switched to it in my apache.conf and everything is working fine:

PerlPostConfigRequire /etc/apache2/startup.pl
It is not yet clear to me the behavior with exported functions, I mean, I put in startup.pl
use CGI qw(-compile -utf8);
and avoided to import CGI in my test script, but I can still call Vars() function directly, which from CGI documentation should not be visible:
#!/usr/bin/perl $ENV{PATH}=''; local our $o; $o->{authenticated}=0; local our $cookie; local our $duration=600; local our $r=new CGI; local our $p=Vars; ...
What's going on?


Comment on Re^2: importing functions with "PerlModule" Apache directive
Select or Download Code
Re^3: importing functions with "PerlModule" Apache directive
by Anonymous Monk on May 09, 2012 at 12:56 UTC

    and avoided to import CGI in my test script, but I can still call Vars() function directly, which from CGI documentation should not be visible:

    What's going on?

    You're imagining things :)

    Even if you used  use CGI qw(-compile -utf8 Vars ); there is no way Vars would be available to your script , unless you're using something ( its not ModPerl::Registry ) to make it available

      Pay attention: I stated that Vars is actually available in my test script even if I did not imported it (purposely, at least) in any way.
      startup.pl script: use CGI; mytestscript: #!/usr/bin/perl local our $p=Vars; # it works!!!

        You're not using strict, so of course local our $p=Vars will work. It's just an assignment of a string to a package variable. Compare:

        $ perl -ce'local our $p=Vars' -e syntax OK

        versus:

        $ perl -Mstrict -ce'local our $p=Vars' Bareword "Vars" not allowed while "strict subs" in use at -e line 1. -e had compilation errors.

        Also of interest:

        $ perl -MO=Deparse -e'local our $p=Vars' local $p = 'Vars'; -e syntax OK
        perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (11)
As of 2014-10-01 13:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    What is your favourite meta-syntactic variable name?














    Results (21 votes), past polls