Re: [PATCH] Eliminate Scalar::Util usage from private-Error.pm
- From
Petr Baudis <pasky@suse.cz>
- Date
- Jul 26, 2006, 02:15 UTC
- Message-ID
- <20060726021550.GX13776@pasky.or.cz>
- In-Reply-To
- <7vhd15cfaj.fsf@assigned-by-dhcp.cox.net>
Dear diary, on Wed, Jul 26, 2006 at 03:42:44AM CEST, I got a letter where Junio C Hamano <junkio@cox.net> said that...
Show 46 quoted lines
> Petr Baudis <pasky@suse.cz> writes:
>
> > 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: <863bd8nchg.fsf@blue.stonehenge.com>
> Cc: Junio C Hamano <junkio@cox.net>, <git@vger.kernel.org>
> To: Petr Baudis <pasky@suse.cz>
>
> >>>>> "Randal" == Randal L Schwartz <merlyn@stonehenge.com> 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