From: Gurusamy Sarathy Date: Sun, 14 Feb 1999 10:25:55 +0000 (+0000) Subject: allow C to autovivify *foo (SelectSaver expects that) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ded8aa31a400d00437fd50627d6c8013f58fd6ab;p=p5sagit%2Fp5-mst-13.2.git allow C to autovivify *foo (SelectSaver expects that) p4raw-id: //depot/perl@2914 --- diff --git a/op.c b/op.c index 9e4f084..7ccfe16 100644 --- a/op.c +++ b/op.c @@ -1401,6 +1401,7 @@ is_handle_constructor(OP *o, I32 argnum) /* FALL THROUGH */ case OP_SYSOPEN: case OP_OPEN: + case OP_SELECT: /* XXX c.f. SelectSaver.pm */ case OP_SOCKET: case OP_OPEN_DIR: case OP_ACCEPT: diff --git a/pod/perldiag.pod b/pod/perldiag.pod index c303c00..eb84876 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -2323,11 +2323,6 @@ was either never opened or has since been closed. (F) This machine doesn't implement the select() system call. -=item select() on unopened file - -(W) You tried to use the select() function on a filehandle that -was either never opened or has since been closed. - =item sem%s not implemented (F) You don't have System V semaphore IPC on your system. diff --git a/pp_sys.c b/pp_sys.c index e4694bc..a35a206 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -1003,13 +1003,8 @@ PP(pp_select) } if (newdefout) { - if (!GvIO(newdefout)) { - if (ckWARN(WARN_UNOPENED)) - warner(WARN_UNOPENED, "select() on unopened file"); - if (SvTYPE(newdefout) != SVt_PVGV) - RETURN; - gv_IOadd(newdefout); /* XXX probably bogus */ - } + if (!GvIO(newdefout)) + gv_IOadd(newdefout); setdefout(newdefout); } diff --git a/t/op/misc.t b/t/op/misc.t index 778476e..acef29d 100755 --- a/t/op/misc.t +++ b/t/op/misc.t @@ -414,13 +414,7 @@ destroyed package X; sub any { bless {} } my $f = "FH000"; # just to thwart any future optimisations -sub afh { - open(++$f, '>&STDOUT') or die; - select select $f; - my $r = *{$f}{IO}; - delete $X::{$f}; - bless $r; -} +sub afh { select select ++$f; my $r = *{$f}{IO}; delete $X::{$f}; bless $r } sub DESTROY { print "destroyed\n" } package main; $x = any X; # to bump sv_objcount. IO objs aren't counted??