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   37 use strict;
  5         10  
  5         164  
4 5     5   24 use warnings;
  5         8  
  5         268  
5              
6             our $VERSION = '5.21';
7              
8 5     5   891 use parent qw(URI::_server URI::_userpass);
  5         616  
  5         31  
9              
10 12     12 1 32 sub default_port { 21 }
11              
12 11     11 1 33 sub path { shift->path_query(@_) } # XXX
13              
14 23     23   63 sub _user { shift->SUPER::user(@_); }
15 15     15   39 sub _password { shift->SUPER::password(@_); }
16              
17             sub user
18             {
19 23     23 0 53 my $self = shift;
20 23         53 my $user = $self->_user(@_);
21 23 100       47 $user = "anonymous" unless defined $user;
22 23         62 $user;
23             }
24              
25             sub password
26             {
27 15     15 0 23 my $self = shift;
28 15         33 my $pass = $self->_password(@_);
29 15 100       27 unless (defined $pass) {
30 6         16 my $user = $self->user;
31 6 100 66     23 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         9 $pass = 'anonymous@';
41             }
42             }
43 15         49 $pass;
44             }
45              
46             1;