John Doe wrote:
[reordered to bottom style posting]
Jeff Pang am Montag, 16. Januar 2006 01.59:
Thanks for Shawn.The main script can see the global var $q coming from
module,since the main script import this symbol via 'use My::HTML
qw($q)'.But the modules have no any importing behavior,why they can see the
global var $q coming from main script?I'm really confused for that.
Ok, it would be interesting to look deeper into the mess of different
variables all named with the same name $q, exported across the modules,
overwritten by several imports...
What do you want to achieve with your code? It looks really strange (hm, at
least to me).
joe
All the variables $q in the packages have been shunted aside into the
deep, dark bit bucket of oblivion.
As I said before:
$main::q = \*My::HTML::q;
$main::q = \*My::Doc::q;
$My::HTML::q and $My::Doc::q no longer exist; they are aliases to
$main::q. In the modules, $q no longer exists; it is an alias for
$main::q. Whenever you say $q in the modules, you really mean $main::q.
The modules do not import anything; they export any changes to $main::q;
via the phrase '$q'.
--
Just my 0.00000002 million dollars worth,
--- Shawn
"Probability is now one. Any problems that are left are your own."
SS Heart of Gold, _The Hitchhiker's Guide to the Galaxy_
* Perl tutorials at http://perlmonks.org/?node=Tutorials
* A searchable perldoc is available at http://perldoc.perl.org/
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>