home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2000 May
/
Chip_2000-05_cd1.bin
/
zkuste
/
Perl
/
ActivePerl-5.6.0.613.msi
/
䆊䌷䈹䈙䏵-䞅䞆䞀㡆䞃䄦䠥
/
_a9f9457a00e4e444e4289eda891a49ed
< prev
next >
Wrap
Text File
|
2000-03-15
|
1KB
|
59 lines
package URI::ftp;
require URI::_server;
require URI::_userpass;
@ISA=qw(URI::_server URI::_userpass);
use strict;
use vars qw($whoami $fqdn);
use URI::Escape qw(uri_unescape);
sub default_port { 21 }
sub path { shift->path_query(@_) } # XXX
sub _user { shift->SUPER::user(@_); }
sub _password { shift->SUPER::password(@_); }
sub user
{
my $self = shift;
my $user = $self->_user(@_);
$user = "anonymous" unless defined $user;
$user;
}
sub password
{
my $self = shift;
my $pass = $self->_password(@_);
unless (defined $pass) {
my $user = $self->user;
if ($user eq 'anonymous' || $user eq 'ftp') {
# anonymous ftp login password
unless (defined $fqdn) {
eval {
require Net::Domain;
$fqdn = Net::Domain::hostfqdn();
};
if ($@) {
$fqdn = '';
}
}
unless (defined $whoami) {
$whoami = $ENV{USER} || $ENV{LOGNAME} || $ENV{USERNAME};
unless ($whoami) {
if ($^O eq 'MSWin32') { $whoami = Win32::LoginName() }
else {
$whoami = getlogin || getpwuid($<) || 'unknown';
}
}
}
$pass = "$whoami\@$fqdn";
}
}
$pass;
}
1;