RemoteTail/Engine/NetSSHPerl.pm untested

filter: Statementstmt 0.0% 0 / 39 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 52 CC 3 SCAR 16.7
CC
3
Cov
0%
process_entry
12.0
new
2.0
BEGIN
2.0
CRAP 5.3
1 use POE::Component::RemoteTail::Engine::NetSSHPerl;
2  
3 use strict;
4 use warnings;
5 use Net::SSH::Perl;
6 use POE::Component::IKC::ClientLite;
7  
8 sub new {
9 my $class = shift;
10 my %args = @_;
11  
12 return bless {%args}, $class;
13 }
14  
15 sub process_entry {
16 my $self = shift;
17 my $arg = shift;
18  
19 my $client_name = "Client$$";
20 my $remote = create_ikc_client(
21 port => $arg->{port},
22 name => $client_name,
23 timeout => 5
24 );
25 die $POE::Component::IKC::ClientLite::error unless $remote;
26  
27 my $host = $arg->{host};
28 my $path = $arg->{path};
29 my $user = $arg->{user};
30 my $password = $arg->{password};
31 my $cmd = "tail -f $path";
32  
33 my $ssh = Net::SSH::Perl->new( $host, protocol => "2,1" );
34 $ssh->login($user);
35 $ssh->register_handler(
36 "stdout",
37 sub {
38 my ( $channel, $buffer ) = @_;
39 my $ret =
40 $remote->post_respond( 'tailer/ikc_logger',
41 [ $host, $buffer->bytes ] );
42 unless ($ret) { exit; }
43 }
44 );
45 my ( $stdout, $stderr, $exit ) = $ssh->cmd($cmd);
46 }
47  
48 1;
49  
50 __END__