This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perlop: #109408
[perl5.git] / regen / feature.pl
CommitLineData
69bcf1d3
FC
1#!/usr/bin/perl
2#
3# Regenerate (overwriting only if changed):
4#
5# lib/feature.pm
f2c01b15 6# feature.h
69bcf1d3 7#
3489ea76 8# from information hardcoded into this script and from two #defines
d73d634c 9# in perl.h.
69bcf1d3
FC
10#
11# This script is normally invoked from regen.pl.
12
13BEGIN {
14 require 'regen/regen_lib.pl';
15 push @INC, './lib';
16}
17use strict ;
18
c452a42f
FC
19
20###########################################################################
21# Hand-editable data
22
c6b36e45 23# (feature name) => (internal name, used in %^H and macro names)
69bcf1d3 24my %feature = (
67bdaa9e
FC
25 say => 'say',
26 state => 'state',
27 switch => 'switch',
28 evalbytes => 'evalbytes',
3fff3427 29 array_base => 'arybase',
67bdaa9e
FC
30 current_sub => '__SUB__',
31 unicode_eval => 'unieval',
32 unicode_strings => 'unicode',
2a4315f8 33 fc => 'fc',
69bcf1d3
FC
34);
35
40e4d872
FC
36# NOTE: If a feature is ever enabled in a non-contiguous range of Perl
37# versions, any code below that uses %BundleRanges will have to
38# be changed to account.
39
52fc5c56 40# 5.odd implies the next 5.even, but an explicit 5.even can override it.
69bcf1d3 41my %feature_bundle = (
39ec54a5 42 all => [ keys %feature ],
3fff3427 43 default => [qw(array_base)],
69bcf1d3
FC
44 "5.9.5" => [qw(say state switch array_base)],
45 "5.10" => [qw(say state switch array_base)],
46 "5.11" => [qw(say state switch unicode_strings array_base)],
69bcf1d3 47 "5.13" => [qw(say state switch unicode_strings array_base)],
69bcf1d3 48 "5.15" => [qw(say state switch unicode_strings unicode_eval
2a4315f8 49 evalbytes current_sub fc)],
d6402ebe
RS
50 "5.17" => [qw(say state switch unicode_strings unicode_eval
51 evalbytes current_sub fc)],
69bcf1d3
FC
52);
53
c452a42f 54
69bcf1d3 55###########################################################################
c452a42f 56# More data generated from the above
69bcf1d3 57
52fc5c56
FC
58for (keys %feature_bundle) {
59 next unless /^5\.(\d*[13579])\z/;
60 $feature_bundle{"5.".($1+1)} ||= $feature_bundle{$_};
61}
62
f2c01b15
FC
63my %UniqueBundles; # "say state switch" => 5.10
64my %Aliases; # 5.12 => 5.11
65for( sort keys %feature_bundle ) {
66 my $value = join(' ', sort @{$feature_bundle{$_}});
67 if (exists $UniqueBundles{$value}) {
68 $Aliases{$_} = $UniqueBundles{$value};
69 }
70 else {
71 $UniqueBundles{$value} = $_;
72 }
73}
40e4d872
FC
74 # start end
75my %BundleRanges; # say => ['5.10', '5.15'] # unique bundles for values
76for my $bund (
77 sort { $a eq 'default' ? -1 : $b eq 'default' ? 1 : $a cmp $b }
78 values %UniqueBundles
79) {
03222170 80 next if $bund =~ /[^\d.]/ and $bund ne 'default';
40e4d872
FC
81 for (@{$feature_bundle{$bund}}) {
82 if (@{$BundleRanges{$_} ||= []} == 2) {
83 $BundleRanges{$_}[1] = $bund
84 }
85 else {
86 push @{$BundleRanges{$_}}, $bund;
87 }
88 }
89}
69bcf1d3 90
47222a2d 91my $HintShift;
ada44f8c 92my $HintMask;
3489ea76 93my $Uni8Bit;
47222a2d
FC
94
95open "perl.h", "perl.h" or die "$0 cannot open perl.h: $!";
3489ea76
FC
96while (readline "perl.h") {
97 next unless /#\s*define\s+(HINT_FEATURE_MASK|HINT_UNI_8_BIT)/;
98 my $is_u8b = $1 =~ 8;
99 /(0x[A-Fa-f0-9]+)/ or die "No hex number in:\n\n$_\n ";
100 if ($is_u8b) {
101 $Uni8Bit = $1;
102 }
103 else {
ada44f8c 104 my $hex = $HintMask = $1;
47222a2d
FC
105 my $bits = sprintf "%b", oct $1;
106 $bits =~ /^0*1+(0*)\z/
107 or die "Non-contiguous bits in $bits (binary for $hex):\n\n$_\n ";
108 $HintShift = length $1;
109 my $bits_needed =
110 length sprintf "%b", scalar keys %UniqueBundles;
111 $bits =~ /1{$bits_needed}/
112 or die "Not enough bits (need $bits_needed)"
5d826eae 113 . " in $bits (binary for $hex):\n\n$_\n ";
47222a2d 114 }
3489ea76 115 if ($Uni8Bit && $HintMask) { last }
47222a2d 116}
3489ea76
FC
117die "No HINT_FEATURE_MASK defined in perl.h" unless $HintMask;
118die "No HINT_UNI_8_BIT defined in perl.h" unless $Uni8Bit;
119
47222a2d
FC
120close "perl.h";
121
ada44f8c
FC
122my @HintedBundles =
123 ('default', grep !/[^\d.]/, sort values %UniqueBundles);
124
47222a2d 125
f2c01b15 126###########################################################################
c452a42f 127# Open files to be generated
f2c01b15
FC
128
129my ($pm, $h) = map {
69bcf1d3 130 open_new($_, '>', { by => 'regen/feature.pl' });
f2c01b15 131} 'lib/feature.pm', 'feature.h';
69bcf1d3
FC
132
133
c452a42f
FC
134###########################################################################
135# Generate lib/feature.pm
136
69bcf1d3
FC
137while (<DATA>) {
138 last if /^FEATURES$/ ;
139 print $pm $_ ;
140}
141
142sub longest {
143 my $long;
144 for(@_) {
145 if (!defined $long or length $long < length) {
146 $long = $_;
147 }
148 }
149 $long;
150}
151
0bb01b05 152print $pm "our %feature = (\n";
69bcf1d3
FC
153my $width = length longest keys %feature;
154for(sort { length $a <=> length $b } keys %feature) {
67bdaa9e
FC
155 print $pm " $_" . " "x($width-length)
156 . " => 'feature_$feature{$_}',\n";
69bcf1d3
FC
157}
158print $pm ");\n\n";
159
69bcf1d3 160print $pm "our %feature_bundle = (\n";
88da30d7
FC
161$width = length longest values %UniqueBundles;
162for( sort { $UniqueBundles{$a} cmp $UniqueBundles{$b} }
163 keys %UniqueBundles ) {
164 my $bund = $UniqueBundles{$_};
165 print $pm qq' "$bund"' . " "x($width-length $bund)
166 . qq' => [qw($_)],\n';
69bcf1d3
FC
167}
168print $pm ");\n\n";
169
88da30d7
FC
170for (sort keys %Aliases) {
171 print $pm
172 qq'\$feature_bundle{"$_"} = \$feature_bundle{"$Aliases{$_}"};\n';
173};
69bcf1d3 174
ada44f8c
FC
175print $pm <<EOPM;
176
0bb01b05
FC
177our \$hint_shift = $HintShift;
178our \$hint_mask = $HintMask;
179our \@hint_bundles = qw( @HintedBundles );
3489ea76
FC
180
181# This gets set (for now) in \$^H as well as in %^H,
182# for runtime speed of the uc/lc/ucfirst/lcfirst functions.
183# See HINT_UNI_8_BIT in perl.h.
184our \$hint_uni8bit = $Uni8Bit;
ada44f8c
FC
185EOPM
186
69bcf1d3
FC
187
188while (<DATA>) {
2b3fe414
FC
189 last if /^PODTURES$/ ;
190 print $pm $_ ;
191}
192
193select +(select($pm), $~ = 'PODTURES')[0];
194format PODTURES =
195 ^<<<<<<<< ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<~~
196$::bundle, $::feature
197.
198
199for ('default', sort grep /\.\d[02468]/, keys %feature_bundle) {
200 $::bundle = ":$_";
201 $::feature = join ' ', @{$feature_bundle{$_}};
202 write $pm;
203 print $pm "\n";
204}
205
206while (<DATA>) {
69bcf1d3
FC
207 print $pm $_ ;
208}
209
210read_only_bottom_close_and_rename($pm);
211
c452a42f
FC
212
213###########################################################################
214# Generate feature.h
215
f2c01b15
FC
216print $h <<EOH;
217
218#if defined(PERL_CORE) || defined (PERL_EXT)
219
220#define HINT_FEATURE_SHIFT $HintShift
221
f2c01b15
FC
222EOH
223
224my $count;
016d11cb
FC
225for (@HintedBundles) {
226 (my $key = uc) =~ y/.//d;
227 print $h "#define FEATURE_BUNDLE_$key ", $count++, "\n";
f2c01b15
FC
228}
229
7d058bc9 230print $h <<'EOH';
2b9e0ab7 231#define FEATURE_BUNDLE_CUSTOM (HINT_FEATURE_MASK >> HINT_FEATURE_SHIFT)
f2c01b15 232
7d058bc9 233#define CURRENT_HINTS \
d1fd0100 234 (PL_curcop == &PL_compiling ? PL_hints : PL_curcop->cop_hints)
035b6821
FC
235#define CURRENT_FEATURE_BUNDLE \
236 ((CURRENT_HINTS & HINT_FEATURE_MASK) >> HINT_FEATURE_SHIFT)
d1fd0100 237
fc4b5f72
NC
238/* Avoid using ... && Perl_feature_is_enabled(...) as that triggers a bug in
239 the HP-UX cc on PA-RISC */
7d058bc9 240#define FEATURE_IS_ENABLED(name) \
ef744b29 241 ((CURRENT_HINTS \
7d058bc9 242 & HINT_LOCALIZE_HH) \
fc4b5f72 243 ? Perl_feature_is_enabled(aTHX_ STR_WITH_LEN(name)) : FALSE)
7d058bc9 244/* The longest string we pass in. */
03222170
FC
245EOH
246
1b6e8741
FC
247my $longest_internal_feature_name = longest values %feature;
248print $h <<EOL;
249#define MAX_FEATURE_LEN (sizeof("$longest_internal_feature_name")-1)
250
251EOL
252
03222170 253for (
3fff3427 254 sort { length $a <=> length $b } keys %feature
03222170
FC
255) {
256 my($first,$last) =
257 map { (my $__ = uc) =~ y/.//d; $__ } @{$BundleRanges{$_}};
3fff3427 258 my $name = $feature{$_};
03222170 259 my $NAME = uc $name;
beda0318
FC
260 if ($last && $first eq 'DEFAULT') { # ‘>= DEFAULT’ warns
261 print $h <<EOI;
262#define FEATURE_$NAME\_IS_ENABLED \\
263 ( \\
264 CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_$last \\
265 || (CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \\
3fff3427 266 FEATURE_IS_ENABLED("$name")) \\
beda0318
FC
267 )
268
269EOI
270 }
271 elsif ($last) {
03222170
FC
272 print $h <<EOH3;
273#define FEATURE_$NAME\_IS_ENABLED \\
274 ( \\
275 (CURRENT_FEATURE_BUNDLE >= FEATURE_BUNDLE_$first && \\
276 CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_$last) \\
277 || (CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \\
3fff3427 278 FEATURE_IS_ENABLED("$name")) \\
03222170
FC
279 )
280
281EOH3
282 }
283 else {
284 print $h <<EOH4;
285#define FEATURE_$NAME\_IS_ENABLED \\
286 ( \\
287 CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_$first \\
288 || (CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \\
3fff3427 289 FEATURE_IS_ENABLED("$name")) \\
03222170
FC
290 )
291
292EOH4
293 }
294}
295
296print $h <<EOH;
297
f2c01b15 298#endif /* PERL_CORE or PERL_EXT */
4160ddbd
FC
299
300#ifdef PERL_IN_OP_C
301PERL_STATIC_INLINE void
302S_enable_feature_bundle(pTHX_ SV *ver)
303{
304 SV *comp_ver = sv_newmortal();
305 PL_hints = (PL_hints &~ HINT_FEATURE_MASK)
306 | (
f2c01b15
FC
307EOH
308
4160ddbd
FC
309for (reverse @HintedBundles[1..$#HintedBundles]) { # skip default
310 my $numver = $_;
311 if ($numver eq '5.10') { $numver = '5.009005' } # special case
312 else { $numver =~ s/\./.0/ } # 5.11 => 5.011
313 (my $macrover = $_) =~ y/.//d;
314 print $h <<" EOK";
315 (sv_setnv(comp_ver, $numver),
316 vcmp(ver, upg_version(comp_ver, FALSE)) >= 0)
317 ? FEATURE_BUNDLE_$macrover :
318 EOK
319}
320
321print $h <<EOJ;
322 FEATURE_BUNDLE_DEFAULT
323 ) << HINT_FEATURE_SHIFT;
6389c777
FC
324 /* special case */
325 assert(PL_curcop == &PL_compiling);
326 if (FEATURE_UNICODE_IS_ENABLED) PL_hints |= HINT_UNI_8_BIT;
327 else PL_hints &= ~HINT_UNI_8_BIT;
4160ddbd
FC
328}
329#endif /* PERL_IN_OP_C */
330EOJ
331
f2c01b15
FC
332read_only_bottom_close_and_rename($h);
333
c452a42f
FC
334
335###########################################################################
336# Template for feature.pm
337
69bcf1d3
FC
338__END__
339package feature;
340
2269d15c 341our $VERSION = '1.29';
69bcf1d3
FC
342
343FEATURES
344
69bcf1d3
FC
345# TODO:
346# - think about versioned features (use feature switch => 2)
347
348=head1 NAME
349
350feature - Perl pragma to enable new features
351
352=head1 SYNOPSIS
353
354 use feature qw(say switch);
355 given ($foo) {
356 when (1) { say "\$foo == 1" }
357 when ([2,3]) { say "\$foo == 2 || \$foo == 3" }
358 when (/^a[bc]d$/) { say "\$foo eq 'abd' || \$foo eq 'acd'" }
359 when ($_ > 100) { say "\$foo > 100" }
360 default { say "None of the above" }
361 }
362
363 use feature ':5.10'; # loads all features available in perl 5.10
364
365 use v5.10; # implicitly loads :5.10 feature bundle
366
367=head1 DESCRIPTION
368
369It is usually impossible to add new syntax to Perl without breaking
370some existing programs. This pragma provides a way to minimize that
371risk. New syntactic constructs, or new semantic meanings to older
372constructs, can be enabled by C<use feature 'foo'>, and will be parsed
373only when the appropriate feature pragma is in scope. (Nevertheless, the
374C<CORE::> prefix provides access to all Perl keywords, regardless of this
375pragma.)
376
377=head2 Lexical effect
378
379Like other pragmas (C<use strict>, for example), features have a lexical
380effect. C<use feature qw(foo)> will only make the feature "foo" available
381from that point to the end of the enclosing block.
382
383 {
384 use feature 'say';
385 say "say is available here";
386 }
387 print "But not here.\n";
388
389=head2 C<no feature>
390
391Features can also be turned off by using C<no feature "foo">. This too
392has lexical effect.
393
394 use feature 'say';
395 say "say is available here";
396 {
397 no feature 'say';
398 print "But not here.\n";
399 }
400 say "Yet it is here.";
401
39ec54a5
RS
402C<no feature> with no features specified will reset to the default group. To
403disable I<all> features (an unusual request!) use C<no feature ':all'>.
69bcf1d3
FC
404
405=head1 AVAILABLE FEATURES
406
407=head2 The 'say' feature
408
409C<use feature 'say'> tells the compiler to enable the Perl 6 style
410C<say> function.
411
412See L<perlfunc/say> for details.
413
414This feature is available starting with Perl 5.10.
415
416=head2 The 'state' feature
417
418C<use feature 'state'> tells the compiler to enable C<state>
419variables.
420
421See L<perlsub/"Persistent Private Variables"> for details.
422
423This feature is available starting with Perl 5.10.
424
425=head2 The 'switch' feature
426
427C<use feature 'switch'> tells the compiler to enable the Perl 6
428given/when construct.
429
48238296 430See L<perlsyn/"Switch Statements"> for details.
69bcf1d3
FC
431
432This feature is available starting with Perl 5.10.
433
434=head2 The 'unicode_strings' feature
435
436C<use feature 'unicode_strings'> tells the compiler to use Unicode semantics
437in all string operations executed within its scope (unless they are also
438within the scope of either C<use locale> or C<use bytes>). The same applies
439to all regular expressions compiled within the scope, even if executed outside
2269d15c
KW
440it. It does not change the internal representation of strings, but only how
441they are interpreted.
69bcf1d3
FC
442
443C<no feature 'unicode_strings'> tells the compiler to use the traditional
444Perl semantics wherein the native character set semantics is used unless it is
445clear to Perl that Unicode is desired. This can lead to some surprises
446when the behavior suddenly changes. (See
447L<perlunicode/The "Unicode Bug"> for details.) For this reason, if you are
448potentially using Unicode in your program, the
449C<use feature 'unicode_strings'> subpragma is B<strongly> recommended.
450
2e2b2571
KW
451This feature is available starting with Perl 5.12; was almost fully
452implemented in Perl 5.14; and extended in Perl 5.16 to cover C<quotemeta>.
69bcf1d3
FC
453
454=head2 The 'unicode_eval' and 'evalbytes' features
455
456Under the C<unicode_eval> feature, Perl's C<eval> function, when passed a
457string, will evaluate it as a string of characters, ignoring any
458C<use utf8> declarations. C<use utf8> exists to declare the encoding of
459the script, which only makes sense for a stream of bytes, not a string of
460characters. Source filters are forbidden, as they also really only make
461sense on strings of bytes. Any attempt to activate a source filter will
462result in an error.
463
464The C<evalbytes> feature enables the C<evalbytes> keyword, which evaluates
465the argument passed to it as a string of bytes. It dies if the string
466contains any characters outside the 8-bit range. Source filters work
467within C<evalbytes>: they apply to the contents of the string being
468evaluated.
469
470Together, these two features are intended to replace the historical C<eval>
471function, which has (at least) two bugs in it, that cannot easily be fixed
472without breaking existing programs:
473
474=over
475
476=item *
477
478C<eval> behaves differently depending on the internal encoding of the
479string, sometimes treating its argument as a string of bytes, and sometimes
480as a string of characters.
481
482=item *
483
484Source filters activated within C<eval> leak out into whichever I<file>
485scope is currently being compiled. To give an example with the CPAN module
486L<Semi::Semicolons>:
487
488 BEGIN { eval "use Semi::Semicolons; # not filtered here " }
489 # filtered here!
490
491C<evalbytes> fixes that to work the way one would expect:
492
493 use feature "evalbytes";
494 BEGIN { evalbytes "use Semi::Semicolons; # filtered " }
495 # not filtered
496
497=back
498
499These two features are available starting with Perl 5.16.
500
501=head2 The 'current_sub' feature
502
503This provides the C<__SUB__> token that returns a reference to the current
504subroutine or C<undef> outside of a subroutine.
505
506This feature is available starting with Perl 5.16.
507
508=head2 The 'array_base' feature
509
510This feature supports the legacy C<$[> variable. See L<perlvar/$[> and
511L<arybase>. It is on by default but disabled under C<use v5.16> (see
512L</IMPLICIT LOADING>, below).
513
514This feature is available under this name starting with Perl 5.16. In
515previous versions, it was simply on all the time, and this pragma knew
516nothing about it.
517
2a4315f8
BF
518=head2 The 'fc' feature
519
520C<use feature 'fc'> tells the compiler to enable the C<fc> function,
521which implements Unicode casefolding.
522
523See L<perlfunc/fc> for details.
524
525This feature is available from Perl 5.16 onwards.
526
69bcf1d3
FC
527=head1 FEATURE BUNDLES
528
529It's possible to load multiple features together, using
530a I<feature bundle>. The name of a feature bundle is prefixed with
531a colon, to distinguish it from an actual feature.
532
533 use feature ":5.10";
534
535The following feature bundles are available:
536
537 bundle features included
538 --------- -----------------
2b3fe414 539PODTURES
69bcf1d3
FC
540The C<:default> bundle represents the feature set that is enabled before
541any C<use feature> or C<no feature> declaration.
542
543Specifying sub-versions such as the C<0> in C<5.14.0> in feature bundles has
544no effect. Feature bundles are guaranteed to be the same for all sub-versions.
545
546 use feature ":5.14.0"; # same as ":5.14"
547 use feature ":5.14.1"; # same as ":5.14"
548
549=head1 IMPLICIT LOADING
550
551Instead of loading feature bundles by name, it is easier to let Perl do
552implicit loading of a feature bundle for you.
553
554There are two ways to load the C<feature> pragma implicitly:
555
556=over 4
557
558=item *
559
560By using the C<-E> switch on the Perl command-line instead of C<-e>.
561That will enable the feature bundle for that version of Perl in the
562main compilation unit (that is, the one-liner that follows C<-E>).
563
564=item *
565
566By explicitly requiring a minimum Perl version number for your program, with
567the C<use VERSION> construct. That is,
568
569 use v5.10.0;
570
571will do an implicit
572
39ec54a5 573 no feature ':all';
69bcf1d3
FC
574 use feature ':5.10';
575
576and so on. Note how the trailing sub-version
577is automatically stripped from the
578version.
579
580But to avoid portability warnings (see L<perlfunc/use>), you may prefer:
581
582 use 5.010;
583
584with the same effect.
585
586If the required version is older than Perl 5.10, the ":default" feature
587bundle is automatically loaded instead.
588
589=back
590
591=cut
592
593sub import {
594 my $class = shift;
36143a0c
NC
595
596 if (!@_) {
69bcf1d3
FC
597 croak("No features specified");
598 }
36143a0c 599
d3757264 600 __common(1, @_);
69bcf1d3
FC
601}
602
603sub unimport {
604 my $class = shift;
605
39ec54a5 606 # A bare C<no feature> should reset to the default bundle
69bcf1d3 607 if (!@_) {
39ec54a5
RS
608 $^H &= ~($hint_uni8bit|$hint_mask);
609 return;
69bcf1d3
FC
610 }
611
d3757264
NC
612 __common(0, @_);
613}
614
615
616sub __common {
617 my $import = shift;
0c8d5017
NC
618 my $bundle_number = $^H & $hint_mask;
619 my $features = $bundle_number != $hint_mask
620 && $feature_bundle{$hint_bundles[$bundle_number >> $hint_shift]};
621 if ($features) {
da5b5421 622 # Features are enabled implicitly via bundle hints.
d9ee6ccb
NC
623 # Delete any keys that may be left over from last time.
624 delete @^H{ values(%feature) };
625 $^H |= $hint_mask;
626 for (@$features) {
627 $^H{$feature{$_}} = 1;
628 $^H |= $hint_uni8bit if $_ eq 'unicode_strings';
629 }
da5b5421 630 }
69bcf1d3
FC
631 while (@_) {
632 my $name = shift;
633 if (substr($name, 0, 1) eq ":") {
634 my $v = substr($name, 1);
635 if (!exists $feature_bundle{$v}) {
636 $v =~ s/^([0-9]+)\.([0-9]+).[0-9]+$/$1.$2/;
637 if (!exists $feature_bundle{$v}) {
638 unknown_feature_bundle(substr($name, 1));
639 }
640 }
641 unshift @_, @{$feature_bundle{$v}};
642 next;
643 }
36143a0c 644 if (!exists $feature{$name}) {
69bcf1d3 645 unknown_feature($name);
69bcf1d3 646 }
d3757264
NC
647 if ($import) {
648 $^H{$feature{$name}} = 1;
649 $^H |= $hint_uni8bit if $name eq 'unicode_strings';
650 } else {
69bcf1d3
FC
651 delete $^H{$feature{$name}};
652 $^H &= ~ $hint_uni8bit if $name eq 'unicode_strings';
653 }
654 }
655}
656
657sub unknown_feature {
658 my $feature = shift;
659 croak(sprintf('Feature "%s" is not supported by Perl %vd',
660 $feature, $^V));
661}
662
663sub unknown_feature_bundle {
664 my $feature = shift;
665 croak(sprintf('Feature bundle "%s" is not supported by Perl %vd',
666 $feature, $^V));
667}
668
669sub croak {
670 require Carp;
671 Carp::croak(@_);
672}
673
6741;