Show
Ignore:
Timestamp:
03/01/09 23:44:02 (4 years ago)
Author:
miki
Message:

リファクタ用のブランチ

Location:
lang/perl/POE-Component-RemoteTail/branches
Files:
1 added
5 modified
1 copied

Legend:

Unmodified
Added
Removed
  • lang/perl/POE-Component-RemoteTail/branches/refactor2/Changes

    r17776 r30657  
    11Revision history for Perl extension POE::Component::RemoteTail 
     2 
     30.02001     2009/03/01 
     4        add some improvement about problems argued in perlmonks 
     5 
     6         * http://www.perlmonks.org/?node_id=746039 
     7 
     8        - ocrrect a mistake of PoCo::RemoteTail::CustomEngine::NetSSHPerl 
     9        - error handlings are improved slightly 
     10        - add some parameters to PoCo::RemoteTail::Job to be albe to use command-line options  
    211 
    3120.01004     2008/08/16 
  • lang/perl/POE-Component-RemoteTail/branches/refactor2/Makefile.PL

    r17776 r30657  
    88requires 'constant'; 
    99requires 'UNIVERSAL::require'; 
    10   
     10requires 'IO::Pty',  
    1111build_requires 'Test::More'; 
    1212build_requires 'YAML'; 
  • lang/perl/POE-Component-RemoteTail/branches/refactor2/lib/POE/Component/RemoteTail.pm

    r17776 r30657  
    66use POE::Wheel::Run; 
    77use POE::Component::RemoteTail::Job; 
     8use IO::Pty; 
    89use Class::Inspector; 
    910use constant DEBUG => 0; 
    1011use UNIVERSAL::require; 
    1112 
    12 our $VERSION = '0.01004'; 
     13our $VERSION = '0.02001'; 
    1314 
    1415*debug = DEBUG 
     
    9394    my $path  = $job->{path}; 
    9495    my $user  = $job->{user}; 
     96    my $ssh_options = $job->{ssh_options}; 
     97    my $add_command = $job->{add_command}; 
     98 
     99    my $command = "ssh -A"; 
     100    $command .= ' ' . $ssh_options if $ssh_options; 
     101    $command .= " $user\@$host tail -f $path"; 
     102    $command .= ' ' . $add_command if $add_command; 
    95103 
    96104    # default Program ( go on a simple unix command ) 
    97     my %program = ( Program => "ssh -A $user\@$host tail -f $path" ); 
     105    my %program = ( Program => $command ); 
    98106 
    99107    # use custom class 
     
    109117    my $wheel = POE::Wheel::Run->new( 
    110118        %program, 
     119        Conduit => 'pty-pipe', 
    111120        StdioFilter => POE::Filter::Line->new(), 
    112121        StdoutEvent => "_got_child_stdout", 
     
    139148    my $stderr = $_[ARG0]; 
    140149    debug("STDERR:$stderr"); 
     150    die("got_child_stderr: $stderr"); 
    141151} 
    142152 
     
    157167=head1 SYNOPSIS 
    158168 
     169  use POE; 
    159170  use POE::Component::RemoteTail; 
    160171   
    161   my ( $host, $path, $user, $password ) = @target_host_info; 
     172  my ( $host, $path, $user ) = @target_host_info; 
    162173  my $alias = 'Remote_Tail'; 
    163174   
     
    170181      path          => $path, 
    171182      user          => $user, 
     183      ssh_options   => $ssh_options, # see POE::Component::RemoteTail::Job 
     184      add_command   => $add_command, # see POE::Component::RemoteTail::Job 
    172185  ); 
    173186   
  • lang/perl/POE-Component-RemoteTail/branches/refactor2/lib/POE/Component/RemoteTail/CustomEngine/NetSSHPerl.pm

    r17776 r30657  
    1 use POE::Component::RemoteTail::CustomEngine::NetSSHPerl; 
     1package POE::Component::RemoteTail::CustomEngine::NetSSHPerl; 
    22 
    33use strict; 
    44use warnings; 
    55use Net::SSH::Perl; 
     6 
     7sub new { 
     8    my $class = shift; 
     9    my $self  = bless {@_}, $class; 
     10    return $self; 
     11} 
    612 
    713sub process_entry { 
     
    7581=head1 METHOD 
    7682 
     83=head2 new() 
     84 
    7785=head2 process_entry() 
    7886 
  • lang/perl/POE-Component-RemoteTail/branches/refactor2/lib/POE/Component/RemoteTail/Job.pm

    r17776 r30657  
    1919=head1 SYNOPSIS 
    2020 
     21my $job = $tailer->job( 
     22    host        => '127.0.0.1', 
     23    path        => '/home/httpd/logs/access_log', 
     24    user        => 'admin', 
     25    ssh_options => '-i ~/.ssh/identity', 
     26    add_command => '| grep hoge',  
     27); 
     28 
     29# $job would be transformed as below. 
     30# ssh -i ~/.ssh/identity -A 127.0.0.1 tail -f /home/httpd/access_log | grep hoge 
     31 
    2132=head1 DESCRIPTION 
    2233