no nothing is showing up in the file.  Here is where I looked for 
information on Net::FTP

http://search.cpan.org/~gbarr/libnet-1.19/Net/libnetFAQ.pod

ok I will look in perldoc -f package.  Is there a better place though?








Chris Devers <[EMAIL PROTECTED]>
09/15/2004 07:04 PM
Please respond to Perl Beginners List

 
        To:     [EMAIL PROTECTED]
        cc:     Perl Beginners List <[EMAIL PROTECTED]>
        Subject:        Re: Net ::FTP and subroutine calls


On Wed, 15 Sep 2004 [EMAIL PROTECTED] wrote:

The Python folks are right -- whitespace is your friend! Use it!

>     sub ftpme {
> 
>         my $remotehost = "ftp.digitalarchives.com";
>         my $user       = "cb100524";
>         my $pass       = "xxxxxxx";
>         my $data       = $scratchtps;
>         my $ftplog     = "/usr/local/log/ftp_IrMt_scratchtapes.log";
> 
>         my $ftp        = Net::FTP->new(
>            $remotehost, Debug => 10
>         ) or die "cannot connect to $remotehost: IronMt";
>         $ftp->login($user, $pass)
>           or die "cannot login ", $ftp->$ftplog;
>         $ftp->ascii();
>         $ftp->cwd('archive');
>         $ftp->put($data)
>           or die "FTP put to IrMt failed", $ftp->$ftplog;
>         $ftp->quit;
> 
>     }
> 
> 
> and I want to append the result data to my log file.  I ran it and the 
> files was 0 bytes.  What am I doing wrong?

Is anything showing up in the $ftplog file ?

I've never used Net::FTP, but that seems like the first place to look.

Does Net::FTP really provide a method $ftp->$ftplog ? I'm surprised that 
a valid module name can be a variable like that. If you're trying to 
write debug output to a log, this may not be the right way to do it, 
unless the Net::FTP docs specifically recomment this kind of code.

> Also, how and what do I use to call a subroutine block that is in 
> another file from my MAIN Perl program?  Will you please provide a 
> code example?

The best way to do it is to make a package out of your subroutine (see 
the usual references for the `package` statment, as well as basic OO 
documentation), then put this file somewhere that Perl will find it (or 
use a `use lib ...` statement to tell it where to look -- again, look up 
the documentation for details), and then just `use MyLibrary;` will do.

Look up the documentation and you'll find lots of good examples.



-- 
Chris Devers


Reply via email to