![]() |
|
|||||||
| Home | Forums | Register | Rules & FAQ | Donate | Members List | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
![]() |
|
|
Submit Tools | Thread Tools | Search this Thread | Display Modes |
|
|||
|
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 : 1 Week Ago at 05:03 AM. |
| Forum Sponsor |
|
|
|
|||
|
Just want to clarify: your system doesn't have Time::HiRes. Am I right?
|
| Forum Sponsor |
|
|
|
|||
|
yes thats correct.
when I try running script, i get a reply(now this is not 100% correct) can't locate Time::HiRes in perl/bin..................... I was told that this error is because I dont have the module Time::HiRes, and they I was told I couldnt download it either, so I have to try and find another way |
|
|||
|
Quote:
Its not possible to write all the modules by ourselves, CPAN is there to use the modules that we need. |
|
|||
|
The main reason basically is that where the perl is installed we have no access to it, and we would need higher authority to access it, which our team lead doesnt want to have to go and ask about.
If it is going to take a mountain of code to work, dont worry about it. I just thought that surely there must have been some module in the origianl perl version which allowed you to create some kind of code like im trying to achieve |
|
|||
|
if that vesion of perl has the "lib" pragma you can use modules by including them in @INC via "lib". See your perl documentation for "lib" and how to use it, but with such an old version of perl you will most likely run into other problems. Time::HiRes hooks into systems C time functions. You can read the documetation and look at the Time::HiRes source code to get ideas.
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Having a problem with a FTP Script using perl | scottzx7rr | Shell Programming and Scripting | 6 | 12-19-2007 04:26 PM |
| perl problem - another 'die' issue. | mjays | Shell Programming and Scripting | 4 | 08-15-2007 07:36 AM |
| PERL script problem | caddyjoe77 | Shell Programming and Scripting | 5 | 07-06-2007 01:29 PM |
| Problem with cat with PERL Substitute | jingi1234 | UNIX for Advanced & Expert Users | 2 | 03-23-2007 02:11 AM |
| PERL function problem | avadhani | Shell Programming and Scripting | 2 | 06-15-2005 03:18 AM |