Mail Archives: cygwin/2002/02/03/16:29:39
On Sun, Feb 03, 2002 at 10:03:36PM +0100, Gerrit P. Haase wrote:
>Am 2 Feb 2002 um 17:58 hat Rhet Turnbull geschrieben:
>
>>Gerrit P. Haase wrote:
>>> Why? Where is docu about this?
>>
>>The perl documentation for $^S in the perlvar manpage states:
>>
>>$^S Current state of the interpreter. Undefined if
>> parsing of the current module/eval is not finished
>> (may happen in $SIG{__DIE__} and $SIG{__WARN__}
>> handlers). True if inside an eval(), otherwise
>> false.
>>
>>The "True if inside an eval(), otherwise false" is what I was getting at. I
>
>Previous mail:
>
>>>>There seems to be a bug in Cygwin's perl (5.6.1). The
>>>>following code:
>>>>
>>>>perl -e 'print $^S || 0;eval {print $^S || 0}; print
>>>>$^S || 0;'
>>>>
>>>>should produce '010'
>
>>ran into this since I was writing a custom SIG{__DIE__} handler (which needs
>>to know if you're inside an eval where die is an exception catching
>>mechanism or in normal code where die means to exit with error.) The bug is
>>that after executing an eval(), $^S stays true even though it should be
>>false outside the scope of the eval.
>
>Hmmm, I'm still confused a little. Isn't '010' as TRUE as '011'?
There are three numbers here '0', '1', '1'. The third number should be '0'.
Maybe this would help:
perl -e 'print $^S || 0, "\n";eval {print $^S || 0, "\n"}; print $^S || 0, "\n";'
This should print:
0
1
0
Instead, it prints:
0
1
1
This indicates, to me, that perl is not resetting the "I'm in an eval", probably
when all of the statements are on the same line, or something.
cgf
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -