in reply to Lexical and dynamic scope confusion!
If you don't import the CGI "sub1" through arguments like: use CGI qw/sub1 :standard/; the unqualified sub1 you call will be your own.
This really has nothing to do with lexical scope, because sub names are always in the symbol table.
Dynamic scopes can temporarily replace CGI's notional sub1 with your own like this (in namespace main::) :
Locally changing CGI::sub1() to something else for the duration of a dynamic scope causes all the CGI uses of sub1 to find yours instead of CGI's.{ local *CGI::sub1 = \&sub1; # do some CGI things }
After Compline,
Zaxo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Lexical and dynamic scope confusion!
by GoCool (Scribe) on Mar 27, 2005 at 06:06 UTC | |
by Zaxo (Archbishop) on Mar 27, 2005 at 06:15 UTC |