Integrate with Sarathy.
Jarkko Hietaniemi [Fri, 28 Apr 2000 21:08:12 +0000 (21:08 +0000)]
p4raw-id: //depot/cfgperl@6012

ext/IO/lib/IO/Poll.pm
installperl
pod/perl56delta.pod
pod/perlfunc.pod
pod/perlmod.pod
t/lib/io_poll.t
utils/perldoc.PL
vms/subconfigure.com

index 687664b..70a3469 100644 (file)
@@ -1,3 +1,4 @@
+
 # IO::Poll.pm
 #
 # Copyright (c) 1997-8 Graham Barr <gbarr@pobox.com>. All rights reserved.
@@ -12,28 +13,31 @@ use Exporter ();
 our(@ISA, @EXPORT_OK, @EXPORT, $VERSION);
 
 @ISA = qw(Exporter);
-$VERSION = "0.01";
+$VERSION = "0.05";
 
-@EXPORT = qw(poll);
+@EXPORT = qw( POLLIN
+             POLLOUT
+             POLLERR
+             POLLHUP
+             POLLNVAL
+           );
 
 @EXPORT_OK = qw(
- POLLIN    
  POLLPRI   
- POLLOUT   
  POLLRDNORM
  POLLWRNORM
  POLLRDBAND
  POLLWRBAND
  POLLNORM  
- POLLERR   
- POLLHUP   
- POLLNVAL  
-);
+              );
 
+# [0] maps fd's to requested masks
+# [1] maps fd's to returned  masks
+# [2] maps fd's to handles
 sub new {
     my $class = shift;
 
-    my $self = bless [{},{}], $class;
+    my $self = bless [{},{},{}], $class;
 
     $self;
 }
