kdjantzen has asked for the wisdom of the Perl Monks concerning the following question:
has re =>(is => 'rw', isa =>'RegexpRef', default => '')
In BUILD I specified$self->re(qr/^[0-9]+$/); (gave a contraint error; OK, no reference)
Then I tried
my $rx = qr/^[0-9]+$/; $self->re(\$rx); # or $self->re(\qr/^[0-9]+$/);
Both also resulted in a constraint error.
How should I use RegexpRef?
Thanks for your help.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Moose RegexpRef
by tobyink (Canon) on Dec 14, 2014 at 21:17 UTC | |
|
Re: Moose RegexpRef
by Athanasius (Archbishop) on Dec 15, 2014 at 09:51 UTC | |
by kdjantzen (Acolyte) on Dec 16, 2014 at 09:29 UTC |