about summary refs log tree commit
diff options
context:
space:
mode:
authorGraham Barr <gbarr@pobox.com>2001-11-20 19:06:41 +0000
committerGraham Barr <gbarr@pobox.com>2001-11-20 19:06:41 +0000
commit72be95a91f91277be57c2cc8b4a77d1d948d9603 (patch)
treec5c35eed8bce33794d97c78d7c6792fd19003fe8
parentcd98841d19d70ff8d69e833e561dfd725994a14c (diff)
downloadperl-libnet-72be95a91f91277be57c2cc8b4a77d1d948d9603.tar.gz
Net::Config
- Read some default values using Mac::InternetConfig if we are on the Mac
  patch from Chris Nandor

-rw-r--r--Net/Config.pm28
1 files changed, 26 insertions, 2 deletions
diff --git a/Net/Config.pm b/Net/Config.pm
index 5a262fd..722985c 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.08"; # $Id: //depot/libnet/Net/Config.pm#13 $
+$VERSION = "1.09"; # $Id: //depot/libnet/Net/Config.pm#14 $
 
 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()}  ],
+    ph_hosts        => [ $InternetConfig{ kICPhHost()}   ],
+    ftp_ext_passive => $InternetConfig{"646F676F€UsePassiveMode"} || 0,
+    ftp_int_passive => $InternetConfig{"646F676F€UsePassiveMode"} || 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/;
@@ -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#14 $>
 
 =cut