LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise
User Name
Password
Linux - Enterprise This forum is for all items relating to using Linux in the Enterprise.

Notices

Closed Thread
 
Search this Thread
Old 01-20-2007, 09:18 AM   #1
Brad.Scalio@noaa.gov
Member
 
Registered: Jan 2007
Location: Washington DC
Distribution: RedHat & spins ... Fedora, CentOS, Mandriva
Posts: 82

Rep: Reputation: 15
RHEL4u2 perl localtime() call issues (perl & glibc)


Greetings
(long time lurker, 1st time poster)


Recently installed RHEL4u2 (2.6.9-37) onto all servers and nodes at a remote site -- the problem is when called localtime() within Time::Local for perl 5.8.5

The RHEL4u2 came with some perl updates, now inside a lot of scripts we had calls to localtime() from within the Time::Local module, then inside the same script we define TZ environment variable and call localtime() again, but it doesn't recognize the new TZ...this worked fine in RHEL3 and works fine on my machine (Fedora Core 6)... so it looks like something in the RHEL4u2 perl-*5.8.5*rpm caused this.

My question now is, does anyone know if RHEL4u2 for whatever reason has maybe localtime() linked to glibc's localtime_r() or vice versa...the only possible answer I can come up with is that tzset[] is being called before each localtime() call inside the scripts thus no matter what TZ is set to inside the script, the call before the localtime() call supersedes it....

I can't find anything on google, couldn't find anything in the forum, tried our RedHat support folks, but their answer is always to install the new rpm or update, but on a nation-wide system which requires a national baseline to interconnect we just can't do that on a whim, it takes an act of G-d to get the baseline changed.

Any help appreciate, and apologies if this is the wrong thread, or already answered 10^100 times
 
Old 01-21-2007, 09:24 AM   #2
Brad.Scalio@noaa.gov
Member
 
Registered: Jan 2007
Location: Washington DC
Distribution: RedHat & spins ... Fedora, CentOS, Mandriva
Posts: 82

Original Poster
Rep: Reputation: 15
just in case anyone references this, the solution:

perl5-8-5 changed the calls to tzset glibc to be from perl localtime() to localtime_r() :: so localtime() no longer calls tzset but rather, localtime_r() calls tzset in perl no for RHEL distr --- you can call tzset before the localtime calls or just edit the scripts you use to have localtime_r() called simple enough


set tz=CST+06CDT
tzset();
my $now = localtime;
print "Calling 'localtime' function without an TZ:\n";
print "\tThe time/date is: $now.\n";

or

call localtime_r() instead of localtime()

gotta admit I still use and love VI so I just did:

:g/localtime/s//localtime_r/gc

thanks again guys/gals - have a good one
 
Old 01-21-2007, 12:32 PM   #3
unSpawn
Moderator
 
Registered: May 2001
Posts: 26,999
Blog Entries: 54

Rep: Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745
Thanks for posting your solution, it's appreciated.
 
Old 01-23-2007, 09:27 PM   #4
Capt_Caveman
Senior Member
 
Registered: Mar 2003
Distribution: Fedora
Posts: 3,658

Rep: Reputation: 57
In the future, please only post a single thread for your topic rather than posting in multiple forums. Thanks. Closing thread. Please direct replies to:

http://www.linuxquestions.org/questi...d.php?t=521188
 
  


Closed Thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
perl subroutine call shifty_eyes Programming 2 10-01-2005 08:43 PM
call perl cgi script from php j-ray Programming 2 01-14-2005 08:23 AM
How to Call a C program from Perl CGI Script anoop_cn Programming 1 05-11-2004 04:37 PM
how to call c programm from perl scripts akaash Programming 4 03-18-2004 07:41 PM
perl(Cwd) perl(File::Basename) perl(File::Copy) perl(strict)....What are those? Baldorg Linux - Software 1 11-09-2003 08:09 PM


All times are GMT -5. The time now is 06:13 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration