Skip Menu |

This queue is for tickets about the MooX-ClassAttribute CPAN distribution.

Report information
The Basics
Id: 87638
Status: resolved
Priority: 0/
Queue: MooX-ClassAttribute

People
Owner: perl [...] toby.ink
Requestors: rob [...] exitexchange.com
Cc:
AdminCc:

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



Subject: Default handling breaks with the string "5..10"
Date: Mon, 5 Aug 2013 18:37:27 -0700
To: bug-MooX-ClassAttribute [...] rt.cpan.org
From: Rob Bloodgood <rob [...] exitexchange.com>
I'm using WWW::Mechanize::Sleepy, which optionally takes a parameter of the form "1..3" to delay for a random number of seconds between the first and second value. I tried using MooX::CA with this: class_has sleepiness => (is => 'ro', default => '5..10'); But that dies with: Can't use string ("5..10") as a subroutine ref while "strict refs" in use at /usr/local/share/perl/5.14.2/Method/Generate/ClassAccessor.pm line 34. The same thing happens if I set the attribute is => 'rw'. If I use is => 'lazy', it doesn't throw the error.
Hmmm... I wrote this module before Moo accepted default values like this - they always needed to be wrapped in a sub like: default => sub { "1..3" } IIRC this was changed in Moo 1.002000. MooX::ClassAttributes needs an update to support this syntax.
Subject: Re: [rt.cpan.org #87638] Default handling breaks with the string "5..10"
Date: Tue, 6 Aug 2013 14:09:13 -0700
To: bug-MooX-ClassAttribute [...] rt.cpan.org
From: Rob Bloodgood <rob [...] exitexchange.com>
Well, I'm blushing just a little bit, because it never occurred to me to just use the "old" syntax and put a sub{} in... :) But from what I can see of the code, the necessary update should be very minor. Thanks for the quick reply! On Tue, Aug 6, 2013 at 12:18 AM, Toby Inkster via RT < bug-MooX-ClassAttribute@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=87638 > > > Hmmm... I wrote this module before Moo accepted default values like this - > they always needed to be wrapped in a sub like: > > default => sub { "1..3" } > > IIRC this was changed in Moo 1.002000. MooX::ClassAttributes needs an > update to support this syntax. >
Should be fixed in 0.008.