Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

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

by Anonymous Monk
on May 09, 2012 at 12:56 UTC ( #969612=note: print w/replies, xml ) Need Help??

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

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

Replies are listed 'Best First'.
Re^4: importing functions with "PerlModule" Apache directive
by acanfora (Novice) on May 09, 2012 at 13:11 UTC
    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. 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


      $ 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'

        :) but but but but but but but but acanfora says that Vars() is available :P

        My question is not about barewords. I can use Vars or Vars(), no matter what, my point is not that. The point is about _visibility_ of _function_ Vars in script _whithout_ pass through CGI object instantiation and _whithout_ explicitly importing anything via qw(whatever). Sorry for my bad English.
        I am using Registry. I also found (it seems) the reason of the weird behavior: the CGI module makes use of AUTOLOAD. I think Apache::Request should be more suited to my purposes in this case...

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://969612]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (1)
As of 2018-05-20 14:22 GMT
Find Nodes?
    Voting Booth?