diff options
author | Steve Hay <steve.m.hay@googlemail.com> | 2014-05-30 18:12:54 +0100 |
---|---|---|
committer | Steve Hay <steve.m.hay@googlemail.com> | 2014-05-30 18:12:54 +0100 |
commit | 380d2378095be7a903c92a869fb3de3d949c6747 (patch) | |
tree | e2c13e1adf857de55783e9ff6a06f1f08901c71c | |
parent | 227e1608e1664869201394249ea079fd0d3d4db2 (diff) | |
download | perl-libnet-380d2378095be7a903c92a869fb3de3d949c6747.tar.gz |
Convert tabs to spaces
-rw-r--r-- | Config.eg | 62 | ||||
-rwxr-xr-x | Configure | 56 | ||||
-rw-r--r-- | Net/Config.pm | 8 | ||||
-rw-r--r-- | Net/SMTP.pm | 22 | ||||
-rw-r--r-- | Net/Time.pm | 6 | ||||
-rw-r--r-- | README | 12 | ||||
-rw-r--r-- | t/config.t | 44 | ||||
-rw-r--r-- | t/datasend.t | 6 | ||||
-rw-r--r-- | t/ftp.t | 8 | ||||
-rw-r--r-- | t/hostname.t | 6 | ||||
-rw-r--r-- | t/libnet_t.pl | 42 | ||||
-rw-r--r-- | t/netrc.t | 100 | ||||
-rw-r--r-- | t/nntp.t | 8 | ||||
-rw-r--r-- | t/require.t | 6 | ||||
-rw-r--r-- | t/smtp.t | 8 | ||||
-rw-r--r-- | t/time.t | 82 |
16 files changed, 238 insertions, 238 deletions
@@ -13,37 +13,37 @@ use strict; # Below this line is auto-generated, *ANY* changes will be lost %NetConfig = ( - # the followinf parameters are all lists of hosts for the - # respective protocols. - nntp_hosts => [], - snpp_hosts => [], - pop3_hosts => [], - smtp_hosts => [], - ph_hosts => [], - daytime_hosts => [], - time_hosts => [], - - # your internet domain - inet_domain => undef, - - # If you have an ftp proxy firewall (not an http firewall) - # then set this to the name of the firewall - ftp_firewall => undef, - - # set if all connections done via the firewall should use - # passive data connections - ftp_ext_passive => 0, - - # set if all connections not done via the firewall should use - # passive data connections - ftp_int_passive => 0, - - # If set the make test will attempt to connect to the hosts above - test_hosts => 0, - - # Used during Configure (which you are not using) to do - # DNS lookups to ensure hosts exist - test_exist => 0, + # the followinf parameters are all lists of hosts for the + # respective protocols. + nntp_hosts => [], + snpp_hosts => [], + pop3_hosts => [], + smtp_hosts => [], + ph_hosts => [], + daytime_hosts => [], + time_hosts => [], + + # your internet domain + inet_domain => undef, + + # If you have an ftp proxy firewall (not an http firewall) + # then set this to the name of the firewall + ftp_firewall => undef, + + # set if all connections done via the firewall should use + # passive data connections + ftp_ext_passive => 0, + + # set if all connections not done via the firewall should use + # passive data connections + ftp_int_passive => 0, + + # If set the make test will attempt to connect to the hosts above + test_hosts => 0, + + # Used during Configure (which you are not using) to do + # DNS lookups to ensure hosts exist + test_exist => 0, ); 1; @@ -114,10 +114,10 @@ sub get_hostname my $ans = Prompt($prompt,$def); $host = ($ans =~ /(\S*)/)[0]; last - if(!length($host) || valid_host($host)); + if(!length($host) || valid_host($host)); $def ="" - if $def eq $host; + if $def eq $host; print <<"EDQ"; @@ -129,8 +129,8 @@ EDQ } length $host - ? $host - : undef; + ? $host + : undef; } ## @@ -221,7 +221,7 @@ sub default_hostname if(defined($host) && valid_host($host)) { return $host - unless wantarray; + unless wantarray; push(@host,$host); } } @@ -236,7 +236,7 @@ sub default_hostname getopts('do:'); $libnet_cfg = "libnet.cfg" - unless(defined($libnet_cfg = $opt_o)); + unless(defined($libnet_cfg = $opt_o)); my %oldcfg = (); @@ -268,7 +268,7 @@ Do you want to modify/update your configuration (y|n) ? EDQ $opt_d = 1 - unless get_bool($msg,0); + unless get_bool($msg,0); } #--------------------------------------------------------------------------- @@ -313,7 +313,7 @@ EDQ $msg = 'Enter a list of available NNTP hosts :'; $def = $oldcfg{'nntp_hosts'} || - [ default_hostname($ENV{NNTPSERVER},$ENV{NEWSHOST},'news') ]; + [ default_hostname($ENV{NNTPSERVER},$ENV{NEWSHOST},'news') ]; $cfg{'nntp_hosts'} = get_host_list($msg,$def); @@ -322,7 +322,7 @@ $cfg{'nntp_hosts'} = get_host_list($msg,$def); $msg = 'Enter a list of available SMTP hosts :'; $def = $oldcfg{'smtp_hosts'} || - [ default_hostname(split(/:/,$ENV{SMTPHOSTS} || ""), 'mailhost') ]; + [ default_hostname(split(/:/,$ENV{SMTPHOSTS} || ""), 'mailhost') ]; $cfg{'smtp_hosts'} = get_host_list($msg,$def); @@ -347,7 +347,7 @@ $cfg{'snpp_hosts'} = get_host_list($msg,$def); $msg = 'Enter a list of available PH Hosts :' ; $def = $oldcfg{'ph_hosts'} || - [ default_hostname('dirserv') ]; + [ default_hostname('dirserv') ]; $cfg{'ph_hosts'} = get_host_list($msg,$def); @@ -456,7 +456,7 @@ if(ref($oldcfg{'local_netmask'})) { $def = $oldcfg{'local_netmask'}; print "Your current netmasks are :\n\n\t", - join("\n\t",@{$def}),"\n\n"; + join("\n\t",@{$def}),"\n\n"; } print " @@ -481,9 +481,9 @@ current list and an empty line to continue with Configure. ###EDQ ### ###$def = $cfg{'socks_hosts'} || -### [ default_hostname($ENV{SOCKS5_SERVER}, -### $ENV{SOCKS_SERVER}, -### $ENV{SOCKS4_SERVER}) ]; +### [ default_hostname($ENV{SOCKS5_SERVER}, +### $ENV{SOCKS_SERVER}, +### $ENV{SOCKS4_SERVER}) ]; ### ###$cfg{'socks_hosts'} = get_host_list($msg,$def); @@ -553,7 +553,7 @@ What host can I use : EDQ $cfg{'ftp_testhost'} = get_hostname($msg,$oldcfg{'ftp_testhost'}) - if $cfg{'test_hosts'}; + if $cfg{'test_hosts'}; print "\n"; @@ -561,7 +561,7 @@ print "\n"; #--------------------------------------------------------------------------- my $fh = IO::File->new($libnet_cfg, "w") or - die "Cannot create `$libnet_cfg': $!"; + die "Cannot create `$libnet_cfg': $!"; print "Writing $libnet_cfg\n"; @@ -571,22 +571,22 @@ my $key; foreach $key (keys %cfg) { my $val = $cfg{$key}; if(!defined($val)) { - $val = "undef"; + $val = "undef"; } elsif(ref($val)) { - $val = '[' . join(",", - map { - my $v = "undef"; - if(defined $_) { - ($v = $_) =~ s/'/\'/sog; - $v = "'" . $v . "'"; - } - $v; - } @$val ) . ']'; + $val = '[' . join(",", + map { + my $v = "undef"; + if(defined $_) { + ($v = $_) =~ s/'/\'/sog; + $v = "'" . $v . "'"; + } + $v; + } @$val ) . ']'; } else { - $val =~ s/'/\'/sog; - $val = "'" . $val . "'" if $val =~ /\D/; + $val =~ s/'/\'/sog; + $val = "'" . $val . "'" if $val =~ /\D/; } print $fh "\t'",$key,"' => ",$val,",\n"; } diff --git a/Net/Config.pm b/Net/Config.pm index ba16332..f9d04e1 100644 --- a/Net/Config.pm +++ b/Net/Config.pm @@ -13,7 +13,7 @@ use strict; @EXPORT = qw(%NetConfig); @ISA = qw(Net::LocalCfg Exporter); -$VERSION = "1.13"; +$VERSION = "1.14"; eval { local $SIG{__DIE__}; require Net::LocalCfg }; @@ -49,9 +49,9 @@ my %nc = ( ftp_ext_passive => \$InternetConfig{"646F676F\xA5UsePassiveMode"} || 0, ftp_int_passive => \$InternetConfig{"646F676F\xA5UsePassiveMode"} || 0, socks_hosts => - \$InternetConfig{ kICUseSocks() } ? [ \$InternetConfig{ kICSocksHost() } ] : [], + \$InternetConfig{ kICUseSocks() } ? [ \$InternetConfig{ kICSocksHost() } ] : [], ftp_firewall => - \$InternetConfig{ kICUseFTPProxy() } ? [ \$InternetConfig{ kICFTPProxyHost() } ] : [], + \$InternetConfig{ kICUseFTPProxy() } ? [ \$InternetConfig{ kICFTPProxyHost() } ] : [], ); \@NetConfig{keys %nc} = values %nc; } @@ -141,7 +141,7 @@ For example # .libnetrc { nntp_hosts => [ "my_preferred_host" ], - ph_hosts => [ "my_ph_server" ], + ph_hosts => [ "my_ph_server" ], } __END__ diff --git a/Net/SMTP.pm b/Net/SMTP.pm index 705b5c5..3d193a4 100644 --- a/Net/SMTP.pm +++ b/Net/SMTP.pm @@ -16,7 +16,7 @@ use IO::Socket; use Net::Cmd; use Net::Config; -$VERSION = "2.33"; +$VERSION = "2.34"; @ISA = qw(Net::Cmd IO::Socket::INET); @@ -642,24 +642,24 @@ Example: $smtp = Net::SMTP->new('mailhost', - Hello => 'my.mail.domain', - Timeout => 30, + Hello => 'my.mail.domain', + Timeout => 30, Debug => 1, - ); + ); # the same $smtp = Net::SMTP->new( - Host => 'mailhost', - Hello => 'my.mail.domain', - Timeout => 30, + Host => 'mailhost', + Hello => 'my.mail.domain', + Timeout => 30, Debug => 1, - ); + ); # Connect to the default server from Net::config $smtp = Net::SMTP->new( - Hello => 'my.mail.domain', - Timeout => 30, - ); + Hello => 'my.mail.domain', + Timeout => 30, + ); =back diff --git a/Net/Time.pm b/Net/Time.pm index 6f1dd04..6b3b641 100644 --- a/Net/Time.pm +++ b/Net/Time.pm @@ -17,7 +17,7 @@ use IO::Select; @ISA = qw(Exporter); @EXPORT_OK = qw(inet_time inet_daytime); -$VERSION = "2.10"; +$VERSION = "2.11"; $TIMEOUT = 120; @@ -107,11 +107,11 @@ Net::Time - time and daytime network client interface use Net::Time qw(inet_time inet_daytime); - print inet_time(); # use default host from Net::Config + print inet_time(); # use default host from Net::Config print inet_time('localhost'); print inet_time('localhost', 'tcp'); - print inet_daytime(); # use default host from Net::Config + print inet_daytime(); # use default host from Net::Config print inet_daytime('localhost'); print inet_daytime('localhost', 'tcp'); @@ -10,12 +10,12 @@ point look at: The RFC implemented in this distribution are -Net::FTP RFC959 File Transfer Protocol -Net::SMTP RFC821 Simple Mail Transfer Protocol -Net::Time RFC867 Daytime Protocol -Net::Time RFC868 Time Protocol -Net::NNTP RFC977 Network News Transfer Protocol -Net::POP3 RFC1939 Post Office Protocol 3 +Net::FTP RFC959 File Transfer Protocol +Net::SMTP RFC821 Simple Mail Transfer Protocol +Net::Time RFC867 Daytime Protocol +Net::Time RFC868 Time Protocol +Net::NNTP RFC977 Network News Transfer Protocol +Net::POP3 RFC1939 Post Office Protocol 3 AVAILABILITY @@ -2,11 +2,11 @@ BEGIN { if ($ENV{PERL_CORE}) { - chdir 't' if -d 't'; - @INC = '../lib'; + chdir 't' if -d 't'; + @INC = '../lib'; } if (!eval "require Socket") { - print "1..0 # no Socket\n"; exit 0; + print "1..0 # no Socket\n"; exit 0; } undef *{Socket::inet_aton}; undef *{Socket::inet_ntoa}; @@ -19,29 +19,29 @@ BEGIN { package Socket; sub import { - my $pkg = caller(); - no strict 'refs'; - *{ $pkg . '::inet_aton' } = \&inet_aton; - *{ $pkg . '::inet_ntoa' } = \&inet_ntoa; + my $pkg = caller(); + no strict 'refs'; + *{ $pkg . '::inet_aton' } = \&inet_aton; + *{ $pkg . '::inet_ntoa' } = \&inet_ntoa; } my $fail = 0; my %names; sub set_fail { - $fail = shift; + $fail = shift; } sub inet_aton { - return if $fail; - my $num = unpack('N', pack('C*', split(/\./, $_[0]))); - $names{$num} = $_[0]; - return $num; + return if $fail; + my $num = unpack('N', pack('C*', split(/\./, $_[0]))); + $names{$num} = $_[0]; + return $num; } sub inet_ntoa { - return if $fail; - return $names{$_[0]}; + return if $fail; + return $names{$_[0]}; } package main; @@ -59,29 +59,29 @@ ok( keys %NetConfig, '%NetConfig should be imported' ); Socket::set_fail(1); undef $NetConfig{'ftp_firewall'}; is( Net::Config->requires_firewall(), 0, - 'requires_firewall() should return 0 without ftp_firewall defined' ); + 'requires_firewall() should return 0 without ftp_firewall defined' ); $NetConfig{'ftp_firewall'} = 1; is( Net::Config->requires_firewall('a.host.not.there'), -1, - '... should return -1 without a valid hostname' ); + '... should return -1 without a valid hostname' ); Socket::set_fail(0); delete $NetConfig{'local_netmask'}; is( Net::Config->requires_firewall('127.0.0.1'), 0, - '... should return 0 without local_netmask defined' ); + '... should return 0 without local_netmask defined' ); $NetConfig{'local_netmask'} = '127.0.0.1/24'; is( Net::Config->requires_firewall('127.0.0.1'), 0, - '... should return false if host is within netmask' ); + '... should return false if host is within netmask' ); is( Net::Config->requires_firewall('192.168.10.0'), 1, - '... should return true if host is outside netmask' ); + '... should return true if host is outside netmask' ); # now try more netmasks $NetConfig{'local_netmask'} = [ '127.0.0.1/24', '10.0.0.0/8' ]; is( Net::Config->requires_firewall('10.10.255.254'), 0, - '... should find success with mutiple local netmasks' ); + '... should find success with mutiple local netmasks' ); is( Net::Config->requires_firewall('192.168.10.0'), 1, - '... should handle failure with multiple local netmasks' ); + '... should handle failure with multiple local netmasks' ); is( \&Net::Config::is_external, \&Net::Config::requires_firewall, - 'is_external() should be an alias for requires_firewall()' ); + 'is_external() should be an alias for requires_firewall()' ); diff --git a/t/datasend.t b/t/datasend.t index 96b5b7c..f642340 100644 --- a/t/datasend.t +++ b/t/datasend.t @@ -2,11 +2,11 @@ BEGIN { if ($ENV{PERL_CORE}) { - chdir 't' if -d 't'; - @INC = '../lib'; + chdir 't' if -d 't'; + @INC = '../lib'; } if (!eval "require Socket") { - print "1..0 # no Socket\n"; exit 0; + print "1..0 # no Socket\n"; exit 0; } if (ord('A') == 193 && !eval "require Convert::EBCDIC") { print "1..0 # EBCDIC but no Convert::EBCDIC\n"; exit 0; @@ -2,11 +2,11 @@ BEGIN { unless (-d 'blib') { - chdir 't' if -d 't'; - @INC = '../lib'; + chdir 't' if -d 't'; + @INC = '../lib'; } if (!eval "require Socket") { - print "1..0 # Skip: no Socket module\n"; exit 0; + print "1..0 # Skip: no Socket module\n"; exit 0; } if (ord('A') == 193 && !eval "require Convert::EBCDIC") { print "1..0 # Skip: EBCDIC but no Convert::EBCDIC\n"; exit 0; @@ -30,7 +30,7 @@ my $t = 1; print "1..7\n"; $ftp = Net::FTP->new($NetConfig{ftp_testhost}) - or (print("not ok 1\n"), exit); + or (print("not ok 1\n"), exit); printf "ok %d\n",$t++; diff --git a/t/hostname.t b/t/hostname.t index 4013d74..f486bb4 100644 --- a/t/hostname.t +++ b/t/hostname.t @@ -2,11 +2,11 @@ BEGIN { unless (-d 'blib') { - chdir 't' if -d 't'; - @INC = '../lib'; + chdir 't' if -d 't'; + @INC = '../lib'; } if (!eval "require Socket") { - print "1..0 # no Socket\n"; exit 0; + print "1..0 # no Socket\n"; exit 0; } if (ord('A') == 193 && !eval "require Convert::EBCDIC") { print "1..0 # EBCDIC but no Convert::EBCDIC\n"; exit 0; diff --git a/t/libnet_t.pl b/t/libnet_t.pl index ed245e6..9337dd1 100644 --- a/t/libnet_t.pl +++ b/t/libnet_t.pl @@ -1,36 +1,36 @@ my $number = 0; sub ok { - my ($condition, $name) = @_; + my ($condition, $name) = @_; - my $message = $condition ? "ok " : "not ok "; - $message .= ++$number; - $message .= " # $name" if defined $name; - print $message, "\n"; - return $condition; + my $message = $condition ? "ok " : "not ok "; + $message .= ++$number; + $message .= " # $name" if defined $name; + print $message, "\n"; + return $condition; } sub is { - my ($got, $expected, $name) = @_; + my ($got, $expected, $name) = @_; - for ($got, $expected) { - $_ = 'undef' unless defined $_; - } + for ($got, $expected) { + $_ = 'undef' unless defined $_; + } - unless (ok($got eq $expected, $name)) { - warn "Got: '$got'\nExpected: '$expected'\n" . join(' ', caller) . "\n"; - } + unless (ok($got eq $expected, $name)) { + warn "Got: '$got'\nExpected: '$expected'\n" . join(' ', caller) . "\n"; + } } sub skip { - my ($reason, $num) = @_; - $reason ||= ''; - $number ||= 1; - - for (1 .. $num) { - $number++; - print "ok $number # skip $reason\n"; - } + my ($reason, $num) = @_; + $reason ||= ''; + $number ||= 1; + + for (1 .. $num) { + $number++; + print "ok $number # skip $reason\n"; + } } 1; @@ -2,11 +2,11 @@ BEGIN { if ($ENV{PERL_CORE}) { - chdir 't' if -d 't'; - @INC = '../lib'; + chdir 't' if -d 't'; + @INC = '../lib'; } if (!eval "require Socket") { - print "1..0 # no Socket\n"; exit 0; + print "1..0 # no Socket\n"; exit 0; } if (ord('A') == 193 && !eval "require Convert::EBCDIC") { print "1..0 # EBCDIC but no Convert::EBCDIC\n"; exit 0; @@ -25,13 +25,13 @@ $ENV{HOME} = Cwd::cwd(); local (*CORE::GLOBAL::getpwuid, *CORE::GLOBAL::stat); *CORE::GLOBAL::getpwuid = sub ($) { - ((undef) x 7, Cwd::cwd()); + ((undef) x 7, Cwd::cwd()); }; # for testing _readrc my @stat; *CORE::GLOBAL::stat = sub (*) { - return @stat; + return @stat; }; # for testing _readrc @@ -47,29 +47,29 @@ ok( exists $INC{'Net/Netrc.pm'}, 'should be able to use Net::Netrc' ); $Net::Netrc::TESTING=$Net::Netrc::TESTING=1; SKIP: { - skip('incompatible stat() handling for OS', 4), next SKIP - if ($^O =~ /os2|win32|macos|cygwin/i or $] < 5.005); - - my $warn; - local $SIG{__WARN__} = sub { - $warn = shift; - }; - - # add write access for group/other - $stat[2] = 077; - ok( !defined(Net::Netrc::_readrc()), - '_readrc() should not read world-writable file' ); - ok( scalar($warn =~ /^Bad permissions:/), - '... and should warn about it' ); - - # the owner field should still not match - $stat[2] = 0; + skip('incompatible stat() handling for OS', 4), next SKIP + if ($^O =~ /os2|win32|macos|cygwin/i or $] < 5.005); + + my $warn; + local $SIG{__WARN__} = sub { + $warn = shift; + }; + + # add write access for group/other + $stat[2] = 077; + ok( !defined(Net::Netrc::_readrc()), + '_readrc() should not read world-writable file' ); + ok( scalar($warn =~ /^Bad permissions:/), + '... and should warn about it' ); + + # the owner field should still not match + $stat[2] = 0; if ($<) { ok( !defined(Net::Netrc::_readrc()), '_readrc() should not read file owned by someone else' ); ok( scalar($warn =~ /^Not owner:/), - '... and should warn about it' ); + '... and should warn about it' ); } else { skip("testing as root",2); } @@ -80,15 +80,15 @@ $stat[4] = $<; # this curious mix of spaces and quotes tests a regex at line 79 (version 2.11) FileHandle::set_lines(split(/\n/, <<LINES)); -macdef bar -login baz - machine "foo" -login nigol "password" drowssap -machine foo "login" l2 - password p2 -account tnuocca -default login "baz" password p2 -default "login" baz password p3 +macdef bar +login baz +machine "foo" +login nigol "password" drowssap +machine foo "login" l2 +password p2 +account tnuocca +default login "baz" password p2 +default "login" baz password p3 macdef LINES @@ -97,59 +97,59 @@ is( Net::Netrc::_readrc(), 1, '_readrc() should succeed now' ); # on 'foo', the login is 'nigol' is( Net::Netrc->lookup('foo')->{login}, 'nigol', - 'lookup() should find value by host name' ); + 'lookup() should find value by host name' ); # on 'foo' with login 'l2', the password is 'p2' is( Net::Netrc->lookup('foo', 'l2')->{password}, 'p2', - 'lookup() should find value by hostname and login name' ); + 'lookup() should find value by hostname and login name' ); # the default password is 'p3', as later declarations have priority is( Net::Netrc->lookup()->{password}, 'p3', - 'lookup() should find default value' ); + 'lookup() should find default value' ); # lookup() ignores the login parameter when using default data is( Net::Netrc->lookup('default', 'baz')->{password}, 'p3', - 'lookup() should ignore passed login when searching default' ); + 'lookup() should ignore passed login when searching default' ); # lookup() goes to default data if hostname cannot be found in config data is( Net::Netrc->lookup('abadname')->{login}, 'baz', - 'lookup() should use default for unknown machine name' ); + 'lookup() should use default for unknown machine name' ); # now test these accessors my $instance = bless({}, 'Net::Netrc'); for my $accessor (qw( login account password )) { - is( $instance->$accessor(), undef, - "$accessor() should return undef if $accessor is not set" ); - $instance->{$accessor} = $accessor; - is( $instance->$accessor(), $accessor, - "$accessor() should return value when $accessor is set" ); + is( $instance->$accessor(), undef, + "$accessor() should return undef if $accessor is not set" ); + $instance->{$accessor} = $accessor; + is( $instance->$accessor(), $accessor, + "$accessor() should return value when $accessor is set" ); } # and the three-for-one accessor is( scalar( () = $instance->lpa()), 3, - 'lpa() should return login, password, account'); + 'lpa() should return login, password, account'); is( join(' ', $instance->lpa), 'login password account', - 'lpa() should return appropriate values for l, p, and a' ); + 'lpa() should return appropriate values for l, p, and a' ); package FileHandle; sub new { - tie *FH, 'FileHandle', @_; - bless \*FH, $_[0]; + tie *FH, 'FileHandle', @_; + bless \*FH, $_[0]; } sub TIEHANDLE { - my ($class, $file, $mode) = @_[0,2,3]; - bless({ file => $file, mode => $mode }, $class); + my ($class, $file, $mode) = @_[0,2,3]; + bless({ file => $file, mode => $mode }, $class); } my @lines; sub set_lines { - @lines = @_; + @lines = @_; } sub READLINE { - shift @lines; + shift @lines; } sub close { 1 } @@ -2,11 +2,11 @@ BEGIN { unless (-d 'blib') { - chdir 't' if -d 't'; - @INC = '../lib'; + chdir 't' if -d 't'; + @INC = '../lib'; } if (!eval "require Socket") { - print "1..0 # no Socket\n"; exit 0; + print "1..0 # no Socket\n"; exit 0; } if (ord('A') == 193 && !eval "require Convert::EBCDIC") { print "1..0 # EBCDIC but no Convert::EBCDIC\n"; exit 0; @@ -27,7 +27,7 @@ print "1..4\n"; my $i = 1; $nntp = Net::NNTP->new(Debug => 0) - or (print("not ok 1\n"), exit); + or (print("not ok 1\n"), exit); print "ok 1\n"; diff --git a/t/require.t b/t/require.t index 163c8bd..973ed41 100644 --- a/t/require.t +++ b/t/require.t @@ -2,11 +2,11 @@ BEGIN { unless (-d 'blib') { - chdir 't' if -d 't'; - @INC = '../lib'; + chdir 't' if -d 't'; + @INC = '../lib'; } if (!eval "require Socket") { - print "1..0 # no Socket\n"; exit 0; + print "1..0 # no Socket\n"; exit 0; } if (ord('A') == 193 && !eval "require Convert::EBCDIC") { print "1..0 # EBCDIC but no Convert::EBCDIC\n"; exit 0; @@ -2,11 +2,11 @@ BEGIN { unless (-d 'blib') { - chdir 't' if -d 't'; - @INC = '../lib'; + chdir 't' if -d 't'; + @INC = '../lib'; } if (!eval "require Socket") { - print "1..0 # no Socket\n"; exit 0; + print "1..0 # no Socket\n"; exit 0; } if (ord('A') == 193 && !eval "require Convert::EBCDIC") { print "1..0 # EBCDIC but no Convert::EBCDIC\n"; exit 0; @@ -26,7 +26,7 @@ print "1..3\n"; my $i = 1; $smtp = Net::SMTP->new(Debug => 0) - or (print("not ok 1\n"), exit); + or (print("not ok 1\n"), exit); print "ok 1\n"; @@ -2,14 +2,14 @@ BEGIN { if ($ENV{PERL_CORE}) { - chdir 't' if -d 't'; - @INC = '../lib'; + chdir 't' if -d 't'; + @INC = '../lib'; } if (!eval "require Socket") { - print "1..0 # no Socket\n"; exit 0; + print "1..0 # no Socket\n"; exit 0; } if (ord('A') == 193 && !eval "require Convert::EBCDIC") { - print "1..0 # EBCDIC but no Convert::EBCDIC\n"; exit 0; + print "1..0 # EBCDIC but no Convert::EBCDIC\n"; exit 0; } $INC{'IO/Socket.pm'} = 1; $INC{'IO/Select.pm'} = 1; @@ -50,84 +50,84 @@ is( Net::Time::inet_daytime('bob'), 'z', 'inet_daytime() should receive data' ); # magic numbers defined in Net::Time my $offset = $^O eq 'MacOS' ? - (4 * 31536000) : (70 * 31536000 + 17 * 86400); + (4 * 31536000) : (70 * 31536000 + 17 * 86400); # check for correct args (time, 13) # pretend it is only six seconds since the offset, create a fake message # inet_time IO::Socket::INET::set_message(pack("N", $offset + 6)); is( Net::Time::inet_time('foo'), 6, - 'inet_time() should calculate time since offset for time()' ); + 'inet_time() should calculate time since offset for time()' ); my %fail; sub make_fail { - my ($pack, $func, $num) = @_; - $num = 1 unless defined $num; + my ($pack, $func, $num) = @_; + $num = 1 unless defined $num; - $fail{$pack}{$func} = $num; + $fail{$pack}{$func} = $num; } package IO::Socket::INET; $fail{'IO::Socket::INET'} = { - new => 0, - 'send' => 0, + new => 0, + 'send' => 0, }; sub new { - my $class = shift; - return if $fail{$class}{new} and $fail{$class}{new}--; - bless( { @_ }, $class ); + my $class = shift; + return if $fail{$class}{new} and $fail{$class}{new}--; + bless( { @_ }, $class ); } sub send { - my $self = shift; - my $class = ref($self); - return if $fail{$class}{'send'} and $fail{$class}{'send'}--; - $self->{sent} .= shift; + my $self = shift; + my $class = ref($self); + return if $fail{$class}{'send'} and $fail{$class}{'send'}--; + $self->{sent} .= shift; } my $msg; sub set_message { - if (ref($_[0])) { - $_[0]->{msg} = $_[1]; - } else { - $msg = shift; - } + if (ref($_[0])) { + $_[0]->{msg} = $_[1]; + } else { + $msg = shift; + } } sub do_recv { - my ($len, $msg) = @_[1,2]; - $_[0] .= substr($msg, 0, $len); + my ($len, $msg) = @_[1,2]; + $_[0] .= substr($msg, 0, $len); } sub recv { - my ($self, $buf, $length, $flags) = @_; - my $message = exists $self->{msg} ? - $self->{msg} : $msg; - - if (defined($message)) { - do_recv($_[1], $length, $message); - } - 1; + my ($self, $buf, $length, $flags) = @_; + my $message = exists $self->{msg} ? + $self->{msg} : $msg; + + if (defined($message)) { + do_recv($_[1], $length, $message); + } + 1; } package IO::Select; sub new { - my $class = shift; - return if defined $fail{$class}{new} and $fail{$class}{new}--; - bless({sock => shift}, $class); + my $class = shift; + return if defined $fail{$class}{new} and $fail{$class}{new}--; + bless({sock => shift}, $class); } sub can_read { - my ($self, $timeout) = @_; - my $class = ref($self); - return if defined $fail{$class}{can_read} and $fail{class}{can_read}--; - $self->{sock}{timeout} = $timeout; - 1; + my ($self, $timeout) = @_; + my $class = ref($self); + return if defined $fail{$class}{can_read} and $fail{class}{can_read}--; + $self->{sock}{timeout} = $timeout; + 1; } 1; |