| 1 | package Net::uFTP; | ||||||||||||
| 2 | |||||||||||||
| 3 | 1 | ▶ | use vars qw($VERSION); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | |||||||||||||
| 5 | 1 | $VERSION = 0.161; | |||||||||||
| 6 | #-------------- | ||||||||||||
| 7 | |||||||||||||
| 8 | 1 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 9 | 1 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 10 | 1 | ▶ | use Carp; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 11 | 1 | ▶ | use UNIVERSAL::require; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 12 | 1 | ▶ | use base qw(Class::Accessor::Fast::XS); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 13 | #---------------------------------------------------------------------- | ||||||||||||
| 14 | 1 | __PACKAGE__->mk_accessors(qw(object host type user password debug port)); | |||||||||||
| 15 | #====================================================================== | ||||||||||||
| 16 | 0 | ▶ | sub new { | ||||||||||
|
Subroutine
new: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||
| 17 | 0 | my ($self, $host, %params) = (shift, shift, @_); | |||||||||||
| 18 | |||||||||||||
| 19 | 0 | $params{host} = $host; | |||||||||||
| 20 | 0 | $self = bless \%params, $self; | |||||||||||
| 21 | |||||||||||||
| 22 | # little standarization :-) | ||||||||||||
| 23 | 0 | ▶ | $self->type($self->type() or 'Net::uFTP::FTP'); | ||||||||||
|
Condition0%0/2
$self->type || 'Net::uFTP::FTP'
MC/DC0%0/1
$self->type || 'Net::uFTP::FTP'
$self->type
Truth table0%0/2
A
A= $self->type
| |||||||||||||
| 24 | 0 | ▶ | my $type = $self->type() =~ /^Net::uFTP/o ? $self->type() : 'Net::uFTP::'.$self->type(); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 25 | 0 | $type =~ s/SCP$/SFTP/; | |||||||||||
| 26 | |||||||||||||
| 27 | 0 | ▶ | $type->require or return; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 28 | 0 | $self->type($type); | |||||||||||
| 29 | |||||||||||||
| 30 | 0 | return $self; | |||||||||||
| 31 | } | ||||||||||||
| 32 | #====================================================================== | ||||||||||||
| 33 | 0 | ▶ | sub get { | ||||||||||
|
Subroutine
get: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 34 | 0 | my $self = shift; | |||||||||||
| 35 | 0 | return $self->object()->get(@_); | |||||||||||
| 36 | } | ||||||||||||
| 37 | #====================================================================== | ||||||||||||
| 38 | 0 | ▶ | sub login { | ||||||||||
|
Subroutine
login: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||
| 39 | 0 | my ($self, $user, $passwd) = @_; | |||||||||||
| 40 | |||||||||||||
| 41 | 0 | my $type = $self->type(); | |||||||||||
| 42 | 0 | $self->object($type->new($self->host, port => $self->port, user => $user, password => $passwd, debug => $self->debug)); | |||||||||||
| 43 | 0 | ▶ | return 1 if $self->object; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 44 | 0 | return; | |||||||||||
| 45 | } | ||||||||||||
| 46 | #====================================================================== | ||||||||||||
| 47 | 0 | ▶ | sub AUTOLOAD { | ||||||||||
|
Subroutine
AUTOLOAD: not called CC=3 SCAR=24.8
| |||||||||||||
| 48 | 0 | our $AUTOLOAD; | |||||||||||
| 49 | 0 | my ($method) = $AUTOLOAD =~ /::([^:]+)$/o; | |||||||||||
| 50 | |||||||||||||
| 51 | 0 | ▶ | return if $method eq 'DESTROY'; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 52 | |||||||||||||
| 53 | 0 | my $self = shift; | |||||||||||
| 54 | 0 | ▶ | croak(qq/Unsupported method "$method"/) unless $self->object()->can($method); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 55 | |||||||||||||
| 56 | 0 | return $self->object()->$method(@_); | |||||||||||
| 57 | } | ||||||||||||
| 58 | #====================================================================== | ||||||||||||
| 59 | 1 | 1; | |||||||||||
| 60 | |||||||||||||
| 61 | __END__ | ||||||||||||