![]() |
|
good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
How to inject role to Caller Module?by smarthacker67 (Beadle) |
on Jun 20, 2022 at 18:08 UTC ( #11144881=perlquestion: print w/replies, xml ) | Need Help?? |
smarthacker67 has asked for the wisdom of the Perl Monks concerning the following question:
Hello Respected Monks I am seeking some help question.
I have a module that helps me write clean modules using the following `package MyApp::Moose;`. I tried searching a lot and am not sure exactly how I can inject the above role to the caller (so that it will get consumed) and the caller can have access to `check_entity` method. I refered
Note:- I cant create an object of the caller since it has some required entity (*object may not be needed to inject role I believe) But unfortunately, I couldn't able to figure out the right way, I am sure there must be a simple way to do it which I am missing out. Also want to do similar for multiple roles in the future once I develop them.
* Currently Using above in code like this.
I really appreciate any help you can provide. I was hoping I could inject it directly to the caller using metacpan.org/pod/Moose::Exporter(Moose::Exporter) but after several attempts, I was unable to accomplish The same question was Posted on StackOverflow. https://stackoverflow.com/questions/72678529/how-to-inject-role-to-caller-module/72691410(StackOverFlow)
Back to
Seekers of Perl Wisdom
|
|