[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GPL v3
From: |
Randal L. Schwartz |
Subject: |
Re: GPL v3 |
Date: |
Sat, 14 Jul 2007 07:29:44 -0700 |
User-agent: |
Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (berkeley-unix) |
>>>>> "Mathias" == Mathias Megyei <address@hidden> writes:
Mathias> # start in current directory
Mathias> @list = glob("./*");
Mathias> foreach my $d (@list) {
Mathias> $fhtest->print("$d\n");
Mathias> if (-d $d and ! -l $d) {
Mathias> # if directory, append to @list and look into it later
Mathias> push(@list, glob($d . "/*"));
Mathias> } elsif (-f $d) {
Mathias> # file found, update it to gpl3
Mathias> change_gpl($d);
Mathias> } else {
Mathias> # not file and not directory, should never happen
Mathias> print("of unknown type: $d\n");
Mathias> }
Mathias> }
In the future, take a look at File::Find for this. No need
to rewrite treewalking... it's part of the core libs.
Mathias> my $fh = new FileHandle $file, "r";
Indirect Object syntax is officially discouraged. And in all
modern Perl versions, you can write this as:
open my $fh, "r", $file or die "Cannot open $file for read: $!";
Those were the two errors that I would flag as "must fix" in a code
review. Sorry, but I presume people might stumble across your suboptimal code
in a google search, so I have to put my comment publicly as well.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<address@hidden> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
- GPL v3, Mathias Megyei, 2007/07/12
- Re: GPL v3, Andreas Schwab, 2007/07/12
- Re: GPL v3, Richard Stallman, 2007/07/12
- Re: GPL v3,
Randal L. Schwartz <=