Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Test-Deep CPAN distribution.

Report information
The Basics
Id: 27699
Status: resolved
Priority: 0/
Queue: Test-Deep

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

Bug Information
Severity: Normal
Broken in: 0.096
Fixed in: (no value)



Subject: Test::Deep exports pathological blessed()
If you import all from Test::Deep, it exports its own blessed() function that conflicts with Scalar::Util. Here's the warning: dpisoni@szdpisoni-mpb15:~$ perl use Scalar::Util qw/blessed/; use Test::Deep; Prototype mismatch: sub main::blessed ($) vs none at /System/Library/Perl/5.8.6/Exporter.pm line 65. at - line 2 Workaround is to simply not import anything from Test::Deep. Regardless, this should be considered a bug. (This was demonstrated with perl v5.8.6.)
From: FDALY [...] cpan.org
Thanks for the feedback. I do not consider this a bug, annoying maybe but not a bug. Both modules have a function called blessed(). These functions are related but completely different. You, the user, have control over which (if any) gets imported into your package. This is no different to any other 2 clashing exported symbols. You can just as easily say "Workaround is to simply not import anything from Scalar::Util." Perhaps "blessed" was a bad choice - although I don't really think so and I can't think of a better one. Either way, changing anything now would break a lot of existing code for almost no benefit. Let me know if you find any other problems (I don't close everything as "NOT A BUG" :) F On Fri Jun 22 15:11:26 2007, DPISONI wrote: Show quoted text
> If you import all from Test::Deep, it exports its own blessed() > function that conflicts with > Scalar::Util. Here's the warning: > > dpisoni@szdpisoni-mpb15:~$ perl > use Scalar::Util qw/blessed/; > use Test::Deep; > Prototype mismatch: sub main::blessed ($) vs none at > /System/Library/Perl/5.8.6/Exporter.pm > line 65. > at - line 2 > > Workaround is to simply not import anything from Test::Deep. > Regardless, this should be > considered a bug. > > (This was demonstrated with perl v5.8.6.) >
CC: Fergal Daly <fergal [...] esatclear.ie>
Subject: Re: [rt.cpan.org #27699] Test::Deep exports pathological blessed()
Date: Mon, 25 Jun 2007 08:45:16 -0700
To: bug-Test-Deep [...] rt.cpan.org
From: David Alan Pisoni <david [...] ourironiclife.com>
Ahh, well if that's the case, then this is in fact a documentation "bug", rather than a code bug: the POD doesn't advertise that blessed () would be exported by default, so it was unexpected on my part. I have to say though that (at least to me) Scalar::Utils::blessed() is so oft-used (along with reftype()) that I often forget they're not part of CORE perl. I suppose it's too late the remedy that (assuming folks have written code to depend on your blessed().) So, can you add EXPORTS to your documentation? Future consumers of your module will silently thank you. :) Thanks, David On Jun 22, 2007, at 18.10 , via RT wrote: Show quoted text
> > <URL: http://rt.cpan.org/Ticket/Display.html?id=27699 > > > Thanks for the feedback. I do not consider this a bug, annoying maybe > but not a bug. Both modules have a function called blessed(). These > functions are related but completely different. You, the user, have > control over which (if any) gets imported into your package. This > is no > different to any other 2 clashing exported symbols. You can just as > easily say "Workaround is to simply not import anything from > Scalar::Util." > > Perhaps "blessed" was a bad choice - although I don't really think so > and I can't think of a better one. Either way, changing anything now > would break a lot of existing code for almost no benefit. > > Let me know if you find any other problems (I don't close > everything as > "NOT A BUG" :) > > F > > On Fri Jun 22 15:11:26 2007, DPISONI wrote:
>> If you import all from Test::Deep, it exports its own blessed() >> function that conflicts with >> Scalar::Util. Here's the warning: >> >> dpisoni@szdpisoni-mpb15:~$ perl >> use Scalar::Util qw/blessed/; >> use Test::Deep; >> Prototype mismatch: sub main::blessed ($) vs none at >> /System/Library/Perl/5.8.6/Exporter.pm >> line 65. >> at - line 2 >> >> Workaround is to simply not import anything from Test::Deep. >> Regardless, this should be >> considered a bug. >> >> (This was demonstrated with perl v5.8.6.) >>
> > >
From: FDALY [...] cpan.org
I just noticed the update on this bug about documentation. Looking around it seems that many exported functions are undocumented. It comes from me exporting all of the auto-generated function, even those that were never intended for general use. I will try get around to documenting them. On the isa() front, 0.103 is on its way through CPAN at the moment and hopefully fixes this entirely, if somewhat hackily. isa() now dispatches to UNIVERSAL::isa if it get 2 arguments and so $obj->isa($class) should work just fine.
This bug seriously impacts the combination of Moose and Test::Class::Most. See http://stackoverflow.com/questions/2836350/how- can-i-use-moose-with-testclass for details. You would probably agree, conflicting with Moose might have been a non-issue three years ago, but it is now.
Subject: Re: [rt.cpan.org #27699] Test::Deep EXPORTS not documented (was "exports pathological blessed()")
Date: Sat, 15 May 2010 00:11:28 +0100
To: bug-Test-Deep [...] rt.cpan.org
From: Fergal Daly <fergal [...] esatclear.ie>
I'm not going to stop exporting that symbol. Every test that uses it will break. use Test::Deep qw( the symbols that I want ); will prevent Test::Deep from exporting anything except your requested symbols. I will get around to documenting the exports but it's a priority, F
On Fri May 14 19:11:41 2010, fergal@esatclear.ie wrote: Show quoted text
> I'm not going to stop exporting that symbol. Every test that uses it > will break.
Since its not documented, nobody should be using it. A Google Code Search backs this up. http://www.google.com/codesearch?as_q=%22use+Test%3A%3ADeep%22+blessed&btnG=Search+Code&hl=en&as_lang=perl&as_license_restrict=i&as_license=&as_package=&as_filename=&as_case= Other common clashes include any, all and isa. I would suggest taking the opportunity to stop exporting the undocumented constructors while they are still unused. Test::Deep exports far too much by default polluting the namespace. Show quoted text
> use Test::Deep qw( the symbols that I want ); > > will prevent Test::Deep from exporting anything except your requested > symbols.
Rather than making the user turn on each individual function they want, how about grouping all the constructors into $EXPORT_TAG{constructors}. Then they can be turned off. use Test::Deep "!:constructors";
On Sun May 16 22:57:24 2010, MSCHWERN wrote: Show quoted text
> On Fri May 14 19:11:41 2010, fergal@esatclear.ie wrote:
> > I'm not going to stop exporting that symbol. Every test that uses it > > will break.
> > Since its not documented, nobody should be using it. A Google Code > Search backs this up. > http://www.google.com/codesearch?
as_q=%22use+Test%3A%3ADeep%22+blessed&btnG=Search+Code&hl=en&as_lang=perl&as_ license_restrict=i&as_license=&as_package=&as_filename=&as_case= Show quoted text
> > Other common clashes include any, all and isa. > > I would suggest taking the opportunity to stop exporting the > undocumented constructors while they are still unused. Test::Deep > exports far too much by default polluting the namespace.
I agree with Schwern here. I'd like to see 'blessed' removed as a default export.
For a while now, you can: use Test::Deep ':v1'; It's like "use Test::Deep" but without 'isa' or 'Isa' or 'blessed' -- rjbs