Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Perl/Moose calling writer doesnt work

by jeffenstein (Hermit)
on Mar 10, 2018 at 15:10 UTC ( [id://1210623]=note: print w/replies, xml ) Need Help??


in reply to Perl/Moose calling writer doesnt work

edit oops... I read the question wrong; the attribute is being set from outside the class, so my previous post wasn't correct.

Update: As AnomalousMonk mentions below, I should have kept the original to remind me to read carefully before hitting submit ;)

So, here's the code I originally posted, using lazy to set the attribute based on information the class learns after it's created:

has FileName => ( is => 'ro', isa => 'Str', lazy => 1, builder => '_build_filename', ); sub _build_filename { my $self = shift; # build logic here return $filename; }

Replies are listed 'Best First'.
Re^2: Perl/Moose calling writer doesnt work
by AnomalousMonk (Archbishop) on Mar 10, 2018 at 16:10 UTC

    Please see How do I change/delete my post? for site etiquette and protocol regarding removal of a post. Occasionally, even a gross misunderstanding may prove enlightening to others. (And attributing your "oops" to poor old edit, who hasn't been here in fourteen years, is not done, old man, it's just not playing the game. :)


    Give a man a fish:  <%-{-{-{-<

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (3)
As of 2024-04-25 10:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found