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