homer has asked for the wisdom of the Perl Monks concerning the following question:
My objective is to copy a file or files from my Win2k machine to one or more remote Win2k machines. I have been working with the Win32API::File module, but haven't been successful. It complains that it can't find the sub copy in my main package."Undefined subroutine &main::copy called at copynetcoolfiles.pl". Why is it only looking at my main symbol table when I have loaded the Win32API module? Could use some pointers. Thanks.use Win32API::File 0.08 qw( :Func ); use Net::Ping; if( $#ARGV > 1 || ! $ARGV[0] ) { usage(); exit 1; } $source = '\path\to\local\file(s)'; $destination = '\path\to\remote\host'; $hostname = $ARGV[0]; $p = Net::Ping->new("icmp"); if( $p->ping($hostname )) { print "\u$hostname is alive.\n"; copy($source, $destination); } else { print "\u$hostname is not reachable\n"; $p->close(); } sub usage { print "Please enter either an IP address or a Hostname\n"; print "Usage: Copied file/s to specified Hostname or IP addres +s"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: File Copy
by demerphq (Chancellor) on Mar 13, 2002 at 15:39 UTC | |
|
Re: File Copy
by VSarkiss (Monsignor) on Mar 13, 2002 at 15:53 UTC | |
|
Re: File Copy
by Juerd (Abbot) on Mar 13, 2002 at 15:56 UTC |