Apache/2.4.7 (Ubuntu) Linux sman1baleendah 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) safemode : OFF MySQL: ON | Perl: ON | cURL: OFF | WGet: ON > / usr / share / perl / 5.18.2 / CPAN / FTP / | server ip : 104.21.89.46 your ip : 172.69.130.116 H O M E |
Filename | /usr/share/perl/5.18.2/CPAN/FTP/netrc.pm |
Size | 1.53 kb |
Permission | rw-r--r-- |
Owner | root : root |
Create time | 27-Apr-2025 10:10 |
Last modified | 21-Nov-2018 01:11 |
Last accessed | 07-Jul-2025 02:25 |
Actions | edit | rename | delete | download (gzip) |
View | text | code | image |
package CPAN::FTP::netrc;
use strict;
$CPAN::FTP::netrc::VERSION = $CPAN::FTP::netrc::VERSION = "1.01";
# package CPAN::FTP::netrc;
sub new {
my($class) = @_;
my $file = File::Spec->catfile($ENV{HOME},".netrc");
my($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
$atime,$mtime,$ctime,$blksize,$blocks)
= stat($file);
$mode ||= 0;
my $protected = 0;
my($fh,@machines,$hasdefault);
$hasdefault = 0;
$fh = FileHandle->new or die "Could not create a filehandle";
if($fh->open($file)) {
$protected = ($mode & 077) == 0;
local($/) = "";
NETRC: while (<$fh>) {
my(@tokens) = split " ", $_;
TOKEN: while (@tokens) {
my($t) = shift @tokens;
if ($t eq "default") {
$hasdefault++;
last NETRC;
}
last TOKEN if $t eq "macdef";
if ($t eq "machine") {
push @machines, shift @tokens;
}
}
}
} else {
$file = $hasdefault = $protected = "";
}
bless {
'mach' => [@machines],
'netrc' => $file,
'hasdefault' => $hasdefault,
'protected' => $protected,
}, $class;
}
# CPAN::FTP::netrc::hasdefault;
sub hasdefault { shift->{'hasdefault'} }
sub netrc { shift->{'netrc'} }
sub protected { shift->{'protected'} }
sub contains {
my($self,$mach) = @_;
for ( @{$self->{'mach'}} ) {
return 1 if $_ eq $mach;
}
return 0;
}
1;
use strict;
$CPAN::FTP::netrc::VERSION = $CPAN::FTP::netrc::VERSION = "1.01";
# package CPAN::FTP::netrc;
sub new {
my($class) = @_;
my $file = File::Spec->catfile($ENV{HOME},".netrc");
my($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
$atime,$mtime,$ctime,$blksize,$blocks)
= stat($file);
$mode ||= 0;
my $protected = 0;
my($fh,@machines,$hasdefault);
$hasdefault = 0;
$fh = FileHandle->new or die "Could not create a filehandle";
if($fh->open($file)) {
$protected = ($mode & 077) == 0;
local($/) = "";
NETRC: while (<$fh>) {
my(@tokens) = split " ", $_;
TOKEN: while (@tokens) {
my($t) = shift @tokens;
if ($t eq "default") {
$hasdefault++;
last NETRC;
}
last TOKEN if $t eq "macdef";
if ($t eq "machine") {
push @machines, shift @tokens;
}
}
}
} else {
$file = $hasdefault = $protected = "";
}
bless {
'mach' => [@machines],
'netrc' => $file,
'hasdefault' => $hasdefault,
'protected' => $protected,
}, $class;
}
# CPAN::FTP::netrc::hasdefault;
sub hasdefault { shift->{'hasdefault'} }
sub netrc { shift->{'netrc'} }
sub protected { shift->{'protected'} }
sub contains {
my($self,$mach) = @_;
for ( @{$self->{'mach'}} ) {
return 1 if $_ eq $mach;
}
return 0;
}
1;