uFTP.pm

filter: Statementstmt 48.8% 21 / 43 Branchbran 0.0% 0 / 10 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 60.0% 6 / 10 Podpod 100% 3 / 3 totaltotal 43.4% 30 / 69 CC 7 SCAR 21.4
CC
7
Cov
38%
new
20.0
AUTOLOAD
12.0
login
6.0
CRAP 8.5
« uFTP/FTP.pm ↑ Summary uFTP/SFTP.pm »
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'
l!l
00
MC/DC0%0/1
$self->type || 'Net::uFTP::FTP'
$self->type
Truth table0%0/2
A
A= $self->type
Aresult
11
00
24 0 ▶ my $type = $self->type() =~ /^Net::uFTP/o ? $self->type() : 'Net::uFTP::'.$self->type();
Branch: 1 branch
BranchTrueFalseTotal
$self->type =~ /^Net::uFTP/o ? : 0 0 0
25 0 $type =~ s/SCP$/SFTP/;
26
27 0 ▶ $type->require or return;
Branch: 1 branch
BranchTrueFalseTotal
$type->require or return 0 0 0
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
BranchTrueFalseTotal
if $self->object 0 0 0
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
BranchTrueFalseTotal
if $method eq "DESTROY" 0 0 0
52  
53 0 my $self = shift;
54 0 ▶ croak(qq/Unsupported method "$method"/) unless $self->object()->can($method);
Branch: 1 branch
BranchTrueFalseTotal
unless $self->object->can($method) 0 0 0
55
56 0 return $self->object()->$method(@_);
57 }
58 #======================================================================
59 1 1;
60  
61 __END__
« uFTP/FTP.pm ↑ Summary uFTP/SFTP.pm »