This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #27748] 'find2perl' bug: -exec causes chdir error
[perl5.git] / x2p / find2perl.PL
index 679ca3c..67022ee 100644 (file)
@@ -290,6 +290,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 +366,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