![]() |
|
good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Intercept all object method calls with Mooseby elTriberium (Friar) |
on Jun 30, 2012 at 00:12 UTC ( #979192=perlquestion: print w/replies, xml ) | Need Help?? |
elTriberium has asked for the wisdom of the Perl Monks concerning the following question: Is the following possible with Moose? I have a class which has an object of another class as an attribute:
Inside this DEF class there are multiple methods which are called from ABC. They throw exceptions on errors (die). However, in this special case of class ABC I don't want the script to die, I want it to continue. At the same time I don't want to put an "eval" around each method call of "db_accessor". I already tried to use the "around" modifier of Moose, but that seems to only work for the constructor, not for the method calls on "db_accessor". I tried it like this:
However, this doesn't work. An access in this form still causes the script to die: $self->db_accessor->methodA(); Any idea how to solve this with Moose? Thanks in advance!
Back to
Seekers of Perl Wisdom
|
|