t/comp/bproto.t See if builtins conform to their prototypes
t/comp/cmdopt.t See if command optimization works
t/comp/colon.t See if colons are parsed correctly
-t/comp/cpp.aux main file for cpp.t
-t/comp/cpp.t See if C preprocessor works
t/comp/decl.t See if declarations work
t/comp/fold.t See if constant folding works
t/comp/hints.t See if %^H works
t/run/switchI.t Test the -I switch
t/run/switchn.t Test the -n switch
t/run/switchp.t Test the -p switch
-t/run/switchPx.aux Data for switchPx.t
-t/run/switchPx.t Test the -Px combination
t/run/switcht.t Test the -t switch
t/run/switchx2.aux Data for switchx.t
t/run/switchx.aux Data for switchx.t
io/fs.t may fail on test #18. This appears to be a bug in HP-UX and no
fix is currently available.
-=head2 perl -P and // and HP-UX
-
-If HP-UX Perl is compiled with flags that will cause problems if the
--P flag of Perl (preprocess Perl code with the C preprocessor before
-perl sees it) is used. The problem is that C<//>, being a C++-style
-until-end-of-line comment, will disappear along with the remainder
-of the line. This means that common Perl constructs like
-
- s/foo//;
-
-will turn into illegal code
-
- s/foo
-
-The workaround is to use some other quoting separator than C<"/">,
-like for example C<"!">:
-
- s!foo!!;
-
=head2 HP-UX Kernel Parameters (maxdsiz) for Compiling Perl
By default, HP-UX comes configured with a maximum data segment size of
A message of the form:
- comp/cpp.............ERROR CBC3191 ./.301989890.c:1 The character $ is not a
- valid C source character.
- FSUM3065 The COMPILE step ended with return code 12.
- FSUM3017 Could not compile .301989890.c. Correct the errors and try again.
- ok
-
-indicates that the t/comp/cpp.t test of Perl's -P command line switch has
-passed but that the particular invocation of c89 -E in the cpp script does
-not suppress the C compiler check of source code validity.
-
-=item *
-
-A message of the form:
-
io/openpid...........CEE5210S The signal SIGHUP was received.
CEE5210S The signal SIGHUP was received.
CEE5210S The signal SIGHUP was received.
#define PL_pidstatus (vTHX->Ipidstatus)
#define PL_ppid (vTHX->Ippid)
#define PL_preambleav (vTHX->Ipreambleav)
-#define PL_preprocess (vTHX->Ipreprocess)
#define PL_profiledata (vTHX->Iprofiledata)
#define PL_psig_name (vTHX->Ipsig_name)
#define PL_psig_pend (vTHX->Ipsig_pend)
#define PL_Ipidstatus PL_pidstatus
#define PL_Ippid PL_ppid
#define PL_Ipreambleav PL_preambleav
-#define PL_Ipreprocess PL_preprocess
#define PL_Iprofiledata PL_profiledata
#define PL_Ipsig_name PL_psig_name
#define PL_Ipsig_pend PL_psig_pend
PERLVARI(Isplitstr, const char *, " ")
PERLVAR(Iminus_c, bool)
-PERLVAR(Ipreprocess, bool)
PERLVAR(Iminus_n, bool)
PERLVAR(Iminus_p, bool)
PERLVAR(Iminus_l, bool)
}
/* switches */
- PL_preprocess = FALSE;
PL_minus_n = FALSE;
PL_minus_p = FALSE;
PL_minus_l = FALSE;
else
Perl_croak(aTHX_ "No directory specified for -I");
break;
- case 'P':
- forbid_setid('P', -1);
- PL_preprocess = TRUE;
- s++;
- deprecate("-P");
- goto reswitch;
case 'S':
forbid_setid('S', -1);
dosearch = TRUE;
#endif
CopLINE_set(PL_curcop, 0);
PL_curstash = PL_defstash;
- PL_preprocess = FALSE;
if (PL_e_script) {
SvREFCNT_dec(PL_e_script);
PL_e_script = NULL;
"-[mM][-]module execute \"use/no module...\" before executing program",
"-n assume \"while (<>) { ... }\" loop around program",
"-p assume loop like -n but print line also, like sed",
-"-P run program through C preprocessor before compilation",
"-s enable rudimentary parsing for switches after programfile",
"-S look for programfile using PATH environment variable",
"-t enable tainting warnings",
" t Trace execution",
" o Method and overloading resolution",
" c String/numeric conversions",
- " P Print profiling info, preprocessor command for -P, source file input state",
+ " P Print profiling info, source file input state",
" m Memory allocation",
" f Format processing",
" r Regular expression parsing and execution",
case 'S': /* OS/2 needs -S on "extproc" line. */
break;
#endif
- case 'P':
- if (PL_preprocess)
- return s+1;
- /* FALL THROUGH */
default:
Perl_croak(aTHX_ "Can't emulate -%.1s on #! line",s);
}
Perl_croak(aTHX_ "suidperl needs (suid) fd script\n");
}
#else /* IAMSUID */
- else if (PL_preprocess) {
- const char * const cpp_cfg = CPPSTDIN;
- SV * const cpp = newSVpvs("");
- SV * const cmd = newSV(0);
-
- if (cpp_cfg[0] == 0) /* PERL_MICRO? */
- Perl_croak(aTHX_ "Can't run with cpp -P with CPPSTDIN undefined");
- if (strEQ(cpp_cfg, "cppstdin"))
- Perl_sv_catpvf(aTHX_ cpp, "%s/", BIN_EXP);
- sv_catpv(cpp, cpp_cfg);
-
-# ifndef VMS
- sv_catpvs(sv, "-I");
- sv_catpv(sv,PRIVLIB_EXP);
-# endif
-
- DEBUG_P(PerlIO_printf(Perl_debug_log,
- "PL_preprocess: scriptname=\"%s\", cpp=\"%s\", sv=\"%s\", CPPMINUS=\"%s\"\n",
- scriptname, SvPVX_const (cpp), SvPVX_const (sv),
- CPPMINUS));
-
-# if defined(MSDOS) || defined(WIN32) || defined(VMS)
- quote = "\"";
-# else
- quote = "'";
-# endif
-
-# ifdef VMS
- cpp_discard_flag = "";
-# else
- cpp_discard_flag = "-C";
-# endif
-
-# ifdef OS2
- perl = os2_execname(aTHX);
-# else
- perl = PL_origargv[0];
-# endif
-
-
- /* This strips off Perl comments which might interfere with
- the C pre-processor, including #!. #line directives are
- deliberately stripped to avoid confusion with Perl's version
- of #line. FWP played some golf with it so it will fit
- into VMS's 255 character buffer.
- */
- if( PL_doextract )
- code = "(1../^#!.*perl/i)|/^\\s*#(?!\\s*((ifn?|un)def|(el|end)?if|define|include|else|error|pragma)\\b)/||!($|=1)||print";
- else
- code = "/^\\s*#(?!\\s*((ifn?|un)def|(el|end)?if|define|include|else|error|pragma)\\b)/||!($|=1)||print";
-
- Perl_sv_setpvf(aTHX_ cmd, "\
-%s -ne%s%s%s %s | %"SVf" %s %"SVf" %s",
- perl, quote, code, quote, scriptname, SVfARG(cpp),
- cpp_discard_flag, SVfARG(sv), CPPMINUS);
-
- PL_doextract = FALSE;
-
- DEBUG_P(PerlIO_printf(Perl_debug_log,
- "PL_preprocess: cmd=\"%s\"\n",
- SvPVX_const(cmd)));
-
- *rsfpp = PerlProc_popen((char *)SvPVX_const(cmd), (char *)"r");
- SvREFCNT_dec(cmd);
- SvREFCNT_dec(cpp);
- }
else if (!*scriptname) {
forbid_setid(0, *suidscript);
*rsfpp = PerlIO_stdin();
Perl_croak(aTHX_ "Effective UID cannot exec script\n"); /* they can't do this */
}
# ifdef IAMSUID
- else if (PL_preprocess) /* PSz 13 Nov 03 Caught elsewhere, useless(?!) here */
- Perl_croak(aTHX_ "-P not allowed for setuid/setgid script\n");
else if (fdscript < 0 || suidscript != 1)
/* PSz 13 Nov 03 Caught elsewhere, useless(?!) here */
Perl_croak(aTHX_ "(suid) fdscript needed in suidperl\n");
#define PL_ppid (*Perl_Ippid_ptr(aTHX))
#undef PL_preambleav
#define PL_preambleav (*Perl_Ipreambleav_ptr(aTHX))
-#undef PL_preprocess
-#define PL_preprocess (*Perl_Ipreprocess_ptr(aTHX))
#undef PL_profiledata
#define PL_profiledata (*Perl_Iprofiledata_ptr(aTHX))
#undef PL_psig_name
S<[ B<-pna> ] [ B<-F>I<pattern> ] [ B<-l>[I<octal>] ] [ B<-0>[I<octal/hexadecimal>] ]>
S<[ B<-I>I<dir> ] [ B<-m>[B<->]I<module> ] [ B<-M>[B<->]I<'module...'> ] [ B<-f> ]>
S<[ B<-C [I<number/list>] >]>
- S<[ B<-P> ]>
S<[ B<-S> ]>
S<[ B<-x>[I<dir>] ]>
S<[ B<-i>[I<extension>] ]>
(F) The unpack format P must have an explicit size, not "*".
-=item B<-P> not allowed for setuid/setgid script
-
-(F) The script would have to be opened by the C preprocessor by name,
-which provides a race condition that breaks security.
-
=item POSIX class [:%s:] unknown in regex; marked by <-- HERE in m/%s/
(F) The class in the character class [: :] syntax is unknown. The <-- HERE
modules, a source filter is invoked with a use statement.
Say you want to pass your Perl source through the C preprocessor before
-execution. You could use the existing C<-P> command line option to do
-this, but as it happens, the source filters distribution comes with a C
-preprocessor filter module called Filter::cpp. Let's use that instead.
+execution. As it happens, the source filters distribution comes with a C
+preprocessor filter module called Filter::cpp.
Below is an example program, C<cpp_test>, which makes use of this filter.
Line numbers have been added to allow specific lines to be referenced
S<[ B<-pna> ] [ B<-F>I<pattern> ] [ B<-l>[I<octal>] ] [ B<-0>[I<octal/hexadecimal>] ]>
S<[ B<-I>I<dir> ] [ B<-m>[B<->]I<module> ] [ B<-M>[B<->]I<'module...'> ] [ B<-f> ]>
S<[ B<-C [I<number/list>] >]>
- S<[ B<-P> ]>
S<[ B<-S> ]>
S<[ B<-x>[I<dir>] ]>
S<[ B<-i>[I<extension>] ]>
8 t Trace execution
16 o Method and overloading resolution
32 c String/numeric conversions
- 64 P Print profiling info, preprocessor command for -P, source file input state
+ 64 P Print profiling info, source file input state
128 m Memory allocation
256 f Format processing
512 r Regular expression parsing and execution
X<-I> X<@INC>
Directories specified by B<-I> are prepended to the search path for
-modules (C<@INC>), and also tells the C preprocessor where to search for
-include files. The C preprocessor is invoked with B<-P>; by default it
-searches /usr/include and /usr/lib/perl.
+modules (C<@INC>).
=item B<-l>[I<octnum>]
X<-l> X<$/> X<$\>
C<BEGIN> and C<END> blocks may be used to capture control before or after
the implicit loop, just as in B<awk>.
-=item B<-P>
-X<-P>
-
-B<NOTE: Use of -P is strongly discouraged because of its inherent
-problems, including poor portability. It is deprecated and will be
-removed in a future version of Perl.>
-
-This option causes your program to be run through the C preprocessor before
-compilation by Perl. Because both comments and B<cpp> directives begin
-with the # character, you should avoid starting comments with any words
-recognized by the C preprocessor such as C<"if">, C<"else">, or C<"define">.
-
-If you're considering using C<-P>, you might also want to look at the
-Filter::cpp module from CPAN.
-
-The problems of -P include, but are not limited to:
-
-=over 10
-
-=item *
-
-The C<#!> line is stripped, so any switches there don't apply.
-
-=item *
-
-A C<-P> on a C<#!> line doesn't work.
-
-=item *
-
-B<All> lines that begin with (whitespace and) a C<#> but
-do not look like cpp commands, are stripped, including anything
-inside Perl strings, regular expressions, and here-docs .
-
-=item *
-
-In some platforms the C preprocessor knows too much: it knows about
-the C++ -style until-end-of-line comments starting with C<"//">.
-This will cause problems with common Perl constructs like
-
- s/foo//;
-
-because after -P this will became illegal code
-
- s/foo
-
-The workaround is to use some other quoting separator than C<"/">,
-like for example C<"!">:
-
- s!foo!!;
-
-
-
-=item *
-
-It requires not only a working C preprocessor but also a working
-F<sed>. If not on UNIX, you are probably out of luck on this.
-
-=item *
-
-Script line numbers are not preserved.
-
-=item *
-
-The C<-x> does not work with C<-P>.
-
-=back
-
=item B<-s>
X<-s>
PL_patchlevel = sv_dup_inc(proto_perl->Ipatchlevel, param);
PL_localpatches = proto_perl->Ilocalpatches;
PL_splitstr = proto_perl->Isplitstr;
- PL_preprocess = proto_perl->Ipreprocess;
PL_minus_n = proto_perl->Iminus_n;
PL_minus_p = proto_perl->Iminus_p;
PL_minus_l = proto_perl->Iminus_l;
+++ /dev/null
-#!./perl -l
-
-# There's a bug in -P where the #! line is ignored. If this test
-# suddenly starts printing blank lines that bug has been fixed.
-
-print "1..3\n";
-
-#define MESS "ok 1\n"
-print MESS;
-
-#ifdef MESS
- print "ok 2\n";
-#else
- print "not ok 2\n";
-#endif
-
-open(TRY,">Comp_cpp.tmp") || die "Can't open temp perl file: $!";
-
-($prog = <<'END') =~ s/X//g;
-X$ok = "not ok 3\n";
-X#include "Comp_cpp.inc"
-X#ifdef OK
-X$ok = OK;
-X#endif
-Xprint $ok;
-END
-print TRY $prog;
-close TRY or die "Could not close Comp_cpp.tmp: $!";
-
-open(TRY,">Comp_cpp.inc") || (die "Can't open temp include file: $!");
-print TRY '#define OK "ok 3\n"' . "\n";
-close TRY or die "Could not close Comp_cpp.tmp: $!";
-
-print `$^X "-P" Comp_cpp.tmp`;
-unlink "Comp_cpp.tmp", "Comp_cpp.inc";
+++ /dev/null
-#!./perl
-
-BEGIN {
- chdir 't' if -d 't';
- @INC = '../lib';
- $ENV{PERL5LIB} = '../lib';
-}
-
-use Config;
-if ( $^O eq 'MacOS' ||
- ($Config{'cppstdin'} =~ /\bcppstdin\b/) &&
- ! -x $Config{'binexp'} . "/cppstdin" ) {
- print "1..0 # Skip: \$Config{cppstdin} unavailable\n";
- exit; # Cannot test till after install, alas.
-}
-
-system qq{$^X -"P" "comp/cpp.aux"};
+++ /dev/null
-Some stuff that's not Perl
-
-This CPP directive should not be read.
-#define BARMAR 1
-
-#perl
-
-Still not perl.
-
-#!
-
-still not perl
-
-#!/something/else
-
-still not perl
-
-#!/some/path/that/leads/to/perl -l
-
-# The -l switch should be applied from the #! line.
-# Unfortunately, -P has a bug whereby the #! line is ignored.
-# If this test suddenly starts printing blank lines that bug is fixed.
-
-#define FOO "ok 1\n"
-
-#ifdef BARMAR
-# define YAR "not ok 2\n"
-#else
-# define YAR "ok 2\n"
-#endif
-
-print "1..2\n";
-print FOO;
-print YAR;
+++ /dev/null
-#!./perl
-
-# Ensure that the -P and -x flags work together.
-
-BEGIN {
- chdir 't' if -d 't';
- @INC = '../lib';
- $ENV{PERL5LIB} = '../lib';
-
- use Config;
- if ( $^O eq 'MacOS' || ($Config{'cppstdin'} =~ /\bcppstdin\b/) &&
- ! -x $Config{'binexp'} . "/cppstdin" ) {
- print "1..0 # Skip: \$Config{cppstdin} unavailable\n";
- exit; # Cannot test till after install, alas.
- }
-}
-
-require './test.pl';
-
-print runperl( switches => ['-Px'],
- nolib => 1, # for some reason this is necessary under VMS
- progfile => 'run/switchPx.aux' );
PL_bufend = SvPVX(PL_linestr) + SvCUR(PL_linestr);
PL_last_lop = PL_last_uni = NULL;
- /* Close the filehandle. Could be from -P preprocessor,
+ /* 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);
PL_realtokenstart = -1;
#endif
if (PL_rsfp) {
- 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);
# endif
# endif
#endif
-#ifdef FTELL_FOR_PIPE_IS_BROKEN
- /* This loses the possibility to detect the bof
- * situation on perl -P when the libc5 is being used.
- * Workaround? Maybe attach some extra state to PL_rsfp?
- */
- if (!PL_preprocess)
- bof = PerlIO_tell(PL_rsfp) == SvCUR(PL_linestr);
-#else
bof = PerlIO_tell(PL_rsfp) == (Off_t)SvCUR(PL_linestr);
-#endif
if (bof) {
PL_bufend = SvPVX(PL_linestr) + SvCUR(PL_linestr);
s = swallow_bom((U8*)s);
#endif
/* Mark this internal pseudo-handle as clean */
IoFLAGS(GvIOp(gv)) |= IOf_UNTAINT;
- if (PL_preprocess)
- IoTYPE(GvIOp(gv)) = IoTYPE_PIPE;
- else if ((PerlIO*)PL_rsfp == PerlIO_stdin())
+ if ((PerlIO*)PL_rsfp == PerlIO_stdin())
IoTYPE(GvIOp(gv)) = IoTYPE_STD;
else
IoTYPE(GvIOp(gv)) = IoTYPE_RDONLY;