Do you know where your variables are? | |
PerlMonks |
Moose object constructionby saintex (Scribe) |
on Feb 09, 2011 at 15:44 UTC ( [id://887227]=perlquestion: print w/replies, xml ) | Need Help?? |
saintex has asked for the wisdom of the Perl Monks concerning the following question:
Hello Monks, I would like to set the accessors values of my class using an XML file. I would like to build my class using a constructor that read an XML file and set the values. Also, outside the constructor that values must be immutable. So I have:
But in this way, I have this error:
That is beacause the BUILD method (constructor) tryed to modify an accesor method. So I tried with: But without success:
(I don't want to use a builder method for each accessor, beacause I would like read the XML file only one time). So my question is: how can I define an accessor value inside a constructor without that error? Thank you in advance for your answers.
Back to
Seekers of Perl Wisdom
|
|