The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


The 50 most popular UNIX and Linux searches.
Google Search Cloud for The UNIX and Linux Forums
421 service not available, remote server has closed connection ^m automate ftp autosys awk trim bash eval bash for loop boot: cannot open kernel/sparcv9/unix command copy/move folder in unix couldn't set locale correctly curses.h cut command in unix daemon process find grep find mtime find null character in a unix file grep multiple lines grep or grep recursive hp-ux ifconfig inaddr_any inappropriate ioctl for device lynx javascript mailx attachment mget mtime perl array length ping port remove first character from string in k shell replace space by comma , perl script scp recursive segmentation fault(coredump) sftp script snoop unix stale nfs file handle syn_sent tar exclude tar extract to folder test: argument expected unix unix .profile unix forum unix forums unix internals unix interview questions unix mtime unix simulator unix.com vi substitute while loop within while loop shell script

Thread: Perl problem
View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 05-09-2008
meevagh meevagh is offline
Registered User
 

Join Date: Apr 2008
Posts: 6
Perl problem

I have been recently given a PERL script to develop, but the main problem is that the perl version that I have to use is old, also I cant download modules from CPAN.

Perl version 5.0005

I didnt realise this untill I had the script ready to be tested, so there are a few modules that I have used which are not in the perl version.

So I was wondering if anyone could help with this section of code below.
As in does anyone know how to format it so it will work with th eold version of perl or even know what module to use form the old perl version, which will do the same job I am looking to do.

Any help would be much appriciated.



use Time::HiRes qw( usleep gettimeofday tv_interval );


my $Success = 0;
my $elapsed;
my $start;
#if a failure has occurred

if($Success == 1)
{
# Set Time Interval
my $oneMinute = 60_000_000; # 1 minute
my $numberMinutes = 30; # 30 minutes - CONNECTION TIME - Can be changed
my $loopTime = $oneMinute * $numberMinutes;

#Get start time
$start = [gettimeofday];
while ($elapsed < $loopTime && $Success == 1)
{
connect("","");
$elapsed = tv_interval ($start, [gettimeofday]); #Calc elapsed time
}
}

Last edited by meevagh; 05-09-2008 at 03:03 AM.
Reply With Quote
Forum Sponsor