Re: Test::More behavior issue with Devel::Cover + patch

2005-11-04 Thread Eirik Berg Hanssen
Pete Krawczyk <[EMAIL PROTECTED]> writes: > Does anyone have a better way of checking whether an object is blessed > that's backportable through core? I recently used UNIVERSAL::isa($ref, 'UNIVERSAL') for this purpose. It was good enough for me, but I have not considered how generic it may be

Re: Test::More behavior issue with Devel::Cover + patch

2005-11-04 Thread chromatic
On Fri, 2005-11-04 at 22:53 +0100, A. Pagaltzis wrote: > b) Who cares? We just want to know whether calling ->isa() is >safe, and UNIVERSAL::can answers that handily. But it's *wrong* and you oughtn't ever use it where someone else might see it and think that it's okay, because it's *wrong* a

Re: Test::More behavior issue with Devel::Cover + patch

2005-11-04 Thread A. Pagaltzis
* Ricardo SIGNES <[EMAIL PROTECTED]> [2005-11-03 19:20]: > * Pete Krawczyk <[EMAIL PROTECTED]> [2005-11-03T12:46:48] > > > > The solution I see is to make sure the object can() isa(), > > thus avoiding the die in the process: > > > > It was using ->isa instead of UNIVERSAL::isa because isa might

Re: Test::More behavior issue with Devel::Cover + patch

2005-11-04 Thread chromatic
On Fri, 2005-11-04 at 21:49 +0100, Tels wrote: > Not sure if a ref() check will suffice, but you could also always call: > > $object->can(); > > if it is not defined, it would use UNIVERSAL::can, otherwise the overriden > one. Or do I miss something? There are two caveats. First, if $ob

Re: Test::More behavior issue with Devel::Cover + patch

2005-11-04 Thread Pete Krawczyk
Subject: Re: Test::More behavior issue with Devel::Cover + patch From: Tels <[EMAIL PROTECTED]> Date: Fri, 4 Nov 2005 21:49:49 +0100 }Not sure if a ref() check will suffice, but you could also always call: } } $object->can(); } }if it is not defined, it would use UNIVE

Re: Test::More behavior issue with Devel::Cover + patch

2005-11-04 Thread Pete Krawczyk
Subject: Re: Test::More behavior issue with Devel::Cover + patch From: chromatic <[EMAIL PROTECTED]> Date: Fri, 04 Nov 2005 12:59:14 -0800 }First, if $object is a class name, it may succeed. If $object is a class name in this case, the !ref($object) in the code will catch it and guide i

Re: Test::More behavior issue with Devel::Cover + patch

2005-11-04 Thread Tels
-BEGIN PGP SIGNED MESSAGE- Moin, On Friday 04 November 2005 21:39, Pete Krawczyk wrote: > Subject: Re: Test::More behavior issue with Devel::Cover + patch > From: Ricardo SIGNES <[EMAIL PROTECTED]> > Date: Thu, 3 Nov 2005 13:14:34 -0500 > > }It was using ->isa i

Re: Test::More behavior issue with Devel::Cover + patch

2005-11-04 Thread Pete Krawczyk
Subject: Re: Test::More behavior issue with Devel::Cover + patch From: Ricardo SIGNES <[EMAIL PROTECTED]> Date: Thu, 3 Nov 2005 13:14:34 -0500 }It was using ->isa instead of UNIVERSAL::isa because isa might be }overridden. Surely the same could apply to ->can. I've been think

Re: Test::More behavior issue with Devel::Cover + patch

2005-11-03 Thread Pete Krawczyk
Subject: Re: Test::More behavior issue with Devel::Cover + patch From: Ricardo SIGNES <[EMAIL PROTECTED]> Date: Thu, 3 Nov 2005 13:14:34 -0500 }* Pete Krawczyk <[EMAIL PROTECTED]> [2005-11-03T12:46:48] }> }> The solution I see is to make sure the object can() isa(), thus avoid

Re: Test::More behavior issue with Devel::Cover + patch

2005-11-03 Thread Ricardo SIGNES
* Pete Krawczyk <[EMAIL PROTECTED]> [2005-11-03T12:46:48] > > The solution I see is to make sure the object can() isa(), thus avoiding > the die in the process: > It was using ->isa instead of UNIVERSAL::isa because isa might be overridden. Surely the same could apply to ->can. -- rjbs pgp

Test::More behavior issue with Devel::Cover + patch

2005-11-03 Thread Pete Krawczyk
First of all, I have Test::More 0.62 installed and Devel::Cover 0.55 under Perl 5.8.2. I also have a simple test script: $ cat test.pl #!/usr/bin/perl use warnings; use strict; use Test::More tests => 1; $a = {}; isa_ok($a,'HASH'); ...which works well under prove: $ prove test.pl testok