perl.cvs.perlfaq
[Top] [All Lists]

[svn:perlfaq] r11359 - perlfaq/trunk

Subject: [svn:perlfaq] r11359 - perlfaq/trunk
From: rafael@xxxxxxxxxxxx
Date: Sun, 1 Jun 2008 13:08:04 -0700 (PDT)
Newsgroups: perl.cvs.perlfaq

Author: rafael
Date: Sun Jun  1 13:08:03 2008
New Revision: 11359

Modified:
   perlfaq/trunk/perlfaq3.pod

Log:
Subject: [perl #37260] [DOC-PATCH] perlfaq3: Installed modules (File::Find, 
option follow) (was: A fix to a bug of sample code for finding modules in 
perlfaq3.pod) 
From: "Bram via RT" <perlbug-comment@xxxxxxxx>
Date: Sat, 24 May 2008 15:38:00 -0700
Message-ID: <rt-3.6.HEAD-11257-1211668679-1899.37260-14-0@xxxxxxxx>


Modified: perlfaq/trunk/perlfaq3.pod
==============================================================================
--- perlfaq/trunk/perlfaq3.pod  (original)
+++ perlfaq/trunk/perlfaq3.pod  Sun Jun  1 13:08:03 2008
@@ -77,22 +77,25 @@
 
        use File::Find::Rule;
 
-       my @files = File::Find::Rule->file()->name( '*.pm' )->in( @INC );
+       my @files = File::Find::Rule->extras({follow => 1})->file()->name( 
'*.pm' )->in( @INC );
 
 If you do not have that module, you can do the same thing
 with File::Find which is part of the standard library.
 
-    use File::Find;
-    my @files;
+       use File::Find;
+       my @files;
 
-    find(
-      sub {
-       push @files, $File::Find::name
-               if -f $File::Find::name && /\.pm$/
-       },
-
-      @INC
-      );
+       find(
+           {
+               wanted => sub {
+                   push @files, $File::Find::fullname
+                       if -f $File::Find::fullname && /\.pm$/
+               },
+               follow => 1,
+               follow_skip => 2,
+           },
+           @INC
+       );
 
        print join "\n", @files;
 

<Prev in Thread] Current Thread [Next in Thread>
  • [svn:perlfaq] r11359 - perlfaq/trunk, rafael <=