Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

2shortplanks (968)

2shortplanks
  (email not shown publicly)
http://2shortplanks.com/
AOL IM: trelane2sp (Add Buddy, Send Message)
Yahoo! ID: trelane2sp (Add User, Send Message)

Mark Fowler has never been the same since he was elected leader of the London Perl Mongers. The strain manifests itself mainly in releasing various [cpan.org] modules [cpan.org] to CPAN, giving talks [2shortplanks.com], and use of the Trelane nick on #london.pm for endless procrastination. Doctors are still seeking a cure.
Thursday October 07, 2004
06:32 AM

Tor

[ #21233 ]
Ooops, I've not been writing in my journal again. I've been busy writing Perl code (or at least, patching Leon's code) honest guv. Oh, and trying to organise things like the London.pm social meeting tonight or the upcoming London Perl Workshop.

Today I found out the rss feed that I wrote for the infobot to work out the current time was broken. Basically, the script goes off to timeanddate.com and looks at the tables on there to work out what time it is the world (since it's easier than working it out yourself - especially when countries keep updating their laws about what time zone they're going to be in and when they're going to daylight saving.) The script as read should have been able to parse the string, but we were getting all these "Tor"s in our output.

Of course, "Tor" is Swedish for "Thu".

Yep. The webserver was looking at the accepted languages and if there was no header it was sending back a sweedish version. So what I was seeing with my browser (that was sending those headers) wasn't the same as what LWP was getting. It never used to do this - to be honest, we English speakers of the world are too lazy, we just assume if we don't specify these kinds of things we're going to get English back.

An additon of:

# all those need to have the english headers now
# or time and date will send us the times in sweedish.  bork bork bork
WORLD->header("Accept-Language" => "en");
US->header("Accept-Language" => "en");
EUROPE->header("Accept-Language" => "en");

and everything works again.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • I think it's important to know that "Tor" is also the Swedish name of the thunder god "Thor".

    Ok, maybe not that important, and you're not that likely to get "I am Thor, god of thunder(tm)" in response to the question "What time is it?". If you do, though, that's the least of your problems.