Right thanks.... forgot about that!  So how do I out this failed info to 
STDOUT (ftplog), b/c if it does fail I would want to know!
As far as the $^ I variable, yes I have tried just opening the files and 
reading and writing from them!  Thanks for the tips and I am still GREEN ! 
:)
What could be wrong with the in place editor ??? I am running this program 
as UID = 0.    Any ideas? 

thanks.

Here is what I have but it still not working.


        sub ftpme {

                my $remotehost="ftp.digitalarchives.com";
                my $remotedir="archive";
                my $user="xxxxxxxx;
                my $pass="xxxxxxx;
                my $data=$scratchtps;
                my $ftplog="/usr/local/log/ftp_IrMt_scratchtapes.log";

                my $ftp = Net::FTP->new($remotehost, Debug => 10)
                || die "Cannot connect to $remotehost: IronMt: $!, print 
($ftplog)";
                $ftp->login($user, $pass) or die "Login failed!: $!, print 
($ftplog)";
                $ftp->ascii();
                $ftp->cwd($remotedir);
                $ftp->put($data) or die "FTP put to IrMt failed!: $!, print ($ftplog)";
                $ftp->quit;

        }


Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams
614-566-4145





Chris Devers <[EMAIL PROTECTED]>
09/16/2004 04:59 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:

> no nothing is showing up in the file. 

Okay then, so this logging code is all hand-written ?

It seems then that nothing in this script is actually writing to the log 
file you've asked for, because there's no such thing as "$ftp->$ftplog"
(or "$ftp->/usr/local/log/ftp_IrMt_scratchtapes.log" as it ends up.) 

Let's keep this simple and remove the log entirely for now. Does a 
stripped down version like what I have here work for you ?

    my $scratchtps = qq[ whatever ];
    ftpme( $scratchtps );

    sub ftpme {

        my $data       = shift;

        my $remotehost = "ftp.digitalarchives.com";
        my $user       = "cb100524";
        my $pass       = "xxxxxxx";

        my $ftp        = Net::FTP->new(
           $remotehost, Debug => 10
        ) or die "cannot connect to $remotehost: IronMt: $!";
        $ftp->login($user, $pass)
          or die "cannot login: $!";
        $ftp->ascii();
        $ftp->cwd('archive');
        $ftp->put($data)
          or die "FTP put to IrMt failed: $!";
        $ftp->quit;

    }

This version should produce better diagnostic information, because it's 
adding $! to the `die` phrases to output any error messages. 

> 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?

If you're old-fashioned and like books, Damian Conway's _Object Oriented 
Perl_ is an excellent manual for this side of Perl, and Randal Schwartz 
and Tom Phoenix's _Perl Objects, References, and Modules_ is another. 

Alternately, look over any Perl Object Oriented documentation online -- 
packages are a basic foundation of writing OO code.


-- 
Chris Devers


Reply via email to