@@ -42,20 +46,21 @@ sub mask {
     my $self = shift;
     my $io = shift;
     my $fd = fileno($io);
-    if(@_) {
+    if (@_) {
        my $mask = shift;
-       $self->[0]{$fd} ||= {};
        if($mask) {
-           $self->[0]{$fd}{$io} = $mask;
-       }
-       else {
+         $self->[0]{$fd}{$io} = $mask; # the error events are always returned
+         $self->[1]{$fd}      = 0;     # output mask
+         $self->[2]{$io}      = $io;   # remember handle
+       } else {
            delete $self->[0]{$fd}{$io};
+         delete $self->[1]{$fd} unless %{$self->[0]{$fd}};
+         delete $self->[2]{$io};
        }
     }
-    elsif(exists $self->[0]{$fd}{$io}) {
+    
+    return unless exists $self->[0]{$fd} and exists $self->[0]{$fd}{$io};
        return $self->[0]{$fd}{$io};
-    }
-    return;
 }
 
 
@@ -64,13 +69,13 @@ sub poll {
 
     $self->[1] = {};
 
-    my($fd,$ref);
+    my($fd,$mask,$iom);
     my @poll = ();
 
-    while(($fd,$ref) = each %{$self->[0]}) {
-       my $events = 0;
-       map { $events |= $_ } values %{$ref};
-       push(@poll,$fd, $events);
+    while(($fd,$iom) = each %{$self->[0]}) {
+       $mask   = 0;
+       $mask  |= $_ for values(%$iom);
+       push(@poll,$fd => $mask);
     }
 
     my $ret = @poll ? _poll(defined($timeout) ? $timeout * 1000 : -1,@poll) : 0;
@@ -80,8 +85,7 @@ sub poll {
 
     while(@poll) {
        my($fd,$got) = splice(@poll,0,2);
-       $self->[1]{$fd} = $got
-           if $got;
+       $self->[1]{$fd} = $got if $got;
     }
 
     return $ret;  
@@ -91,9 +95,8 @@ sub events {
     my $self = shift;
     my $io = shift;
     my $fd = fileno($io);
-
-    exists $self->[1]{$fd} && exists $self->[0]{$fd}{$io}
-       ? $self->[1]{$fd} & $self->[0]{$fd}{$io}
+    exists $self->[1]{$fd} and exists $self->[0]{$fd}{$io} 
+                ? $self->[1]{$fd} & ($self->[0]{$fd}{$io}|POLLHUP|POLLERR|POLLNVAL)
        : 0;
 }
 
@@ -105,20 +108,16 @@ sub remove {
 
 sub handles {
     my $self = shift;
-
-    return map { keys %$_ } values %{$self->[0]}
-       unless(@_);
+    return values %{$self->[2]} unless @_;
 
     my $events = shift || 0;
     my($fd,$ev,$io,$mask);
     my @handles = ();
 
     while(($fd,$ev) = each %{$self->[1]}) {
-       if($ev & $events) {
-           while(($io,$mask) = each %{$self->[0][$fd]}) {
-               push(@handles, $io)
-                   if $events & $mask;
-           }
+       while (($io,$mask) = each %{$self->[0]{$fd}}) {
+           $mask |= POLLHUP|POLLERR|POLLNVAL;  # must allow these
+           push @handles,$self->[2]{$io} if ($ev & $mask) & $events;
        }
     }
     return @handles;
@@ -138,8 +137,8 @@ IO::Poll - Object interface to system poll call
 
     $poll = new IO::Poll;
 
-    $poll->mask($input_handle => POLLRDNORM | POLLIN | POLLHUP);
-    $poll->mask($output_handle => POLLWRNORM);
+    $poll->mask($input_handle => POLLIN);
+    $poll->mask($output_handle => POLLOUT);
 
     $poll->poll($timeout);
 
index cd3e0a3..78d7ed7 100755 (executable)
@@ -254,9 +254,9 @@ else {
 mkpath("$installarchlib/CORE", 1, 0777);
 my @corefiles;
 if ($Is_VMS) {  # We did core file selection during build
-    my $coredir = "lib/$Config{'arch'}/$ver";
+    my $coredir = "lib/$Config{archname}/$ver/CORE";
     $coredir =~ tr/./_/;
-    @corefiles = map { s|^$coredir/||i; } <$coredir/*.*>;
+    map { s|^$coredir/||i; } @corefiles = <$coredir/*.*>;
 }
 else {
     # [als] hard-coded 'libperl' name... not good!
index 2117c70..377e448 100644 (file)
@@ -1803,7 +1803,7 @@ cause silent failures.  This has been fixed.
 Prior versions used to run BEGIN B<and> END blocks when Perl was
 run in compile-only mode.  Since this is typically not the expected
 behavior, END blocks are not executed anymore when the C<-c> switch
-is used.
+is used, or if compilation fails.
 
 See L<CHECK blocks> for how to run things when the compile phase ends.
 
index 17af812..603d057 100644 (file)
@@ -1896,8 +1896,10 @@ by using the C<Config> module and the values C<d_pwquota>, C<d_pwage>,
 C<d_pwchange>, C<d_pwcomment>, and C<d_pwexpire>.  Shadow password
 files are only supported if your vendor has implemented them in the
 intuitive fashion that calling the regular C library routines gets the
-shadow versions if you're running under privilege.  Those that
-incorrectly implement a separate library call are not supported.
+shadow versions if you're running under privilege or if there exists
+the shadow(3) functions as found in System V ( this includes Solaris
+and Linux.)  Those systems which implement a proprietary shadow password
+facility are unlikely to be supported.
 
 The $members value returned by I<getgr*()> is a space separated list of
 the login names of the members of the group.
index 676940e..6bec46b 100644 (file)
@@ -233,7 +233,7 @@ being blown out of the water by a signal--you have to trap that yourself
 (if you can).)  You may have multiple C<END> blocks within a file--they
 will execute in reverse order of definition; that is: last in, first
 out (LIFO).  C<END> blocks are not executed when you run perl with the
-C<-c> switch.
+C<-c> switch, or if compilation fails.
 
 Inside an C<END> subroutine, C<$?> contains the value that the program is
 going to pass to C<exit()>.  You can modify C<$?> to change the exit
index 68ad7b7..925830e 100755 (executable)
@@ -15,7 +15,7 @@ if ($^O eq 'mpeix') {
 select(STDERR); $| = 1;
 select(STDOUT); $| = 1;
 
-print "1..8\n";
+print "1..9\n";
 
 use IO::Handle;
 use IO::Poll qw(/POLL/);
@@ -75,3 +75,8 @@ $poll->poll(0.1);
 print "not "
        if $poll->events($stdout);
 print "ok 8\n";
+
+$poll->remove($dupout);
+print "not "
+    if $poll->handles;
+print "ok 9\n";
index 297250c..5d136b3 100644 (file)
@@ -204,7 +204,8 @@ if (-f "Makefile.PL") {
 
     # don't add if superuser
     if ($< && $>) {   # don't be looking too hard now!
-       eval q{ use blib; 1 } or die;
+       eval q{ use blib; 1 };
+       warn $@ if $@ && $opt_v;
     }
 }
 
@@ -791,7 +792,7 @@ One useful value for C<PERLDOC_PAGER> is C<less -+C -E>.
 
 =head1 VERSION
 
-This is perldoc v2.01.
+This is perldoc v2.03.
 
 =head1 AUTHOR
 
@@ -803,6 +804,9 @@ and others.
 =cut
 
 #
+# Version 2.03: Sun Apr 23 16:56:34 BST 2000
+#      Hugo van der Sanden <hv@crypt0.demon.co.uk>
+#      don't die when 'use blib' fails
 # Version 2.02: Mon Mar 13 18:03:04 MST 2000
 #       Tom Christiansen <tchrist@perl.com>
 #      Added -U insecurity option
index 3e3a828..086f314 100644 (file)
@@ -4020,6 +4020,10 @@ $ WC "libs='" + perl_libs + "'"
 $ WC "libc='" + perl_libc + "'"
 $ WC "xs_apiversion='" + version + "'"
 $ WC "pm_apiversion='" + version + "'"
+$ WC "version='" + version + "'"
+$ WC "revision='" + revision + "'"
+$ WC "patchlevel='" + patchlevel + "'"
+$ WC "subversion='" + subversion + "'"
 $ WC "PERL_VERSION='" + patchlevel + "'"
 $ WC "PERL_SUBVERSION='" + subversion + "'"
 $ WC "pager='" + perl_pager + "'"