Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^6: Moose Attribute Default Dependency

by dpath2o (Acolyte)
on Nov 13, 2013 at 02:30 UTC ( [id://1062301]=note: print w/replies, xml ) Need Help??


in reply to Re^5: Moose Attribute Default Dependency
in thread Moose Attribute Default Dependency

I expect

my $self;

will 'initialise' $self to allow

default => $self->{Dbase}.'/come/on/now',

it to be used.

I now realise that this not OK and I must use builder.

Replies are listed 'Best First'.
Re^7: Moose Attribute Default Dependency
by elTriberium (Friar) on Nov 16, 2013 at 23:26 UTC

    You don't have to use builder, this also works:

    has 'x' => ( is => 'rw', isa => 'Str', default => sub { my ($self) = @_; return $self->value; }, lazy => 1, );
Re^7: Moose Attribute Default Dependency
by boftx (Deacon) on Nov 13, 2013 at 03:42 UTC

    By the way, I should have said this earlier, I strongly second chromatic's suggestion!

    The answer to the question "Can we do this?" is always an emphatic "Yes!" Just give me enough time and money.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (4)
As of 2024-03-28 17:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found