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 8     8   873 use strict;
  8         51  
  8         258  
4 8     8   24 use warnings;
  8         9  
  8         528  
5              
6             our $VERSION = '5.35';
7              
8 8     8   29 use parent qw(URI::_server URI::_userpass);
  8         12  
  8         52  
9              
10 16     16 1 38 sub default_port { 21 }
11              
12 1     1 0 3 sub encrypt_mode { undef }
13              
14 11     11 1 29 sub path { shift->path_query(@_) } # XXX
15              
16 23     23   70 sub _user { shift->SUPER::user(@_); }
17 15     15   50 sub _password { shift->SUPER::password(@_); }
18              
19             sub user
20             {
21 23     23 0 36 my $self = shift;
22 23         51 my $user = $self->_user(@_);
23 23 100       37 $user = "anonymous" unless defined $user;
24 23         62 $user;
25             }
26              
27             sub password
28             {
29 15     15 0 21 my $self = shift;
30 15         39 my $pass = $self->_password(@_);
31 15 100       28 unless (defined $pass) {
32 6         11 my $user = $self->user;
33 6 100 66     25 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         4 $pass = 'anonymous@';
43             }
44             }
45 15         77 $pass;
46             }
47              
48             1;