Re: [ID 20010529.003] find2perl and File::Find doesn't emulate find when path is...
[p5sagit/p5-mst-13.2.git] / t / lib / socket.t
index 8f945ac..481fd8f 100755 (executable)
@@ -2,7 +2,7 @@
 
 BEGIN {
     chdir 't' if -d 't';
-    unshift @INC, '../lib' if -d '../lib';
+    @INC = '../lib';
     require Config; import Config;
     if ($Config{'extensions'} !~ /\bSocket\b/ && 
         !(($^O eq 'VMS') && $Config{d_socket})) {
@@ -13,7 +13,7 @@ BEGIN {
        
 use Socket;
 
-print "1..6\n";
+print "1..8\n";
 
 if (socket(T,PF_INET,SOCK_STREAM,6)) {
   print "ok 1\n";
@@ -21,8 +21,8 @@ if (socket(T,PF_INET,SOCK_STREAM,6)) {
   if (connect(T,pack_sockaddr_in(7,inet_aton("localhost")))){
        print "ok 2\n";
 
-       print "# Connected to ",
-               inet_ntoa((unpack_sockaddr_in(getpeername(T)))[1]),"\n";
+       print "# Connected to " .
+               inet_ntoa((unpack_sockaddr_in(getpeername(T)))[1])."\n";
 
        syswrite(T,"hello",5);
        $read = sysread(T,$buff,10);    # Connection may be granted, then closed!
@@ -51,8 +51,8 @@ if( socket(S,PF_INET,SOCK_STREAM,6) ){
   if (connect(S,pack_sockaddr_in(7,INADDR_LOOPBACK))){
        print "ok 5\n";
 
-       print "# Connected to ",
-               inet_ntoa((unpack_sockaddr_in(getpeername(S)))[1]),"\n";
+       print "# Connected to " .
+               inet_ntoa((unpack_sockaddr_in(getpeername(S)))[1])."\n";
 
        syswrite(S,"olleh",5);
        $read = sysread(S,$buff,10);    # Connection may be granted, then closed!
@@ -74,3 +74,14 @@ else {
        print "# $!\n";
        print "not ok 4\n";
 }
+
+# warnings
+$SIG{__WARN__} = sub {
+    ++ $w if $_[0] =~ /^6-ARG sockaddr_in call is deprecated/ ;
+} ;
+$w = 0 ;
+sockaddr_in(1,2,3,4,5,6) ;
+print ($w == 1 ? "not ok 7\n" : "ok 7\n") ;
+use warnings 'Socket' ;
+sockaddr_in(1,2,3,4,5,6) ;
+print ($w == 1 ? "ok 8\n" : "not ok 8\n") ;