Hello All, I discovered this site some time ago as a fledgling perl scripter and immediately tagged it as my favorite perl site! Now, I am advancing to the next stage of my perl career by posting my first question. I hope I am using this site correctly. I have been toiling over the following code:
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"; }
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.

In reply to File Copy by homer

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.