That's a good end for us all.Thanks for Shawn and John too.

-----Original Message-----
>From: John Doe <[EMAIL PROTECTED]>
>Sent: Jan 16, 2006 2:09 PM
>To: beginners@perl.org
>Subject: Re: about the var's scope
>
>Shawn Corey am Montag, 16. Januar 2006 04.12:
>> 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.
>
>Shawn, Jeff,
>
>seems that it couldn't be more embarassing/awqward for me...
>(yes, I know who Stas Bekman is, Jeff)
>
>On the other side, I'm very happy having demonstrated the mess in my brain 
>with the last post, since, at last, I begin to realize now something that I 
>had the feeling not to fully understand during several years (sic!). 
>
>I fear the result was an unnecessary amount of complexity in a lot of my code 
>that could have been avoided. Have to check that in detail.
>
>> 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'.
>
>
>Part of my confusion was (I think) that I didn't realize that, with 
>$main::q = \*My::HTML::q,
>I can not only "influence the main script by a module", but also in the other 
>direction! (as the term 'alias' says...).
>
>Now, I see the code in the OP with different eyes!
>
>Thanks a *lot* to you two for giving me the chance to understand the 
>use vars / Exporter issue better!
>
>Arggg...
>
>Have a nice time
>joe
>
>-- 
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
><http://learn.perl.org/> <http://learn.perl.org/first-response>
>
>


--
http://home.earthlink.net/~pangj/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to