Skip Menu |

This queue is for tickets about the MooseX-Clone CPAN distribution.

Report information
The Basics
Id: 49866
Status: open
Priority: 0/
Queue: MooseX-Clone

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

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



Subject: Bails with undef->name when user does the retard thing with traits=>[qw( Clone )]
As described on #moose, http://scsys.co.uk:8001/34056 Can't call method "name" on an undefined value at /usr/lib64/perl5/vendor_perl/5.10.1/MooseX/Clone/Meta/Attribute/Trait/Clone.pm line 83. Although this should be carping with a message telling me I'm stupid, the code at this line is at follows: } else { croak "Cannot recursively clone a retarded object $value (" . overload::StrVal($value) . ") in " . $args{attr}->name . ". Try something better."; } However, %args is in fact empty in this case, so it resorts to undef->name, and bails with a useless error instead of a less useless error.
On Mon Sep 21 00:43:33 2009, KENTNL wrote: Show quoted text
> As described on #moose, http://scsys.co.uk:8001/34056
Mind attaching the test to this ticket? Pastes on the above site aren't permanent.
Subject: Bails with undef->name when user does the dumb thing with traits=>[qw( Clone )]
OT: The word "retard" in this usage is offensive. Please avoid it in the future. http://www.r-word.org/
Subject: Re: [rt.cpan.org #49866] Bails with undef->name when user does the dumb thing with traits=>[qw( Clone )]
Date: Wed, 6 Jul 2011 00:56:59 +0300
To: bug-MooseX-Clone [...] rt.cpan.org
From: Yuval Kogman <nuffin [...] cpan.org>
*re·tard·ed*/riˈtärdid/ Adjective: Less advanced, esp. mentally, than is usual for one's age. In this case it's referring to the implementation of the object's interface and the fact that it is less advanced in that it does not implement a "clone" method.

Additionally, "retard" existed in usage before it was applied to people: 

1. (1) retard -- (cause to move more slowly or operate at a slower rate; "This drug will retard your heart rate")
2. retard -- (be delayed)
3. check, retard, delay -- (slow the growth or development of; "The brain damage will retard the child's language development")
4. decelerate, slow, slow down, slow up, retard -- (lose velocity; move more slowly; "The car decelerated")

To deprecate a word in all contexts because somebody at some stage decided to apply it to people is a bit stupid. I appreciate the idea that r-word are trying to achieve, but imo, their methodology is backwards first. 

Incidentally, had we used "stupid" here, which, when applied to a person, is also offensive, it would have not raised an eyebrow.

After a bit of labouring, I managed to work out what I was probably doing that caused this ( and downgrading to 0.04 to test it ) , and 0.05 still fails in the same way.

0.04

ok 1 - Cloning a bad object dies
not ok 2 - does not die due to unable-to-call-name
Show quoted text
#   Failed test 'does not die due to unable-to-call-name'
#   at /tmp/mxclone.t line 49.
#                   'Can't call method "name" on an undefined value at /usr/lib64/perl5/vendor_perl/5.14.1/MooseX/Clone/Meta/Attribute/Trait/Clone.pm line 83.
# '
#           matches '(?^:Can't call method "name")'
ok 3 - retarded is not a very good diagnosis
1..3

# Looks like you failed 1 test of 3.

0.05

ok 1 - Cloning a bad object dies
not ok 2 - does not die due to unable-to-call-name
Show quoted text

#   Failed test 'does not die due to unable-to-call-name'
#   at /tmp/mxclone.t line 49.
#                   'Can't call method "name" on an undefined value at /usr/lib64/perl5/vendor_perl/5.14.1/MooseX/Clone/Meta/Attribute/Trait/Clone.pm line 102.
# '
#           matches '(?^:Can't call method "name")'
ok 3 - retarded is not a very good diagnosis
1..3
Show quoted text
# Looks like you failed 1 test of 3.
 

Subject: mxclone.t
use strict; use warnings; use 5.10.1; use Test::More; # FILENAME: mxclone.t # CREATED: 06/07/11 05:09:07 by Kent Fredric (kentnl) <kentfredric@gmail.com> # ABSTRACT: A test for MooseX::Clone failing with a useless message use Test::Fatal; # # These commented tests exhibit the underlying failure. # # use MooseX::Clone; # use MooseX::Clone::Meta::Attribute::Trait::Clone; # # unlike exception { # MooseX::Clone::Meta::Attribute::Trait::Clone->clone_object_value( undef, attr => undef, ); # }, qr/Can't call method/, 'clone object value failure'; # # unlike exception { # MooseX::Clone::Meta::Attribute::Trait::Clone->clone_value_data(bless({},'Void'), attr => undef, ); # }, qr/Can't call method/, 'clone object value failure'; # { package Cloneinator; use Moose; with qw(MooseX::Clone); has 'Bad_Attribute' => ( traits => [qw( Clone )], is => 'rw', required => 1, clone_only_objects => 0 ); __PACKAGE__->meta->make_immutable; } my $object = Cloneinator->new(Bad_Attribute => [ bless({}, 'Void')]); isnt(my $e = exception { $object->clone() }, undef, 'Cloning a bad object dies'); unlike( $e, qr/Can't call method "name"/ , 'does not die due to unable-to-call-name'); unlike( $e, qr/retarded/, 'retarded is not a very good diagnosis' ); done_testing;
On Tue Jul 05 18:31:22 2011, KENTNL wrote: Show quoted text
> Additionally, "retard" existed in usage before it was applied to > people: > > 1. (1) retard -- (cause to move more slowly or operate at a slower > rate; "This > drug will retard your heart rate") > 2. retard -- (be delayed) > 3. check, retard, delay -- (slow the growth or development of; "The > brain > damage will retard the child's language development") > 4. decelerate, slow, slow down, slow up, retard -- (lose velocity; > move more > slowly; "The car decelerated") > > To deprecate a word in all contexts because somebody at some stage > decided to > apply it to people is a bit stupid. I appreciate the idea that r-word > are > trying to achieve, but imo, their methodology is backwards first. > > Incidentally, had we used "stupid" here, which, when applied to a > person, is > also offensive, it would have not raised an eyebrow.
And this would be relevant if the context it's being used here had anything to do with being slow. You can tell the difference between "I have a friend who's gay" and "man, that movie was so gay", right? Not quite sure why it's hard to see the difference here. Words do have connotations, and those connotations can have actual meaningful effects on peoples' lives; I don't really see what the downside of changing this here would be.
On 2011-07-06 13:26:10, DOY wrote:
Show quoted text
> And this would be relevant if the context it's being used here had
> anything to do with being slow. You can tell the difference between "I
> have a friend who's gay" and "man, that movie was so gay", right?

I'd be tempted to use "gay" in its prior form in relevant context, ie:  That sunshine is so gay, Perl makes me gay, etc. But I'm probably largely arguing for the sake of arguing =).

Show quoted text
> I don't really see what the downside of changing this
> here would be.

Agreed, hence why I've put in a test for elimination of that particular word in the provided .t

Additionally, in the current form, that error message is about as useless as they come anyway.

One could even say that the error message retards the programmers ability to get anything done because it slows them down by wasting time trying to work out the meaning of the cryptic error.


Subject: Re: [rt.cpan.org #49866] Bails with undef->name when user does the retard thing with traits=>[qw( Clone )]
Date: Sat, 16 Jul 2011 17:13:56 +0300
To: bug-MooseX-Clone [...] rt.cpan.org
From: Yuval Kogman <nuffin [...] cpan.org>
I think that this week I might be able to fit in the long awaited rewrite of MX::Clone (with compat). It's fortunate that the package names are so unfortunate, because that'll make the compat layer easy ;-)