Skip Menu |

This queue is for tickets about the Class-Std CPAN distribution.

Report information
The Basics
Id: 27758
Status: resolved
Priority: 0/
Queue: Class-Std

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

Bug Information
Severity: Normal
Broken in:
  • 0.0.2
  • 0.0.4
  • v0.0.7
  • v0.0.8
Fixed in: (no value)



Subject: Test::MockObject compatibility
Causes Test::MockObject to gripe: # Called UNIVERSAL::can() as a function, not a method at .../Class/Std.pm line 563 # at.../UNIVERSAL/can.pm line 71 which becomes fatal if you're using Test::No Warnings. You had fixed this with a patch right before that line: BEGIN { warnings->unimport( 'UNIVERSAL::can' ) if $warnings::Bits{ 'UNIVERSAL::can' }; } and I wondered if this was going to make it to CPAN any time soon.
On Tue Jun 26 15:46:49 2007, PJS wrote: Show quoted text
> Causes Test::MockObject to gripe: > > # Called UNIVERSAL::can() as a function, not a method at > .../Class/Std.pm line 563 > # at.../UNIVERSAL/can.pm line 71 > > which becomes fatal if you're using Test::No Warnings. > > You had fixed this with a patch right before that line: > > BEGIN { warnings->unimport( 'UNIVERSAL::can' ) > if $warnings::Bits{ 'UNIVERSAL::can' }; > } > > and I wondered if this was going to make it to CPAN any time soon.
Can you try this with version 0.0.9 and let me know if its was resolved with rt 30833 fix w/ UNIVERSAL::can ? Thanks!
Show quoted text
> Can you try this with version 0.0.9 and let me know if its was > resolved with rt 30833 fix w/ > UNIVERSAL::can ? > > Thanks!
I'm pretty sure 0.0.9's UNIVERSAL::can fix addresses this, please reopen with details if this is in actuality not fixed in 0.0.9's thanks!
CC: jdhedden [...] cpan.org
Subject: Re: [rt.cpan.org #27758] Test::MockObject compatibility
Date: Wed, 26 Mar 2008 10:02:34 -0700
To: bug-Class-Std [...] rt.cpan.org
From: Peter Scott <Peter [...] PSDT.com>
At 07:59 PM 3/25/2008, Daniel Muey via RT wrote: Show quoted text
><URL: http://rt.cpan.org/Ticket/Display.html?id=27758 > > >On Tue Jun 26 15:46:49 2007, PJS wrote:
> > Causes Test::MockObject to gripe: > > > > # Called UNIVERSAL::can() as a function, not a method at > > .../Class/Std.pm line 563 > > # at.../UNIVERSAL/can.pm line 71 > > > > which becomes fatal if you're using Test::No Warnings. > > > > You had fixed this with a patch right before that line: > > > > BEGIN { warnings->unimport( 'UNIVERSAL::can' ) > > if $warnings::Bits{ 'UNIVERSAL::can' }; > > } > > > > and I wondered if this was going to make it to CPAN any time soon.
> >Can you try this with version 0.0.9 and let me know if its was >resolved with rt 30833 fix w/ >UNIVERSAL::can ? > >Thanks!
Doesn't appear fixed, I'm afraid. Will reopen ticket. -- Peter Scott Pacific Systems Design Technologies http://www.perldebugged.com/ http://www.perlmedic.com/
From: dmuey [...] cpan.org
Show quoted text
> >Can you try this with version 0.0.9 and let me know if its was > >resolved with rt 30833 fix w/ > >UNIVERSAL::can ? > > > >Thanks!
> > Doesn't appear fixed, I'm afraid. Will reopen ticket.
Thanks! Can someone send me an example of how to reproduce it? I ask because it appears to work ok but I'm probably just not doing it right :) multivac:~ dmuey$ perl -le 'use Test::More "no_plan";use Test::MockObject;my $mock=Test::MockObject->new();$mock->set_true("foo");ok($mock->foo());' ok 1 1..1 multivac:~ dmuey$ perl -le 'use Class::Std;use Test::More "no_plan";use Test::MockObject;my $mock=Test::MockObject->new();$mock->set_true("foo");ok($mock->foo());' ok 1 1..1 multivac:~ dmuey$
From: pjs [...] cpan.org
This is as short as I can get it: $ cat t/dummy.t #!/usr/local/bin/perl use strict; use warnings; use Test::More tests => 1; use Test::MockObject; use Class::Std; use DBD::Mock; $ t/dummy.t 1..1 Called UNIVERSAL::can() as a function, not a method at /usr/local/lib/perl5/site_perl/5.10.0/Class/Std.pm line 564 Called UNIVERSAL::can() as a function, not a method at /usr/local/lib/perl5/site_perl/5.10.0/Class/Std.pm line 564 Called UNIVERSAL::can() as a function, not a method at /usr/local/lib/perl5/site_perl/5.10.0/Class/Std.pm line 564 Called UNIVERSAL::can() as a function, not a method at /usr/local/lib/perl5/site_perl/5.10.0/Class/Std.pm line 564 Called UNIVERSAL::can() as a function, not a method at /usr/local/lib/perl5/site_perl/5.10.0/Class/Std.pm line 564 # No tests run! __END__ I don't know why DBD::Mock is required there. I pruned down an enormous test case to get this far. However, if I restore the patch mentioned earlier: BEGIN { warnings->unimport( 'UNIVERSAL::can' ) if $warnings::Bits{ 'UNIVERSAL::can' }; } then the warnings cease.
yeah, trying to guess and call it as a method is problematic... Fixed: multivac:class-std.git-repos dmuey$ git commit -m "Silenced 'Called UNIVERSAL::can() as a function, not a method' see case rt 27758" Created commit 9111e46: Silenced 'Called UNIVERSAL::can() as a function, not a method' see case rt 27758 1 files changed, 1 insertions(+), 0 deletions(-) multivac:class-std.git-repos dmuey$ Pushed: refs/heads/master: d6059652243e46b00319e2c3aa218e9c3dbff918 -> 9111e46a443cf4c985f79bc3051b9a8ea615b6f4 Should be in the release after 0.0.9, thanks!