Add a VERSION to MethodInstaller::Simple.
[p5sagit/Devel-Declare.git] / stolen_chunk_of_toke.c
index ab1a384..f0498cb 100644 (file)
@@ -83,7 +83,11 @@ STATIC char*    S_scan_word(pTHX_ char *s, char *dest, STRLEN destlen, int allow
 #define PERL_5_8_8_PLUS
 #endif
 
-#ifdef PL_parser
+#if PERL_REVISION == 5 && PERL_VERSION > 8
+#define PERL_5_9_PLUS
+#endif
+
+#ifdef PERL_5_9_PLUS
 /* 5.9+ moves a bunch of things to a PL_parser struct so we need to
    declare the backcompat macros for things to still work (mst) */
 
@@ -302,16 +306,20 @@ S_skipspace(pTHX_ register char *s)
            PL_bufend = SvPVX(PL_linestr) + SvCUR(PL_linestr);
            PL_last_lop = PL_last_uni = Nullch;
 
-           /* Close the filehandle.  Could be from -P preprocessor,
+           /* In perl versions previous to p4-rawid: //depot/perl@32954 -P
+            * preprocessors were supported here. We don't support -P at all, even
+            * on perls that support it, and use the following chunk from blead
+            * perl. (rafl)
+            */
+
+           /* Close the filehandle.  Could be from
             * STDIN, or a regular file.  If we were reading code from
             * STDIN (because the commandline held no -e or filename)
             * then we don't close it, we reset it so the code can
             * read from STDIN too.
             */
 
-           if (PL_preprocess && !PL_in_eval)
-               (void)PerlProc_pclose(PL_rsfp);
-           else if ((PerlIO*)PL_rsfp == PerlIO_stdin())
+           if ((PerlIO*)PL_rsfp == PerlIO_stdin())
                PerlIO_clearerr(PL_rsfp);
            else
                (void)PerlIO_close(PL_rsfp);