Objectwize Monks-
I'm trying to learn the musty innards of POE::Component::RemoteTail, and have successfully run a modified version example program listed in the documentation.
use strict;
use warnings;
use Data::Dumper;
use POE; # This should be added to the docs...
use POE::Component::RemoteTail;
my ( $host, $path, $user ) =
(qw(myhost.domain.com /home/mylogin/.profile mylogin));
my $alias = 'Remote_Tail';
# spawn component
my $tailer = POE::Component::RemoteTail->spawn( alias=>$alias );
# create job
my $job = $tailer->job(
host=>$host,
path=>$path,
user=>$user,
);
# prepare the postback subroutine at main POE session
POE::Session->create(
inline_states=>{
_start=>sub {
my ( $kernel, $session ) = @_[ KERNEL, SESSION ];
# create postback
my $postback = $session->postback("MyPostback");
# post to execute
$kernel->post( $alias,
"start_tail"=>{ job=>$job,
postback=>$postback }
);
},
# return to here
MyPostback=>sub {
my ( $kernel, $session, $data ) =
@_[ KERNEL, SESSION, ARG1 ];
print STDERR "DATA DUMP:\n", Dumper($data), "\n";
},
},
);
POE::Kernel->run();
Now, I'm trying to follow the docs to run the (slightly modified) example script (see readmore below) to use the NetSSHPerl custom engine with this module, that is described in
POE::Component::RemoteTail::Engine::NetSSHPerl, and I keep getting the error:
Can't locate object method "new" via package "POE::Component::RemoteTail::CustomEngine::NetSSHPerl" at lib/POE/Component/Remotetail.pm line 102.
I'm suspecting that the object stuff isn't setup correctly in the RemoteTail/CustomEngine/NetSSHPerl.pm file, but I don't know enough to fix it.
use strict;
use warnings;
use POE;
use POE::Component::Remotetail;
my ( $host, $path, $user ) =
(qw(myhost.domain.com /home/mylogin/.profile mylogin));
my $tailer = POE::Component::RemoteTail->spawn();
my $job = $tailer->job(
host => $host,
path => $path,
user => $user,
process_class => "POE::Component::RemoteTail::CustomEngine::NetS
+SHPerl"
);
POE::Session->create(
inline_states => {
_start => sub {
my $kernel = $_[KERNEL];
$kernel->post($tailer->session_id(), "start_tail" => {jo
+b => $job});
$kernel->delay_add("stop_job", 100);
},
stop_job => sub {
my $kernel = $_[KERNEL];
$kernel->post($tailer->session_id(), "stop_tail" => {job
+ => $job});
}
}
);
POE::Kernel->run();
Any help is very much appreciated!
Thanks
-Craig