A
Adrien BARREAU
Hi all.
If I run that piece of code:
=====
#!/usr/bin/perl
use strict;
use warnings;
BEGIN {
$SIG{ __DIE__ } = sub { print "Defined\n" if defined $^S; print
($^S ? "True\n" : "False\n"); };
eval { die };
}
print "Done\n";
=====
It prints:
False
Done
Well, that, I understand.
If I change eval { die } to eval 'die', it prints:
Defined
True
Done
Which I don't get.
My only guess: since eval "" is described as a "little Perl program",
$^S is set to 1 because it refers to the "running" part of the eval,
after it has been successfully parsed. But, my "main" program is in
compilation time, so it seems strange.
Did I missed something about all that in the documentation?
Adrien.
If I run that piece of code:
=====
#!/usr/bin/perl
use strict;
use warnings;
BEGIN {
$SIG{ __DIE__ } = sub { print "Defined\n" if defined $^S; print
($^S ? "True\n" : "False\n"); };
eval { die };
}
print "Done\n";
=====
It prints:
False
Done
Well, that, I understand.
If I change eval { die } to eval 'die', it prints:
Defined
True
Done
Which I don't get.
My only guess: since eval "" is described as a "little Perl program",
$^S is set to 1 because it refers to the "running" part of the eval,
after it has been successfully parsed. But, my "main" program is in
compilation time, so it seems strange.
Did I missed something about all that in the documentation?
Adrien.