sv_2pv_flags and ROK and UTF8 flags
[p5sagit/p5-mst-13.2.git] / lib / Net / t / netrc.t
index edde65a..cb5c35d 100644 (file)
@@ -47,7 +47,7 @@ ok( exists $INC{'Net/Netrc.pm'}, 'should be able to use Net::Netrc' );
 
 SKIP: {
        skip('incompatible stat() handling for OS', 4), next SKIP 
-               if ($^O =~ /os2|win32|macos|cygwin/i);
+               if ($^O =~ /os2|win32|macos|cygwin/i or $] < 5.005);
        
        my $warn;
        local $SIG{__WARN__} = sub {
@@ -58,24 +58,20 @@ SKIP: {
        $stat[2] = 077;
        ok( !defined(Net::Netrc::_readrc()),
                '_readrc() should not read world-writable file' );
-       ok( $warn =~ /^Bad permissions:/, '... and should warn about it' );
+       ok( scalar($warn =~ /^Bad permissions:/),
+               '... and should warn about it' );
 
        # the owner field should still not match
        $stat[2] = 0;
 
-       my $olduid = $>;
-       eval { $> = 1 }; # switch uid away from root (may not be impelemented)
-
-      SKIP: {
-         skip("don't you know what absolutely power does to you?", 2)
-             if $> == 0;
-         
-         ok( !defined(Net::Netrc::_readrc()),
-             '_readrc() should not read file owned by someone else' );
-         ok( $warn =~ /^Not owner:/, '... and should warn about it' );
-      }
-
-       eval { $> = $olduid }; # switch uid back (may not be implemented)
+        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' ); 
+        } else { 
+          skip("testing as root",2);
+        } 
 }
 
 # this field must now match, to avoid the last-tested warning
@@ -142,7 +138,7 @@ sub new {
 }
 
 sub TIEHANDLE {
-       my ($class, undef, $file, $mode) = @_;
+       my ($class, $file, $mode) = @_[0,2,3];
        bless({ file => $file, mode => $mode }, $class);
 }