per Larry suggestion, toss change#1327 and fix the documentation
authorGurusamy Sarathy <gsar@cpan.org>
Mon, 6 Jul 1998 18:45:35 +0000 (18:45 +0000)
committerGurusamy Sarathy <gsar@cpan.org>
Mon, 6 Jul 1998 18:45:35 +0000 (18:45 +0000)
to match behavior instead

p4raw-link: @1327 on //depot/perl: 0ce625782f64de805c21893bca308710ed297c68

p4raw-id: //depot/perl@1338

pod/perlfunc.pod
pp_sys.c

index 3fb569b..4e78f69 100644 (file)
@@ -1428,7 +1428,7 @@ formline() always returns TRUE.  See L<perlform> for other examples.
 =item getc
 
 Returns the next character from the input file attached to FILEHANDLE,
-or a null string at end of file, or undef if there was an error.  If
+or the undefined value at end of file, or if there was an error.  If
 FILEHANDLE is omitted, reads from STDIN.  This is not particularly
 efficient.  It cannot be used to get unbuffered single-characters,
 however.  For that, try something more like:
index a7e8dd5..6a4ad31 100644 (file)
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -889,7 +889,6 @@ PP(pp_getc)
     djSP; dTARGET;
     GV *gv;
     MAGIC *mg;
-    PerlIO *fp;
 
     if (MAXARG <= 0)
        gv = stdingv;
@@ -911,19 +910,11 @@ PP(pp_getc)
            SvSetMagicSV_nosteal(TARG, TOPs);
        RETURN;
     }
-    if (!gv || !GvIO(gv) || !(fp = IoIFP(GvIOp(gv))))  /* valid fp? */
+    if (!gv || do_eof(gv)) /* make sure we have fp with something */
        RETPUSHUNDEF;
-
-    if (do_eof(gv)) {                  /* handle magic argv, if needed */
-       if (PerlIO_error(fp))
-           PUSHs(&sv_undef);
-       else
-           PUSHp("",0);
-       RETURN;
-    }
     TAINT;
     sv_setpv(TARG, " ");
-    *SvPVX(TARG) = PerlIO_getc(fp);    /* should never be EOF */
+    *SvPVX(TARG) = PerlIO_getc(IoIFP(GvIOp(gv))); /* should never be EOF */
     PUSHTARG;
     RETURN;
 }