Title: RE: Perl with FTP

Ok still not working. I add the code below to try and get a directory listing and the array comes up empty. Also tried a get and it did not work. However it I manually connect to the mainframes FTP site I have no problems.

 

@entries = $ftp->dir($dir1); 

    

foreach $file1 (@entries)

{

 print("$file1\n");

}

 

Help

 

Thanks

John Kennedy

  

 

-----Original Message-----
From: John.F.Kennedy [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 07, 2001 3:00 PM
To: 'Jan Matejka'
Cc: 'Perl-Win32-Users Konference (E-mail)'
Subject: RE: data stream with perl FTP

 

Still not working. I put the "." back in, but it makes no different.

 The error I'm getting is "can't call read on an undefined value in line 30.

This would be this [line $data.=$buf while $download->read($buf,1000); ].

 Also  $download is always empty probably causing this problem. Any ides

 

Thanks

John Kennedy

 

-----Original Message-----
From: John.F.Kennedy [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 07, 2001 2:22 PM
To: 'Jan Matejka'
Cc: 'Perl-Win32-Users Konference (E-mail)'
Subject: RE: data stream with perl FTP

 

It's not working here is the code I'm using.

 

Thanks

John

 

use Net::FTP;

 

print("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nThis program will attempt to pull multiple ANI files (in sequence) from the mainframes.\n");

 

print("Enter the user ID to use when connecting to the mainframes: ");  #Prompt the user for input

chop($username = <STDIN>);

 

print "Enter the password for this ID: ";  #Prompt the user for input

chop($password = <STDIN>);

 

print("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nAttempting to connect to first mainframe for file.\n");

 

 

$hostname = somehost.com';

$dir1 = "some_dir";

 

$ftp = Net::FTP->new($hostname);         # construct object

$ftp->login($username, $password);

 

$ftp->cwd("..");                   # change directory

$ftp->cwd($dir1);                   # change directory

 

print("Showing the current working directory as '$dir1'\n");

 

 

  $download=$ftp->retr($file);

  $data=$buf while $download->read($buf,1000);

  $download->close();

 

  

  $ftp->quit;

 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Jan Matejka
Sent: Wednesday, March 07, 2001 11:36 AM
To: [EMAIL PROTECTED]
Cc: Perl-Win32-Users Konference (E-mail)
Subject: RE: data stream with perl FTP

 

  use Net::FTP;

 

  $ftp=Net::FTP->new($host);

  $ftp->login($user,$pass);

 

  $download=$ftp->retr($file);
  $data.=$buf while $download->read($buf,1000);
  $download->close();

 

  # now variable $data contains $file contents

 

MaT

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of John.F.Kennedy
Sent: Wednesday, March 07, 2001 4:58 PM
To: 'perl-win32-users'
Subject: data stream with perl FTP

 Does anybody know if there is a way to manipulate the data stream using NET:: FTP, before the feed is written to a file. What I want to do is parse the date before I write it to the file.

 

Thanks

John Kennedy

 

 

 

Reply via email to