File Coverage

blib/lib/URI/ftp.pm
Criterion Covered Total %
statement 25 25 100.0
branch 6 6 100.0
condition 2 3 66.6
subroutine 10 10 100.0
pod 2 5 40.0
total 45 49 91.8


line stmt bran cond sub pod time code
1             package URI::ftp;
2              
3 7     7   901 use strict;
  7         20  
  7         317  
4 7     7   31 use warnings;
  7         12  
  7         627  
5              
6             our $VERSION = '5.34';
7              
8 7     7   39 use parent qw(URI::_server URI::_userpass);
  7         10  
  7         63  
9              
10 13     13 1 31 sub default_port { 21 }
11              
12 1     1 0 9 sub encrypt_mode { undef }
13              
14 11     11 1 33 sub path { shift->path_query(@_) } # XXX
15              
16 23     23   79 sub _user { shift->SUPER::user(@_); }
17 15     15   55 sub _password { shift->SUPER::password(@_); }
18              
19             sub user
20             {
21 23     23 0 39 my $self = shift;
22 23         67 my $user = $self->_user(@_);
23 23 100       51 $user = "anonymous" unless defined $user;
24 23         77 $user;
25             }
26              
27             sub password
28             {
29 15     15 0 28 my $self = shift;
30 15         41 my $pass = $self->_password(@_);
31 15 100       35 unless (defined $pass) {
32 6         15 my $user = $self->user;
33 6 100 66     36 if ($user eq 'anonymous' || $user eq 'ftp') {
34             # anonymous ftp login password
35             # If there is no ftp anonymous password specified
36             # then we'll just use 'anonymous@'
37             # We don't try to send the read e-mail address because:
38             # - We want to remain anonymous
39             # - We want to stop SPAM
40             # - We don't want to let ftp sites to discriminate by the user,
41             # host, country or ftp client being used.
42 3         5 $pass = 'anonymous@';
43             }
44             }
45 15         80 $pass;
46             }
47              
48             1;