Skip to content

Commit

Permalink
perl -E should enable corresponding builtin version bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
leonerd committed Jan 19, 2024
1 parent 3ce45d2 commit ee45726
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pod/perlrun.pod
Original file line number Diff line number Diff line change
Expand Up @@ -470,8 +470,8 @@ to use semicolons where you would in a normal program.
X<-E>

behaves just like L<-e|/-e commandline>, except that it implicitly
enables all optional features (in the main compilation unit). See
L<feature>.
enables all optional features and builtin functions (in the main
compilation unit). See L<feature> and L<builtin>.

=item B<-f>
X<-f> X<sitecustomize> X<sitecustomize.pl>
Expand Down
7 changes: 6 additions & 1 deletion t/run/switches.t
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,12 @@ $TODO = ''; # the -E tests work on VMS
$r = runperl(
switches => [ '-E', '"say q(Hello, world!)"']
);
is( $r, "Hello, world!\n", "-E say" );
is( $r, "Hello, world!\n", "-E enables 'say' feature" );

$r = runperl(
switches => [ '-E', '"say reftype []"']
);
is( $r, "ARRAY\n", "-E enables 'reftype' builtin" );

$r = runperl(
switches => [ '-nE', q("} END { say q/affe/") ],
Expand Down
3 changes: 2 additions & 1 deletion toke.c
Original file line number Diff line number Diff line change
Expand Up @@ -9240,7 +9240,8 @@ yyl_try(pTHX_ char *s)
}
if (PL_minus_E)
sv_catpvs(PL_linestr,
"use feature ':" STRINGIFY(PERL_REVISION) "." STRINGIFY(PERL_VERSION) "';");
"use feature ':" STRINGIFY(PERL_REVISION) "." STRINGIFY(PERL_VERSION) "'; "
"use builtin ':" STRINGIFY(PERL_REVISION) "." STRINGIFY(PERL_VERSION) "';");
if (PL_minus_n || PL_minus_p) {
sv_catpvs(PL_linestr, "LINE: while (<>) {"/*}*/);
if (PL_minus_l)
Expand Down

0 comments on commit ee45726

Please sign in to comment.