The UNIX Forums  



Go Back   The UNIX Forums > Top Forums > Shell Programming and Scripting
Home Forums Register Rules & FAQDonate 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.

Reply
 
Submit Tools Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 1 Week Ago
Registered User
 
Join Date: Apr 2008
Posts: 6
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
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.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 1 Week Ago
Moderator
 
Join Date: Sep 2002
Location: Hong Kong, China
Posts: 1,334
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
Just want to clarify: your system doesn't have Time::HiRes. Am I right?
Reply With Quote
Forum Sponsor
  #3 (permalink)  
Old 1 Week Ago
Registered User
 
Join Date: Apr 2008
Posts: 6
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
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
Reply With Quote
  #4 (permalink)  
Old 1 Week Ago
Technorati Master
 
Join Date: Mar 2005
Location: Large scale systems...
Posts: 2,320
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
Quote:
also I cant download modules from CPAN.
Is there any good reason why you should not download the modules from CPAN ?

Its not possible to write all the modules by ourselves, CPAN is there to use the modules that we need.
Reply With Quote
  #5 (permalink)  
Old 1 Week Ago
Registered User
 
Join Date: Apr 2008
Posts: 6
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
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
Reply With Quote
  #6 (permalink)  
Old 1 Week Ago
Registered User
 
Join Date: Jan 2008
Posts: 218
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
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.
Reply With Quote
  #7 (permalink)  
Old 1 Week Ago
...@...
 
Join Date: Feb 2004
Location: NM
Posts: 3,030
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
Following on KevinADC's comment -

You could write small piece of C code to do the job and `mycode args` to get a result in perl.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

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


web tracker

All times are GMT -5. The time now is 11:39 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
UNIX Forum Content Copyright ©1993-2008 SilkRoad Asia All Rights Reserved -Ad Management by RedTyger

Search Engine Optimization by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93