File Coverage

blib/lib/URI/ftp.pm
Criterion Covered Total %
statement 24 24 100.0
branch 6 6 100.0
condition 2 3 66.6
subroutine 9 9 100.0
pod 2 4 50.0
total 43 46 93.4


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