Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^5: Moose: Accessing subroutines in packages used by Moose class

by Arunbear (Prior)
on Apr 18, 2016 at 16:05 UTC ( [id://1160821]=note: print w/replies, xml ) Need Help??


in reply to Re^4: Moose: Accessing subroutines in packages used by Moose class
in thread Moose: Accessing subroutines in packages used by Moose class

Yes, it applies to your situation. I couldn't install X11::GUITest, so I created a dummy package to illustrate the technique.

The package 'Bogus' in my example is analogous to X11::GUITest in your example i.e. it contains the subs that you want to wrap.

So translating to your example it would look like:
package X11_GUITest_Wrapper; use Moose; use MooseX::NonMoose; extends 'X11::GUITest'; around [qw( SendKeys FindWindowLike ClickWindow SetEventSendDelay )] = +> sub { my $orig = shift; my $self = shift; $orig->(@_); }; 1;
Then to use it:
package FFMech; $ENV{'DISPLAY'} = ':0.0'; use Moose; use Modern::Perl; use MooseX::NonMoose; extends 'WWW::Mechanize::Firefox'; has 'x11_guitest_wrapper' => ( is => 'bare', default => sub { X11_GUITest_Wrapper->new }, handles => [qw( SendKeys FindWindowLike ClickWindow SetEventSendDe +lay )], ); # ... 1;

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2024-04-18 20:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found