Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH] Eliminate Scalar::Util usage from private-Error.pm

From: Petr Baudis <hidden>
Date: 2016-06-15 22:42:34

Dear diary, on Wed, Jul 26, 2006 at 03:42:44AM CEST, I got a letter
where Junio C Hamano [off-list ref] said that...
Petr Baudis [off-list ref] writes:
quoted
diff --git a/perl/private-Error.pm b/perl/private-Error.pm
index ebd0749..8fff866 100644
--- a/perl/private-Error.pm
+++ b/perl/private-Error.pm
@@ -290,6 +288,14 @@ use vars qw(@EXPORT_OK @ISA %EXPORT_TAGS
 
 @ISA = qw(Exporter);
 
+
+sub blessed {
+	my $item = shift;
+	local $@; # don't kill an outer $@
+	ref $item and eval { $item->can('can') };
+}
Hmmm.  I wonder how this relates to what Merlyn actually said?

        From: merlyn@stonehenge.com (Randal L. Schwartz)
        Subject: Re: [PATCH] Eliminate Scalar::Util usage from private-Error.pm
        Date: 10 Jul 2006 18:42:35 -0700
        Message-ID: [ref]
        Cc: Junio C Hamano [off-list ref], [off-list ref]
        To: Petr Baudis [off-list ref]

        >>>>> "Randal" == Randal L Schwartz [off-list ref] writes:
        Randal> sub blessed {
        Randal> my $item = shift;
        Randal> local $@; # don't kill an outer $@
        Randal> ref $item and eval { $item->can('can') };
        Randal> }

        Randal> Oops, lose the local $@ line.  Just found out this is a
        Randal> broken thing in current Perls.  The rest is good though.

        And thirdly, ignore what I *just* said, and concentrate on what
        I *previously* said, becaused my testing was off.

My reading is that (1) the part of the patch should read
something like this:

        sub blessed {
                my $item = shift;
                ref $item and eval { $item->can('can') };
        }
I don't know, from my late-night understanding it should have the local
line... :-)
and (2) Merlyn thinks there is a bigger problem than using Scalar::Util
which should be dealt with first.  Was the use of try{}catch{}
syntax sugar (and it is easy to leak memory) the issue?  How was
that resolved?
We never got to producing anything that could trigger the memleak, at
least I wasn't able to reproduce it based on the rather vague
description.

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
Snow falling on Perl. White noise covering line noise.
Hides all the bugs too. -- J. Putnam
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help