Acme-RemoteINC

 view release on metacpan or  search on metacpan

lib/Acme/RemoteINC.pm  view on Meta::CPAN

use strict;
use warnings;
use Net::FTP;
use File::Temp;
our $VERSION = 0.15;

sub new { 
    my($class, %args) = @_;
    my $self = {};
    bless $self, $class;
    foreach my $k ( qw(ftp host user password perl_root) ) 
      { $self->{$k} = $args{$k} if $args{$k} }
    unless( $self->{ftp} ) {
        my $ftp = new Net::FTP($self->{host}) or return;
        $ftp->login( $self->{user} => $self->{password} ) or return;
        $self->{ftp} = $ftp;
    }
    # register ourself in @INC.
    push @INC, $self;
    return $self;
}

sub Acme::RemoteINC::INC {
    my($self, $filename) = @_;
    my($tmpFH, $tmpname) = File::Temp::tmpnam();

lib/Acme/RemoteINC.pm  view on Meta::CPAN

=head1 SYNOPSIS

 use strict;
 use warnings;
    
 BEGIN {
    require Acme::RemoteINC;
    my $rinc = new Acme::RemoteINC(
        host      => 'ftp.esoteric-perl.com',
        user      => 'anonymous',
        password  => 'pwd@myhost.com',
        perl_root => '/usr/lib/perl5/site_perl/5.8.1'
    );
 }

 use DBI;  # load local DBI by default
 use DBD::Esoterica;  # if cannot load locally, will try the FTP method
 ...etc.

=head1 METHODS

=head2 B<new>

    my $rinc = new Acme::RemoteINC(
      host      => 'ftp.myserver.com',
      user      => 'anonymous',
      password  => 'pwd@myhost.com',
      perl_root => [ '/usr/lib/perl5/site_perl', /usr/lib_site_perl/5.8.1 ]
    );
    
    or 
    my $ftp = new Net::FTP;
    ...
    my $rinc = Acme::RemoteINC->new(ftp => $ftp);
    
 
The new method creates a new Acme::RemoteINC object. Three paired hash 
entry named arguments are required for new:

host => $hostname

The name of the ftp server.
      
user => $loginname

Login user name.
        
password => $pwd

Login password.
    
  Two paired hash entry named arguments are optional arguments for new:

perl_root => $wdir

Perl module directory name relative to the FTP service root.
Defaults to the default ftp service's base working directory.
Alternative: may be a reference to an array of such module directories.
        
ftp => $ftp



( run in 0.445 second using v1.01-cache-2.11-cpan-49f99fa48dc )