Slash Boxes
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 ]

Matts (1087)

  (email not shown publicly)

I work for MessageLabs [] in Toronto, ON, Canada. I write spam filters, MTA software, high performance network software, string matching algorithms, and other cool stuff mostly in Perl and C.

Journal of Matts (1087)

Saturday June 08, 2002
04:30 AM

Footie and PPerl

[ #5502 ]

So yesterday I must have been about the only person in the UK who managed to remain all day without finding out the score (for those of you who live in a cave, England were playing Argentina - old rivals, what with the war and good old Maradona knocking us out of the world cup via a handball a few years back)...

ITV were showing the game in full at 8pm (the game was on live at 12:30, but I was at work). So I had to basically get through the day without anyone telling me the score. People on IRC were warned that I'd be miffed, and my headphones pretty much stayed on the whole day. When I got home my wife was itching to tell me about her day's chenanigans, which of *course* involved some sort of World Cup related incident in town, but I zipped her lips and told her she'd have to wait to tell me after the game.

And what a game.

England played incredibly well, looking tight and like a proper team (this is often quite unusual for our boys). Owen was ablaze in the box, causing serious concern for the Argentinian defence. And Argentina's reputation for being a bit aggressive with their tackling got the better of them, bringing down Owen in the box.

The second half was immensely stressful towards the end of the game, as Argentina piled on every ounce of attack they could muster. But our defence held tight, and we held onto our first victory over Argentina in 22 years. Awesome.

Back in perl-land, PPerl isn't looking too hot at the moment. My re-write seems to mostly work, except the ARGV magic, which looks like this:

# First populate @ARGV from data sent over the socket
# then assign magic if necessary:
if (!@ARGV) { # magic for <ARGV>
  # *ARGV = \*{ $____self };

(the commented out line was an attempt at fixing it, but it too fails the same way).

This works some of the time, but every now and then will give me:

    "readline() on closed filehandle ARGV"

(the script doing this just does "print ;", and the failing test is passed the filename on the command line (i.e. via @ARGV))

Note that this only happens when @ARGV is true (i.e. the above test is false). Which makes it even stranger. I'm not sure how the ARGV magic works internally, or why it would end up closed. Or why the exact same code would work when using Net::Server and not when writing my own daemon. Or why it would only fail sporadically.

Gah. Awful bug to debug. Hints appreciated.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • I'm probably clueless as to what your intent is, but can you just say:

    if (!@ARGV)
    unshift '-', @ARGV;

    Wouldn't that accomplish what you want?

    J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers
    • Yes and No. The bug is the case where I don't set the ARGV magic, not when I do.

      Even if I change the ARGV stuff to the above, it fails periodically.

      I'm pretty sure now that it's parent/child management. I'm not very good at all this signals stuff, so I'll have to delve into it more deeply tomorrow.