Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Perl project lines of code "analyzer"

by graq (Curate)
on Dec 16, 2005 at 09:09 UTC ( [id://517172]=note: print w/replies, xml ) Need Help??


in reply to Perl project lines of code "analyzer"

I would consider replacing

push @files, $File::Find::name if $ext eq $_;

with

push @files, $File::Find::name if( $ext and $ext eq $_ );

in order avoid potential uninitialized value warnings.

Replies are listed 'Best First'.
Re^2: Perl project lines of code "analyzer"
by psychotic (Beadle) on Dec 20, 2005 at 19:19 UTC
    Updated to:
    $ext and push @files, $File::Find::name if $ext eq $_;
    Thanks for the tip! Working mostly on windows, i often forget that files may not have a type extension in other systems. Regards.

      Where you have...

      my $fname = $_; if (-f $fname) { foreach my $type (qw(pl pm)) { my (undef, $ext) = split (/\./, $fname); if (defined($ext) && $ext eq $type) { push(@files, $File::Find::name); } } }

      It would be better to instead have...

      my $fname = $_; if (-f $fname && /\.p(l|m)$/) { push(@files, $File::Find::name); }

      ...or so I believe. The reason I changed my own copy to this is that I have scripts with the version number at the end like so...

      Frans_Perl_Program.1.5.1.pl

      ...when I am working on something by stages.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://517172]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (2)
As of 2024-04-20 03:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found