in reply to "panic: top_env": Is this error resulting from a Perl bug?

But what's with the "panic: top_env" message? And why doesn't it print out a diagnostic too?
This panic: message doesn't actually seem to be implemented as a warn or die; it just does the equivalent of print STDERR "panic: top_env\n"; and then bails out of the parser with an error. Perhaps this is also a bug :)

You can still get the diagnostics by piping STDERR to the splain utility:

$ perl -e'qr/(?{rand < 5})/' 2>&1 |splain Warning: Use of "rand" without parentheses is ambiguous at (re_eval 1) + line 1 (# 1) (S ambiguous) You wrote a unary operator followed by something tha +t looks like a binary operator that could also have been interpreted + as a term or unary operator. For instance, if you know that the rand function has a default argument of 1.0, and you write rand + 5; you may THINK you wrote the same thing as rand() + 5; but in actual fact, you got rand(+5); So put in parentheses to say what you really mean. panic: top_env (#2) (P) The compiler attempted to do a goto, or something weird like t +hat.

Replies are listed 'Best First'.
Re^2: "panic: top_env": Is this error resulting from a Perl bug?
by hv (Prior) on Aug 15, 2004 at 19:39 UTC

    Usually when perl panics, it lacks confidence in the integrity of its internal state and therefore tries to require as little as possible of itself to get the error message out.

    For example, things like "panic: out of memory" would be little use if they went through a path that tried to allocate memory.

    Hugo