I developed some script with Perl on NT using Active Perl 5.6, and now copying the scripts over to a Solaris box, also running Active Perl 5.6 and it wouldn't work!
The situation is as follows-
-mainProcessor.pl 'require' subProcessor.pl
-mainProcessor.pl calls parse() in subProcessor.pl
-parse in subProcessor.pl calls ftpGet() in subProcessor.pl
-I have the following code within mainProcessor.pl (no subroutines), and also in subProcessor.pl (in the 'main' area. outside the subroutines) (do I need to do this anyway?)
-in ftpGet($), I have the following
-Runnning everything on NT is perfect, running it on Solaris results in the following error-
Can't call method "login" on an undefined value at subProcessor.pl line 440.
Anyone has any idea why it would not run??
The situation is as follows-
Code:
perl mainProcessor.pl myConfig.cfg
-mainProcessor.pl 'require' subProcessor.pl
-mainProcessor.pl calls parse() in subProcessor.pl
-parse in subProcessor.pl calls ftpGet() in subProcessor.pl
-I have the following code within mainProcessor.pl (no subroutines), and also in subProcessor.pl (in the 'main' area. outside the subroutines) (do I need to do this anyway?)
Code:
$configFileName = $ARGV[0];
#Only read a file that exists and is a text file
if (! (-e $configFileName) or !(-T $configFileName))
{
die "could not find config file ". $configFileName;
}
else
{
open CONFIGFILE,$configFileName;
while(<CONFIGFILE>)
{
if (/^(\w+)=(.*)$/)
{
$vars{$1} = $2;
}
}
close CONFIGFILE;
}
-in ftpGet($), I have the following
Code:
my $host = $vars{"host"};
my $userID = $vars{"userID"};
my $passwd = $vars{"passwd"};
my $noOfRetry = $vars{"retry"};
my $retryCounter = $vars{"retry"};
my $notDone=1;
while ($retryCounter>0 and $notDone==1)
{
#The 1st,2nd, etc. time FTP is happening
my $times= 1 - ($retryCounter - $noOfRetry);
logInfo("Open connection to " .$host);
$ftp = Net::FTP->new($host, debug=>1,Passive=>1)
or die "couldn't connect to host"
$ftp->login($userID,$passwd) or die "couldn't log in"
#etc etc etc
-Runnning everything on NT is perfect, running it on Solaris results in the following error-
Can't call method "login" on an undefined value at subProcessor.pl line 440.
Anyone has any idea why it would not run??