On Tue, 29 May 2001, Paul wrote:

> > %FORM_DATA (which I am guessing is defined and/or created in
> > libcgi2.pl) isn't explicitly put into a package
> > (which you correctly do with the $key scalar, using 'my').
>
> Not to correct those smarter and more knowledgeable, I'd like to call a
> rephrase on that one. =o)

I don't think you mean me... :-\

> my() makes a variable lexical, meaning it isn't in any package.
> packages equate to namespaces, which mean little or nothing to
> lexicals, who live and die in terms of scope.

Good call.  How specifically does code in a require get evaluated?
According to the require manpage, it does a "do 'filename.pl' with some
code wrapped around it to check @INC and make sure it hasn't already been
included.  According to the do manpage, code evaluated with do cannot see
lexicals in the enclosing scope.  So, specifically, how do lexical
variables get affected in a require?

> > Since you are requiring the library, it is getting included into the
> > current file, for which you are usng the strict
> > . . . .
>
> current file *scope*, no. Current file *package*, yes.
> Though I add the caveat that I've never used requires.
> I make everything modules.

I don't use require either... but using the strict pragma and then
requiring a file afterwards that doesn't conform to the strict syntax will
definitely barf.

-- Brett

Brett W. McCoy
Software Engineer
Broadsoft, Inc.
240-364-5225
[EMAIL PROTECTED]

Reply via email to