Perl DBI 1.50 Scalar::Util::weaken support test bug

Perl DBI 1.50 Scalar::Util::weaken support test bug

am 11.01.2006 23:22:53 von jason

------=_Part_18512_18237050.1137018173486
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

There is a line of bad code on line 279. I document the error here:
http://www.walljm.com/comments.asp?post=3D4776

Essentially,

279 Scalar::Util::weaken(my $test =3D \"foo");

the \ is negating the " and instead of a reference, its returning
something else.

Hope this helps... its cause Ikonboard.pl to break (thats how i came across=
it).

--
Jason Wall // Jason@walljm.com // www.walljm.com

------=_Part_18512_18237050.1137018173486--

Re: Perl DBI 1.50 Scalar::Util::weaken support test bug

am 12.01.2006 15:19:10 von Tim.Bunce

On Wed, Jan 11, 2006 at 04:22:53PM -0600, Jason Wall wrote:
> There is a line of bad code on line 279. I document the error here:
> http://www.walljm.com/comments.asp?post=4776
>
> Essentially,
>
> 279 Scalar::Util::weaken(my $test = \"foo");
>
> the \ is negating the " and instead of a reference, its returning
> something else.

No, it is returning a reference, but it's a reference to a constant.

That's not a problem with the perl I'm using here (5.8.6) and you're
the first to report a problem with this.

> Hope this helps... its cause Ikonboard.pl to break (thats how i came across it).

What version of perl are you using?

Was your installed DBI built *and tested via make test* for that version of perl?

Does your installed DBI work for any other script or is Ikonboard.pl
doing something unusual that triggers the problem?

Does changing the code to this fix it:

Scalar::Util::weaken( \my $test );

Thanks!

Tim.