From: Slaven Rezic Date: Sun, 30 Nov 2003 22:16:59 +0000 (+0100) Subject: Re: [perl #24574] find2perl provides different results to find X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9c4673c112c9c6db503869f421b813d3c489a10e;p=p5sagit%2Fp5-mst-13.2.git Re: [perl #24574] find2perl provides different results to find Message-ID: <8765h1pnec.fsf@vran.herceg.de> (plus a note about find2perl now defaulting to -print in perldelta) p4raw-id: //depot/perl@21834 --- diff --git a/pod/perldelta.pod b/pod/perldelta.pod index b71457e..f8b5dea 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -460,6 +460,9 @@ C works now at least somewhat better, while C is rather more broken. (The Perl compiler suite as a whole continues to be experimental.) +C now assumes C<-print> as a default action. It needed to be +specified explicitly. + =head1 New Documentation perl573delta has been added to list the differences between the diff --git a/x2p/find2perl.PL b/x2p/find2perl.PL index 94cf242..679ca3c 100644 --- a/x2p/find2perl.PL +++ b/x2p/find2perl.PL @@ -80,6 +80,7 @@ my $out = ''; my $declaresubs = "sub wanted;\n"; my %init = (); my ($follow_in_effect,$Skip_And) = (0,0); +my $print_needed = 1; while (@ARGV) { $_ = shift; @@ -117,8 +118,10 @@ while (@ARGV) { $out .= tab . "-$filetest _"; } elsif ($_ eq 'print') { $out .= tab . 'print("$name\n")'; + $print_needed = 0; } elsif ($_ eq 'print0') { $out .= tab . 'print("$name\0")'; + $print_needed = 0; } elsif ($_ eq 'fstype') { my $type = shift; $out .= tab; @@ -183,6 +186,7 @@ while (@ARGV) { $declaresubs .= "sub doexec (\$\@);\n"; $init{doexec} = 1; } + $print_needed = 0; } elsif ($_ eq 'ok') { my @cmd = (); while (@ARGV && $ARGV[0] ne ';') @@ -194,6 +198,7 @@ while (@ARGV) { { local $" = "','"; $out .= "doexec(1, '@cmd')"; } $declaresubs .= "sub doexec (\$\@);\n"; $init{doexec} = 1; + $print_needed = 0; } elsif ($_ eq 'prune') { $out .= tab . '($File::Find::prune = 1)'; } elsif ($_ eq 'xdev') { @@ -217,6 +222,7 @@ while (@ARGV) { $out .= tab . "ls"; $declaresubs .= "sub ls ();\n"; $init{ls} = 1; + $print_needed = 0; } elsif ($_ eq 'tar') { die "-tar must have a filename argument\n" unless @ARGV; my $file = shift; @@ -258,6 +264,10 @@ while (@ARGV) { } } +if ($print_needed) { + $out .= "\n" . tab . '&& print("$name\n")'; +} + print <<"END"; $startperl @@ -833,7 +843,9 @@ True if last-modified time of file matches N. =item C<-print> -Print out path of file (always true). +Print out path of file (always true). If none of C<-exec>, C<-ls>, +C<-print0>, or C<-ok> is specified, then C<-print> will be added +implicitly. =item C<-print0>