From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: merlyn@stonehenge.com (Randal L. Schwartz) Newsgroups: gmane.emacs.devel Subject: Re: GPL v3 Date: Sat, 14 Jul 2007 07:29:44 -0700 Organization: Stonehenge Consulting Services; Portland, Oregon, USA Message-ID: <86lkdjjbxj.fsf@blue.stonehenge.com> References: <18070.38810.32996.85427@gargle.gargle.HOWL> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1184423408 2147 80.91.229.12 (14 Jul 2007 14:30:08 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 14 Jul 2007 14:30:08 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jul 14 16:30:07 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1I9idK-0004Lv-Fu for ged-emacs-devel@m.gmane.org; Sat, 14 Jul 2007 16:30:06 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I9idK-0005E9-22 for ged-emacs-devel@m.gmane.org; Sat, 14 Jul 2007 10:30:06 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1I9idF-0005E4-U7 for emacs-devel@gnu.org; Sat, 14 Jul 2007 10:30:01 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1I9idE-0005Dp-Dn for emacs-devel@gnu.org; Sat, 14 Jul 2007 10:30:00 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I9idE-0005Dm-8C for emacs-devel@gnu.org; Sat, 14 Jul 2007 10:30:00 -0400 Original-Received: from main.gmane.org ([80.91.229.2] helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1I9idD-0007DX-SX for emacs-devel@gnu.org; Sat, 14 Jul 2007 10:30:00 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1I9id6-0000u7-Rz for emacs-devel@gnu.org; Sat, 14 Jul 2007 16:29:52 +0200 Original-Received: from blue.stonehenge.com ([209.223.236.162]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 14 Jul 2007 16:29:52 +0200 Original-Received: from merlyn by blue.stonehenge.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 14 Jul 2007 16:29:52 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 37 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: blue.stonehenge.com x-mayan-date: Long count = 12.19.14.8.13; tzolkin = 6 Ben; haab = 1 Xul User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (berkeley-unix) Cancel-Lock: sha1:ie91rgALzY6c8nV1R7TIeXqIYEo= X-detected-kernel: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:74764 Archived-At: >>>>> "Mathias" == Mathias Megyei 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 Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!