[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Problems with Scalar::Util which break weak references in debian



> Jeremiah C. Foster wrote:
> > rjbs informed me about a problem with debian's version of
> > Scalar::Util. It does not properly implement the 'weaken'
> > subroutine. This means that a great deal of CPAN that relies on this
> > subroutine, and on weak references, fails. This also means that the
> > version of perl 5.8.8 that debian provides does not provide weak
> > references which are fairly widely used.
> 
> Do you have a test case showing weaken failing to work?

Ricardo, can you forward to me a test in which weaken fails? Or where
it does not work as expected? 
 
> I tested with some simple things and it seems to work:
> 
> joey@kodama:~>perl -le '{ my $var="set"; $ref=\$var; }; print defined $ref'
> 1
> joey@kodama:~>perl -le 'use Scalar::Util "weaken"; { my $var="set"; $ref=\$var; weaken($ref); }; print defined $ref'
> 
> joey@kodama:~>
> 
> I've also used weaken in production code, with no problems.
> 
> > Scalar::Util is provided by libfilehandle-unget-perl, although my
> > understanding is that it is in the core distribution for perl 5.10.
> 
> No, Scalar::Util is provided by perl-base; it's been included in the
> perl core for a while -- well before perl 5.10.

My understanding is it has been in perl since at least 5.8 but not as
far back as 5.6
 
> libfilehandle-unget-perl's source package contains an old copy (of version
> 1.14) in inc/, but this is not built in the binary package.
> 
> (BTW AFAIK the actual implementation of weaken is in the List::Util XS, which
> is also in perl core.)
> > I am not sure about the best way to go about fixing this.
> 
> I imagine the first thing would be to file a bug report with enough
> information for someone to reproduce your problem.

Makes sense to me.

      Jeremiah


Reply to: