Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^3: Moose 'clone' Constructor

by Arunbear (Prior)
on Jul 04, 2018 at 11:52 UTC ( [id://1217878]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Moose 'clone' Constructor
in thread Moose 'clone' Constructor

%params are the same kind of data as were passed to the constructor when $existing_object was created (but now you have a chance to override those if needed).

Replies are listed 'Best First'.
Re^4: Moose 'clone' Constructor
by kcott (Archbishop) on Jul 04, 2018 at 12:07 UTC

    OK, thanks. I may have been thinking along the lines of:

    has x => (..., default => 'abc'); has y => (..., default => sub { [qw{a b c}] });

    where that second line can't be written as:

    has y => (..., default => [qw{a b c}]);

    But, of course, in the constructor you use the values as is (without needing a coderef):

    ...->new(x => 'def', y => [qw{d e f}]);

    — Ken

Log In?
Username:
Password:

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

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

    No recent polls found