develooper Front page | perl.perl5.porters | Postings from June 2008

Re: Why $@ makes me cry (was Re: Generic system() replacements)

Thread Previous | Thread Next
From:
David Nicol
Date:
June 25, 2008 08:32
Subject:
Re: Why $@ makes me cry (was Re: Generic system() replacements)
Message ID:
934f64a20806250832v5cc05803v91fae03f12cb17e6@mail.gmail.com
1$ perl -e 'sub DESTROY { die "B" } eval { bless {}; die "A"}; print
"E: $@" if $@'
E: A at -e line 1.

2$ perl -e 'sub DESTROY { die "B" } eval { my $x=bless {}; die "A"};
print "E: $@" if $@'
E: A at -e line 1.
        (in cleanup) B at -e line 1.

3$ perl -e 'sub DESTROY { eval {} } eval { my $x=bless {}; die "A"};
print "E: $@" if $@'

4$ perl -e 'sub DESTROY { eval {}; die "B" } eval { my $x=bless {};
die "A"}; print "E: $@" if $@'
E:      (in cleanup) B at -e line 1.

5$ perl -e 'sub DESTROY { eval {die "C"}; die "B" } eval { my $x=bless
{}; die "A"}; print "E: $@" if $@'
E: C at -e line 1.
        (in cleanup) B at -e line 1.

<confession type="ignorance"> I was not aware of die in DESTROY
appending until today. </confession>

The problem under discussion is not defeating this thing that does
work well, but defeating the
have-it-now of clearing $@ within DESTROY.  Not replacing it but clearing it.

1: apparently has optimized out the creation of blessed {}
2: works as intended
3: clears $@ within DESTROY, demonstrating aspect under discussion
4: uses aspect to fully replace $@
5: sets $@ to something within DESTROY, and then demonstrates DESTROY-appending.


I think Mark Mielke is proposing that the desired state is to make 3
work like 1 and make 4 work like 2.

In the @@ proposal, does $@ become a joined @@, or does $@ retain
current behavior exactly?
Does @@ get cleared or truncated automatically ever and if so when?

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About