Below is an an example program generated by find2perl. The $cwd variable is
(apparently) declared in the BEGIN block. My point is that, if this program
is wrong, then is it a bug in find2perl or something I'm doing wrong? This
error occurs whenever I use the -exec option on find2perl. Changing the
program manually isn't really an option, as I am trying to use find2perl in
another perl script.
Also note that the generated program has two weird characters generated in
it. There are two ^H (control-H) characters, one on the first line and
another on the second line. Not sure if that has anything to do with the
problem or not.
Thanks for any help!
Bill Leonard
----------------------------------------------------------------------------
-----
#! E:Perlinperl.exe -w
eval 'exec E:Perlinperl.exe -S $0 ${1+"$@"}'
if 0; #$running_under_some_shell
use strict;
use File::Find ();
# Set the variable $File::Find::dont_use_nlink if you're using AFS,
# since AFS cheats.
# for the convenience of &wanted calls, including -eval statements:
use vars qw/*name *dir *prune/;
*name = *File::Find::name;
*dir = *File::Find::dir;
*prune = *File::Find::prune;
# Traverse desired filesystems
File::Find::find({wanted => \&wanted}, '.');
exit;
sub wanted {
/^.*\.txt\z/s &&
&doexec(0, 'type','{}');
}
BEGIN {
require Cwd;
my $cwd = Cwd::cwd();
}
sub doexec {
my $ok = shift;
for my $word (@_)
{ $word =~ s#{}#$name#g }
if ($ok) {
my $old = select(STDOUT);
$| = 1;
print "@_";
select($old);
return 0 unless <STDIN> =~ /^y/;
}
chdir $cwd; #sigh
system @_;
chdir $File::Find::dir;
return !$?;
}
----------------------------------------------------------------------------
-----
-----Original Message-----
From: Ron Grabowski [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 15, 2001 12:37 PM
To: Leonard, William C; [EMAIL PROTECTED]
Subject: Re: find2perl: -exec problem
> Global symbol "$cwd" requires explicit package name at - line 45.
Is $cwd declared on line 45?
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users