Jan Dubois <[EMAIL PROTECTED]> writes:

> On 16 May 2000 11:06:13 -0400, [EMAIL PROTECTED] (David S. Rosinger)
> wrote:
> 
> >Jan, this is leading me into some questions on style. Let's take the
> >following for example from build 522:
> >
> >    d:/Perl/bin/ppm.pl
> 
> Please don't use the ppm source code as a base for stylistic wisdom;  some
> of the code in there is still from the days when the author was learning
> Perl.

Well, I thought that the Perl distribution itself might be
enlightening.  Since ppm.pl has been continually revised with each new
release of ActivePerl, I thought it would make a good candidate for
review. However, I'll keep your comment in mind. :-)

I should mention that I first took a look at:

    c:/Perl/bin/lwp-request

which is written by the venerable Gisle Aas. I was surprised to see
that the author chose not to `use strict', perhaps for the convenience
of not needing to declare any of his global variables. Anyway, this
didn't seem to be a good illustration of `best practice'. (But please
tell me if you feel otherwise.)

Anyway, I have found what I was looking for in examining:

    c:/Perl/bin/perlbug.bat

Here, the authors do not use any global variables, and instead use
`my' to declare lexical variables with file scope. (Conclusion: I have
used globals when I should have used lexical variables with file
scope.)

> >and set with *typeglob* notation:
> >
> >    *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.)

> [`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);   ?

--David


---
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