X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=x2p%2Ffind2perl.PL;h=cc6c6d805d87081100bca9332a2f146b3d54edfd;hb=8bbf3450a1ff0a3996dade29a4194cc0939d871f;hp=679ca3c05c747d9a12be7229bf8205556f4ab9b2;hpb=9c4673c112c9c6db503869f421b813d3c489a10e;p=p5sagit%2Fp5-mst-13.2.git diff --git a/x2p/find2perl.PL b/x2p/find2perl.PL index 679ca3c..cc6c6d8 100644 --- a/x2p/find2perl.PL +++ b/x2p/find2perl.PL @@ -215,6 +215,7 @@ while (@ARGV) { my $prog = shift; $prog =~ s/'/\\'/g; $out .= tab . "eval {$prog}"; + $print_needed = 0; } elsif ($_ eq 'depth') { $find = 'finddepth'; next; @@ -265,7 +266,9 @@ while (@ARGV) { } if ($print_needed) { - $out .= "\n" . tab . '&& print("$name\n")'; + my $t = tab; + if ($t !~ /&&\s*$/) { $t .= '&& ' } + $out .= "\n" . $t . 'print("$name\n")'; } @@ -290,6 +293,14 @@ $declaresubs END +if (exists $init{doexec}) { + print <<'END'; +use Cwd (); +my $cwd = Cwd::cwd(); + +END +} + if (exists $init{ls}) { print <<'END'; my @rwx = qw(--- --x -w- -wx r-- r-x rw- rwx); @@ -358,9 +369,6 @@ END if (exists $init{doexec}) { print <<'END'; -use Cwd (); -my $cwd = Cwd::cwd(); - sub doexec ($@) { my $ok = shift; my @command = @_; # copy so we don't try to s/// aliases to constants