in reply to syntax error - perl-5.8 only

I've seen some weird syntax error-ish bugs around subs that are prototyped to take a sub-ref as an argument, which in recent perls lets you supply what looks like a block as their argument, just like your run_main presumably is. I *thought* that that was fixed in 5.8.*, but maybe it was still present in some early 5.8 releases.

The fix in my case was to make the code block an explicit sub-ref, thus ...

run_main sub { ... };

Replies are listed 'Best First'.
Re^2: syntax error - perl-5.8 only
by syphilis (Archbishop) on Oct 20, 2010 at 06:12 UTC
    I've seen some weird syntax error-ish bugs around subs that are prototyped to take a sub-ref as an argument

    Yes, that seems to be the trouble here.

    The problem is with the run_main prototype of (;&)
    If I change that to simply (&) all seems well on 5.8, except that run_main then needs to be called with at least one argument.
    That is, with a prototype specification of (;&) we can simply do run_main; on perl-5.10 and 5.12, but with a prototype specification of (&) on my perl-5.8.0, we're not allowed to do simply run_main. Instead we have to do run_main sub {} which looks very much like what you were suggesting. But that only works on my perl-5.8.0 if I also change the prototype from (;&) to (&)
    That's the best I've yet been able to come up with.

    This may well have been fixed in later versions of perl-5.8. I haven't checked.

    Sorry it took so long to reply - I was unable to access perlmonks last night (though access to every other site was fine).

    Cheers,
    Rob