Skip Menu |

This queue is for tickets about the Moose CPAN distribution.

Report information
The Basics
Id: 60013
Status: resolved
Priority: 0/
Queue: Moose

People
Owner: Nobody in particular
Requestors: BLILBURNE [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.09
Fixed in: (no value)



Subject: Moose removes "blessed" from namespace after "no Moose"
After using "no Moose;", a previously imported "use Scalar::Util qw(blessed);" is removed from the namespace. Workaround is possible by moving "use Scalar::Util..." after "no Moose". Attached test script demonstrates this problem.
Subject: moose_blessed.t
#!/usr/bin/perl use strict; use warnings; package BreakMoose; use Test::More tests => 2; use Scalar::Util qw(blessed); use Moose; my $foo = bless { }, 'BreakMoose'; ok( blessed $foo, '$foo is blessed' ); no Moose; ok( blessed $foo, '$foo is still blessed' ); 1;
On Mon Aug 02 18:14:53 2010, BLILBURNE wrote: Show quoted text
> After using "no Moose;", a previously imported "use Scalar::Util > qw(blessed);" is removed from the namespace.
Fixing this is impossible AFAIK, as it would require keeping track of every keyword successfully installed into every package for removal. And, the assumption that upon removal no one else exported the identical sub and clobbered yours. The bug would work the other way too, FYI if only Scalar::Util provided a `sub unimport {}` (which would pretty much require the same assumptions): perl -E'use Scalar::Util qw(blessed); no Scalar::Util; print blessed bless {};' Attempting to fix this isn't really a good idea either being only 1% of people will ever use `no Moose` thanks to `namespace::autoclean`. -- Evan Carroll System Lord of the Internets http://www.evancarroll.com
CC: undisclosed-recipients:;
Subject: Re: [rt.cpan.org #60013] Moose removes "blessed" from namespace after "no Moose"
Date: Wed, 06 Oct 2010 00:28:58 +0200
To: bug-Moose [...] rt.cpan.org
From: Florian Ragwitz <rafl [...] debian.org>
"Evan Carroll via RT" <bug-Moose@rt.cpan.org> writes: Show quoted text
> Queue: Moose > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=60013 > > > On Mon Aug 02 18:14:53 2010, BLILBURNE wrote:
>> After using "no Moose;", a previously imported "use Scalar::Util >> qw(blessed);" is removed from the namespace.
> > Fixing this is impossible AFAIK, as it would require keeping track of > every keyword successfully installed into every package for removal. > And, the assumption that upon removal no one else exported the > identical sub and clobbered yours. > > The bug would work the other way too, FYI if only Scalar::Util > provided a `sub unimport {}` (which would pretty much require the same > assumptions): > > perl -E'use Scalar::Util qw(blessed); no Scalar::Util; print blessed > bless {};' > > Attempting to fix this isn't really a good idea either being only 1% > of people will ever use `no Moose` thanks to `namespace::autoclean`.
Fixing this is actually not all that hard. We already do the right thing for: use Moose; use Scalar::Util 'blessed'; That not working the other way around is a bug. I'll have a go at this.
Download (untitled)
application/pgp-signature 197b

Message body not shown because it is not plain text.

This was fixed in 1.16.