perl

 view release on metacpan or  search on metacpan

lib/B/Deparse.t  view on Meta::CPAN

# SKIP ?$] < 5.010 && "say not implemented on this Perl version"
# CONTEXT use 5.10.0;
# say in the context of use 5.10.0
say 'foo';
####
# SKIP ?$] < 5.010 && "say not implemented on this Perl version"
# say with use 5.10.0
use 5.10.0;
say 'foo';
>>>>
no feature ':all';
use feature ':5.10';
say 'foo';
####
# SKIP ?$] < 5.010 && "say not implemented on this Perl version"
# say with use feature ':5.10';
use feature ':5.10';
say 'foo';
>>>>
use feature 'say', 'state', 'switch';
say 'foo';
####
# SKIP ?$] < 5.010 && "say not implemented on this Perl version"
# CONTEXT use feature ':5.10';
# say with use 5.10.0 in the context of use feature
use 5.10.0;
say 'foo';
>>>>
no feature ':all';
use feature ':5.10';
say 'foo';
####
# SKIP ?$] < 5.010 && "say not implemented on this Perl version"
# CONTEXT use 5.10.0;
# say with use feature ':5.10' in the context of use 5.10.0
use feature ':5.10';
say 'foo';
>>>>
say 'foo';

lib/B/Deparse.t  view on Meta::CPAN

# SKIP ?$] < 5.015 && "__SUB__ not implemented on this Perl version"
# CONTEXT use 5.15.0;
# __SUB__ in the context of use 5.15.0
__SUB__;
####
# SKIP ?$] < 5.015 && "__SUB__ not implemented on this Perl version"
# __SUB__ with use 5.15.0
use 5.15.0;
__SUB__;
>>>>
no feature ':all';
use feature ':5.16';
__SUB__;
####
# SKIP ?$] < 5.015 && "__SUB__ not implemented on this Perl version"
# __SUB__ with use feature ':5.15';
use feature ':5.15';
__SUB__;
>>>>
use feature 'current_sub', 'evalbytes', 'fc', 'say', 'state', 'switch', 'unicode_strings', 'unicode_eval';
__SUB__;
####
# SKIP ?$] < 5.015 && "__SUB__ not implemented on this Perl version"
# CONTEXT use feature ':5.15';
# __SUB__ with use 5.15.0 in the context of use feature
use 5.15.0;
__SUB__;
>>>>
no feature ':all';
use feature ':5.16';
__SUB__;
####
# SKIP ?$] < 5.015 && "__SUB__ not implemented on this Perl version"
# CONTEXT use 5.15.0;
# __SUB__ with use feature ':5.15' in the context of use 5.15.0
use feature ':5.15';
__SUB__;
>>>>
__SUB__;

lib/B/Deparse.t  view on Meta::CPAN

{
    use feature 'unicode_strings';
    print /a/d, s/b/c/d;
}
{
    BEGIN { $^H{'reflags'}         = '0';
	    $^H{'reflags_charset'} = '2'; }
    print /a/d, s/b/c/d;
}
{
    no feature ':all';
    use feature ':5.12';
    print /a/d, s/b/c/d;
}
####
# all the flags (qr//)
$_ = qr/X/m;
$_ = qr/X/s;
$_ = qr/X/i;
$_ = qr/X/x;
$_ = qr/X/p;

