[svn:perlfaq] r11359 - perlfaq/trunk

[email protected] Sun, 1 Jun 2008 13:08:04 -0700 (PDT)
Newsgroups perl.cvs.perlfaq
Message-ID <[email protected]>
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" <[email protected]>
Date: Sat, 24 May 2008 15:38:00 -0700
Message-ID: <[email protected]>


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;