Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^3: Using ArrayRef data members in Moose

by Anonymous Monk
on Feb 18, 2011 at 17:49 UTC ( [id://888964]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Using ArrayRef data members in Moose
in thread Using ArrayRef data members in Moose

I know this is OLD! But i want to post this example, that works
use MooseX::Declare; ... ... ... has 'error_log' => ( is => 'rw', isa => 'ArrayRef', default => sub { [] } ); ... ... ... method register_error { shift; my $s_message = shift; return unless defined $s_message; $self->error_log->push ($s_message); return $self->error_log->length; }
self->error_log->push does not work until i assign a "default" for the array.

Replies are listed 'Best First'.
Re^4: Using ArrayRef data members in Moose
by stvn (Monsignor) on Feb 19, 2011 at 21:23 UTC
    self->error_log->push does not work until i assign a "default" for the array.

    Actually it won't work then either until you add a use Moose::Autobox as well.

    -stvn

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://888964]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2024-03-29 08:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found