Upgrade to CGI-3.14.
[p5sagit/p5-mst-13.2.git] / lib / Net / Config.pm
index 23db846..a502abe 100644 (file)
@@ -13,7 +13,7 @@ use strict;
 
 @EXPORT  = qw(%NetConfig);
 @ISA     = qw(Net::LocalCfg Exporter);
-$VERSION = "1.08"; # $Id: //depot/libnet/Net/Config.pm#13 $
+$VERSION = "1.10"; # $Id: //depot/libnet/Net/Config.pm#17 $
 
 eval { local $SIG{__DIE__}; require Net::LocalCfg };
 
@@ -33,6 +33,30 @@ eval { local $SIG{__DIE__}; require Net::LocalCfg };
     test_exist => 1,
 );
 
+#
+# Try to get as much configuration info as possible from InternetConfig
+#
+$^O eq 'MacOS' and eval <<TRY_INTERNET_CONFIG;
+use Mac::InternetConfig;
+
+{
+my %nc = (
+    nntp_hosts      => [ \$InternetConfig{ kICNNTPHost() } ],
+    pop3_hosts      => [ \$InternetConfig{ kICMailAccount() } =~ /\@(.*)/ ],
+    smtp_hosts      => [ \$InternetConfig{ kICSMTPHost() } ],
+    ftp_testhost    => \$InternetConfig{ kICFTPHost() } ? \$InternetConfig{ kICFTPHost()} : undef,
+    ph_hosts        => [ \$InternetConfig{ kICPhHost() }   ],
+    ftp_ext_passive => \$InternetConfig{"646F676F\xA5UsePassiveMode"} || 0,
+    ftp_int_passive => \$InternetConfig{"646F676F\xA5UsePassiveMode"} || 0,
+    socks_hosts     => 
+       \$InternetConfig{ kICUseSocks() }    ? [ \$InternetConfig{ kICSocksHost() }    ] : [],
+    ftp_firewall    => 
+       \$InternetConfig{ kICUseFTPProxy() } ? [ \$InternetConfig{ kICFTPProxyHost() } ] : [],
+);
+\@NetConfig{keys %nc} = values %nc;
+}
+TRY_INTERNET_CONFIG
+
 my $file = __FILE__;
 my $ref;
 $file =~ s/Config.pm/libnet.cfg/;
@@ -56,7 +80,7 @@ if ($< == $> and !$CONFIGURE)  {
 my ($k,$v);
 while(($k,$v) = each %NetConfig) {
        $NetConfig{$k} = [ $v ]
-               if($k =~ /_hosts$/ && !ref($v));
+               if($k =~ /_hosts$/ and $k ne "test_hosts" and defined($v) and !ref($v));
 }
 
 # Take a hostname and determine if it is inside the firewall
@@ -105,7 +129,7 @@ Net::Config - Local configuration data for libnet
 =head1 DESCRIPTION
 
 C<Net::Config> holds configuration data for the modules in the libnet
-distribuion. During installation you will be asked for these values.
+distribution. During installation you will be asked for these values.
 
 The configuration data is held globally in a file in the perl installation
 tree, but a user may override any of these values by providing their own. This
@@ -115,7 +139,7 @@ For example
 
     # .libnetrc
     {
-        nntp_hosts => [ "my_prefered_host" ],
+        nntp_hosts => [ "my_preferred_host" ],
        ph_hosts   => [ "my_ph_server" ],
     }
     __END__
@@ -243,7 +267,7 @@ There is no firewall
 
 =item ftp_ext_passive
 
-=item ftp_int_pasive
+=item ftp_int_passive
 
 FTP servers normally work on a non-passive mode. That is when you want to
 transfer data you have to tell the server the address and port to
@@ -285,6 +309,6 @@ If true then C<Configure> will check each hostname given that it exists
 
 =for html <hr>
 
-I<$Id: //depot/libnet/Net/Config.pm#13 $>
+I<$Id: //depot/libnet/Net/Config.pm#17 $>
 
 =cut