lib/B/Deparse.t  view on Meta::CPAN

    CORE::when (3) {
        continue;
    }
    CORE::default {
        CORE::break;
    }
}
CORE::evalbytes '';
() = CORE::__SUB__;
>>>>
no feature ':all';
use feature ':default';
CORE::say $_;
CORE::state $x;
CORE::given ($x) {
    CORE::when (3) {
        continue;
    }
    CORE::default {
        CORE::break;
    }

lib/B/Deparse.t  view on Meta::CPAN

print;
use 1;
print;
use 5.014;
print;
no feature 'unicode_strings';
print;
>>>>
use feature 'current_sub', 'evalbytes';
print $_;
no feature ':all';
use feature ':default';
print $_;
no feature ':all';
use feature ':5.12';
print $_;
no feature 'unicode_strings';
print $_;
####
# $#- $#+ $#{%} etc.
my @x;
@x = ($#{`}, $#{~}, $#{!}, $#{@}, $#{$}, $#{%}, $#{^}, $#{&}, $#{*});
@x = ($#{(}, $#{)}, $#{[}, $#{{}, $#{]}, $#{}}, $#{'}, $#{"}, $#{,});
@x = ($#{<}, $#{.}, $#{>}, $#{/}, $#{?}, $#{=}, $#+, $#{\}, $#{|}, $#-);

lib/feature.pm  view on Meta::CPAN


    use feature 'say';
    say "say is available here";
    {
        no feature 'say';
        print "But not here.\n";
    }
    say "Yet it is here.";

C<no feature> with no features specified will reset to the default group.  To
disable I<all> features (an unusual request!) use C<no feature ':all'>.

=head1 AVAILABLE FEATURES

Read L</"FEATURE BUNDLES"> for the feature cheat sheet summary.

=head2 The 'say' feature

C<use feature 'say'> tells the compiler to enable the Raku-inspired
C<say> function.

lib/feature.pm  view on Meta::CPAN


  use feature ":5.14.0";    # same as ":5.14"
  use feature ":5.14.1";    # same as ":5.14"

You can also do:

  use feature ":all";

or

  no feature ":all";

but the first may enable features in a later version of Perl that
change the meaning of your code, and the second may disable mechanisms
that are part of Perl's current behavior that have been turned into
features, just as C<indirect> and C<bareword_filehandles> were.

=head1 IMPLICIT LOADING

Instead of loading feature bundles by name, it is easier to let Perl do
implicit loading of a feature bundle for you.

lib/feature.pm  view on Meta::CPAN


=item *

By explicitly requiring a minimum Perl version number for your program, with
the C<use VERSION> construct.  That is,

    use v5.36.0;

will do an implicit

    no feature ':all';
    use feature ':5.36';

and so on.  Note how the trailing sub-version
is automatically stripped from the
version.

But to avoid portability warnings (see L<perlfunc/use>), you may prefer:

    use 5.036;

pod/perl5160delta.pod  view on Meta::CPAN

There is a new ":default" feature bundle that represents the set of
features enabled before any version declaration or C<use feature> has
been seen.  Version declarations below 5.10 now enable the ":default"
feature set.  This does not actually change the behavior of C<use
v5.8>, because features added to the ":default" set are those that were
traditionally enabled by default, before they could be turned off.

C<< no feature >> now resets to the default feature set.  To disable all
features (which is likely to be a pretty special-purpose request, since
it presumably won't match any named set of semantics) you can now  
write C<< no feature ':all' >>.

C<$[> is now disabled under C<use v5.16>.  It is part of the default
feature set and can be turned on or off explicitly with C<use feature
'array_base'>.

=head2 C<__SUB__>

The new C<__SUB__> token, available under the C<current_sub> feature
(see L<feature>) or C<use v5.16>, returns a reference to the current
subroutine, making it easier to write recursive closures.

pod/perl5220delta.pod  view on Meta::CPAN


C<sub foo { foo() }> is now deparsed with those mandatory parentheses.

C</@array/> is now deparsed as a regular expression, and not just
C<@array>.

C</@{-}/>, C</@{+}/> and C<$#{1}> are now deparsed with the braces, which
are mandatory in these cases.

In deparsing feature bundles, C<B::Deparse> was emitting C<no feature;> first
instead of C<no feature ':all';>.  This has been fixed.

C<chdir FH> is now deparsed without quotation marks.

C<\my @a> is now deparsed without parentheses.  (Parenthese would flatten
the array.)

C<system> and C<exec> followed by a block are now deparsed correctly.
Formerly there was an erroneous C<do> before the block.

C<< use constant QR =E<gt> qr/.../flags >> followed by C<"" =~ QR> is no longer

regen/feature.pl  view on Meta::CPAN


    use feature 'say';
    say "say is available here";
    {
        no feature 'say';
        print "But not here.\n";
    }
    say "Yet it is here.";

C<no feature> with no features specified will reset to the default group.  To
disable I<all> features (an unusual request!) use C<no feature ':all'>.

=head1 AVAILABLE FEATURES

Read L</"FEATURE BUNDLES"> for the feature cheat sheet summary.

=head2 The 'say' feature

C<use feature 'say'> tells the compiler to enable the Raku-inspired
C<say> function.

regen/feature.pl  view on Meta::CPAN


  use feature ":5.14.0";    # same as ":5.14"
  use feature ":5.14.1";    # same as ":5.14"

You can also do:

  use feature ":all";

or

  no feature ":all";

but the first may enable features in a later version of Perl that
change the meaning of your code, and the second may disable mechanisms
that are part of Perl's current behavior that have been turned into
features, just as C<indirect> and C<bareword_filehandles> were.

=head1 IMPLICIT LOADING

Instead of loading feature bundles by name, it is easier to let Perl do
implicit loading of a feature bundle for you.

regen/feature.pl  view on Meta::CPAN


=item *

By explicitly requiring a minimum Perl version number for your program, with
the C<use VERSION> construct.  That is,

    use v5.36.0;

will do an implicit

    no feature ':all';
    use feature ':5.36';

and so on.  Note how the trailing sub-version
is automatically stripped from the
version.

But to avoid portability warnings (see L<perlfunc/use>), you may prefer:

    use 5.036;

t/lib/feature/bundle  view on Meta::CPAN

########
# "no feature"
use feature ':5.16'; # turns array_base off
no feature; # resets to :default, thus would turn array_base on, if it still existed
$[ = 0;
$[ = 1;
EXPECT
Assigning non-zero to $[ is no longer possible at - line 5.
########
# "no feature 'all"
no feature ':all'; # turns array_base (and everything else) off
$[ = 1;
EXPECT
Assigning non-zero to $[ is no longer possible at - line 3.
########
# NAME $^H accidentally enabling all features
# HINT_FEATURE_MASK | HINT_LOCALIZE_HH
eval 'BEGIN { $^H |= 0x3c020000 } $_ = evalbytes 12345';
print $_||$@;
EXPECT
Number found where operator expected (Do you need to predeclare "evalbytes"?) at (eval 1) line 1, near "evalbytes 12345"



( run in 0.280 second using v1.01-cache-2.11-cpan-cba739cd03b )