develooper Front page | perl.perl5.porters | Postings from April 2010

[PATCH 3/5] In perlutil.pod 'Convertors', adjust "find2perl" example

Thread Previous | Thread Next
From:
jari.aalto
Date:
April 9, 2010 02:06
Subject:
[PATCH 3/5] In perlutil.pod 'Convertors', adjust "find2perl" example
Message ID:
1270803956-8208-3-git-send-email-jari.aalto@cante.net
From: Jari Aalto <jari.aalto@cante.net>

Add newline between chunks of code. Add space after each comma. Use
operator 'and' instead of '&&'. Use lstat() without parens in simple a
context.

Signed-off-by: Jari Aalto <jari.aalto@cante.net>
---
 pod/perlutil.pod |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/pod/perlutil.pod b/pod/perlutil.pod
index 2fc0022..14e412b 100644
--- a/pod/perlutil.pod
+++ b/pod/perlutil.pod
@@ -115,11 +115,13 @@ C<find2perl . -user root -perm 4000 -print> produces the following callback
 subroutine for C<File::Find>:
 
     sub wanted {
-        my ($dev,$ino,$mode,$nlink,$uid,$gid);
-        (($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) &&
-        $uid == $uid{'root'}) &&
-        (($mode & 0777) == 04000);
-        print("$name\n");
+        my ($dev, $ino, $mode, $nlink, $uid, $gid);
+
+        ($dev, $ino, $mode, $nlink, $uid, $gid) = lstat $_  and
+        $uid == $uid{root} and
+        ($mode & 0777) == 04000;
+
+        print $name, "\n";
     }
 
 =back
-- 
1.7.0


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About