Running this script in perl gives me an error.
The script:
@arrFilesToFtp =
('/tmp/xpp_proc/fullpub/170/afm/1234/2005_11_16_pid-28678/2005_11_16_170_afm_1234_fullpub_pid-28678.xml','/tmp/xpp_proc/fullpub/170/afm/1234/2005_11_16_pid-28678/2005_11_16_170_afm_1234_fullpub_pid-28678_xpppdfcontrol.xml');
print ">>> docbase_host -> $hshEmbFtp{'docbase_host'}\n";
print ">>> process_dir -> $hshProcess{'process_dir'}\n";
print ">>> files ->" . join("\n", @arrFilesToFtp) . "\n";
# &FtpEmbPut( $hshEmbFtp{'docbase_host'}, $hshProcess{'process_dir'},
@arrFilesToFtp );
if ( ! &FtpEmbPut( $hshEmbFtp{'docbase_host'},
$hshProcess{'process_dir'}, @arrFilesToFtp ) ) {
&LogEmbErrorMsg( "Print Request Encountered Errors ftping file(s)-
exiting with errors" );
exit 1;
}
else {
&LogEmbMessage( "Success sending ftp files for processing" );
}
}
error on screen:
__MESSAGE__: ~~[ok] - Creating sp02co:/tmp/xpp_proc/fullpub/170/afm
__MESSAGE__: ~~[ok] - Creating sp02co:/tmp/xpp_proc/fullpub/170/afm/1234
__MESSAGE__: ~~[ok] - Creating
sp02co:/tmp/xpp_proc/fullpub/170/afm/1234/2005_11_16_pid-14147
objFtp->put(/tmp/xpp_proc/fullpub/170/afm/1234/2005_11_16_pid-14147/020-AFM1234-TITLEPAGE.PDF,/tmp/xpp_proc/fullpub/170/afm/1234/2005_11_16_pid-14147/020-AFM1234-TITLEPAGE.PDF)
input must be 8 bytes long at /usr/local/lib/perl5/site_perl/5.8.5
/sun4-solaris/Crypt/Blowfish.pm line 56.
but if i run this script:
my $strFTPhost;
$strFTPhost = 'sp02co';
$hshProcess = '/tmp/xpp_proc/fullpub/170/afm/1234/2005_11_16_pid-15905';
@arrFilesToFtp
=('/tmp/xpp_proc/fullpub/170/afm/1234/2005_11_16_pid-28678/2005_11_16_170_afm_1234_fullpub_pid-28678.xml','/tmp/xpp_proc/fullpub/170/afm/1234/2005_11_16_pid-28678/2005_11_16_170_afm_1234_fullpub_pid-28678_xpppdfcontrol.xml');
&FtpEmbPut( $strFTPhost, $hshProcess, @arrFilesToFtp );
run without error!
the output screen :
__MESSAGE__: ~~[ok] - Creating
sp02co:/tmp/xpp_proc/fullpub/170/afm/1234/2005_11_16_pid-15905
objFtp->put(/tmp/xpp_proc/fullpub/170/afm/1234/2005_11_16_pid-28678/2005_11_16_170_afm_1234_fullpub_pid-28678.xml,/tmp/xpp_proc/fullpub/170/afm/1234/2005_11_16_pid-15905/2005_11_16_170_afm_1234_fullpub_pid-28678.xml)
__MESSAGE__: FTP'ing file
-->/tmp/xpp_proc/fullpub/170/afm/1234/2005_11_16_pid-28678/2005_11_16_170_afm_1234_fullpub_pid-28678.xml<--
objFtp->put(/tmp/xpp_proc/fullpub/170/afm/1234/2005_11_16_pid-28678/2005_11_16_170_afm_1234_fullpub_pid-28678_xpppdfcontrol.xml,/tmp/xpp_proc/fullpub/170/afm/1234/2005_11_16_pid-15905/2005_11_16_170_afm_1234_fullpub_pid-28678_xpppdfcontrol.xml)
__MESSAGE__: FTP'ing file
-->/tmp/xpp_proc/fullpub/170/afm/1234/2005_11_16_pid-28678/2005_11_16_170_afm_1234_fullpub_pid-28678_xpppdfcontrol.xml<--
the function FtpEmbPut:
sub FtpEmbPut {
my ( $strHost, $strPutDir, @arrFiles ) = @_;
my ( $ending_value1, $objFtp, $RemoteDir, @RemoteDirAll, $RemoteDirAll,
$ending_value, $RemoteDirExplode, $counter, @arrFileName, $RemoteDirFile,
@LaststrFileName, $LaststrFileName );
# log in
$objFtp = Net::SFTP->new($strHost, user=>$username,
password=>$password, ssh_args => [ debug => '1', protocol => '2', ciphers
=> 'cbc' ]) or die "FTP ERROR - Can't connect $strHost \n";
$RemoteDir = $strPutDir;
@RemoteDirAll = split(/\//, $RemoteDir);
$ending_value = scalar(@RemoteDirAll);
$RemoteDirExplode = '/'.$RemoteDirAll[1];
for($counter=2 ; $counter <= $ending_value ; $counter++)
{
if ($objFtp->do_realpath($RemoteDirExplode) eq "")
{
my $a = Net::SFTP::Attributes->new;
$objFtp->do_mkdir($RemoteDirExplode, $a);
&LogEmbMessage( "~~[ok] - Creating $strHost:$RemoteDirExplode" );
}
$RemoteDirExplode = $RemoteDirExplode.'/'.$RemoteDirAll[$counter];
}
# change to put directory
$objFtp->do_open($RemoteDir) or die "Permission Denied to access
directory $RemoteDirExplode \n";
# send each file
@arrFileName = @arrFiles;
foreach my $strFileName ( @arrFileName ) {
$RemoteDirFile = $RemoteDir . "/" . basename($strFileName);
print "objFtp->put($strFileName,$RemoteDirFile) \n";
$objFtp->put($strFileName,$RemoteDirFile);# or print("FTP ERROR -
Permission Denied to put file $strFileName \n");
&LogEmbMessage( "FTP'ing file -->$strFileName<--");
}
exit;
}
What is this "input must be 8 bytes long at" means????
All the crypt modules i tried fails in the put part.
Regards,
Diego
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>