On 16 May 2000 12:51:43 -0400, [EMAIL PROTECTED] (David S. Rosinger) wrote:

>> >    *Ignorecase = \$options{'IGNORECASE'};
>> >
>> >Question #1: What is the point of using a typeglob here?
>> 
>> This is aliasing $Ignorecase and $options{IGNORECASE}.  They now point to
>> the same variable;  changing one will also change the other (because they
>> are the same).
>
>So, it works similar to a reference. I know this approach was used
>more frequently in the Perl 4 days before references were introduced
>in Perl 5.
>
>It doesn't seem to me that there was any point to using typeglobs
>here. It seems the author could have simply done:
>
>    $Ignorecase = $options{'IGNORECASE'};
>
>...Unless I missed something in examining the code. (But I understand
>now that this code may not serve as a good example.)

Run the following code and you'll see the difference. :-)
(Not that I'm claiming that this feature is actually used in ppm, just that
there is a difference between assignment and aliasing).

 $option{IGNORECASE} = 1;
 $Ignorecase = $option{IGNORECASE};
 $option{IGNORECASE} = 2;
 print "\$option{IGNORECASE}=$option{IGNORECASE}  \$Ignorecase=$Ignorecase\n";
 *Ignorecase = \$option{IGNORECASE};
 $option{IGNORECASE} = 3;
 print "\$option{IGNORECASE}=$option{IGNORECASE}  \$Ignorecase=$Ignorecase\n";

>> [`use vars' vs. `our' in 5.6 clipped]
>
>And Thanks for enlightening me on the use of `our'. Does this now mean
>that in a typical module, instead of:
>
>    use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
>
>we'll see:
>
>    our ($VERSION @ISA @EXPORT @EXPORT_OK);   ?

Yes, but only in modules that don't need to be backwards compatible with
earlier versions of Perl.  The core modules bundled with Perl 5.6 have been
changed in the way you indicate.

-Jan



---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
         [EMAIL PROTECTED]
For non-automated Mailing List support, send email to  
         [EMAIL PROTECTED]

Reply via email to