We don't bite newbies here... much | |
PerlMonks |
getting automatic error checking with Win32::OLE and Mooseby glasswalk3r (Friar) |
on Jan 15, 2013 at 15:53 UTC ( [id://1013414]=perlquestion: print w/replies, xml ) | Need Help?? |
glasswalk3r has asked for the wisdom of the Perl Monks concerning the following question: UPDATED due bug found by tobyink Greetings monks, I'm trying to figure out a way to have automatic error checking when invoking methods from a Win32::OLE object, for example:
This way I will need to call x function every time after calling a Win32::OLE method. This seems to be quite boring. Instead, I would like to encapsulate the Win32::OLE object inside a Moose object and execute the error checking automatically. First thought that I had is using the Triggers in a attribute that has a reference to the Win32::OLE::Variant object, but this does not look like it will work because a trigger will be activated only when a writer method is invoked for the attribute or during the object construction. After that I considered using AROUND_modifiers in a to be defined role, doing it for every method that invokes a Win32::OLE method internally. The AROUND would look like this (I didn't check if this code would work, just an example):
But this does not seems to be lazy enough since I would need to create a new role for each different kind of Win32::OLE classes that I'm using. Do you monks have any other suggestion that could improve this laziness?
Alceu Rodrigues de Freitas Junior --------------------------------- "You have enemies? Good. That means you've stood up for something, sometime in your life." - Sir Winston Churchill
Back to
Seekers of Perl Wisdom
|
|