perl

 view release on metacpan or  search on metacpan

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

{
    my $x;
    format STDOUT =
@
$x
.
}
EOCODN

# CORE::format
$a = readpipe qq`$^X $path "-MO=Deparse" -e "use feature q|:all|;`
             .qq` my sub format; CORE::format =" -e. 2>&1`;
like($a, qr/CORE::format/, 'CORE::format when lex format sub is in scope');

# literal big chars under 'use utf8'
is($deparse->coderef2text(sub{ use utf8; /€/; }),
'{
    /\x{20ac}/;
}',
"qr/euro/");

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

}
_121050 $a, $b;
sub _121050empty ( ) {
    
}
() = _121050empty + 1;
EOCODP

# CORE::no
$a = readpipe qq`$^X $path "-MO=Deparse" -Xe `
             .qq`"use feature q|:all|; my sub no; CORE::no less" 2>&1`;
like($a, qr/my sub no;\n.*CORE::no less;/s,
    'CORE::no after my sub no');

# CORE::use
$a = readpipe qq`$^X $path "-MO=Deparse" -Xe `
             .qq`"use feature q|:all|; my sub use; CORE::use less" 2>&1`;
like($a, qr/my sub use;\n.*CORE::use less;/s,
    'CORE::use after my sub use');

# CORE::__DATA__
$a = readpipe qq`$^X $path "-MO=Deparse" -Xe `
             .qq`"use feature q|:all|; my sub __DATA__; `
             .qq`CORE::__DATA__" 2>&1`;
like($a, qr/my sub __DATA__;\n.*CORE::__DATA__/s,
    'CORE::__DATA__ after my sub __DATA__');

# sub declarations
$a = readpipe qq`$^X $path "-MO=Deparse" -e "sub foo{}" 2>&1`;
like($a, qr/sub foo\s*\{\s+\}/, 'sub declarations');
like runperl(stderr => 1, switches => [ '-MO=-qq,Deparse', $path ],
           prog => 'sub f($); sub f($){}'),
     qr/sub f\s*\(\$\)\s*\{\s*\}/,

lib/feature.pm  view on Meta::CPAN

any C<use feature> or C<no feature> declaration.

Specifying sub-versions such as the C<0> in C<5.14.0> in feature bundles has
no effect.  Feature bundles are guaranteed to be the same for all sub-versions.

  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.

regen/feature.pl  view on Meta::CPAN

any C<use feature> or C<no feature> declaration.

Specifying sub-versions such as the C<0> in C<5.14.0> in feature bundles has
no effect.  Feature bundles are guaranteed to be the same for all sub-versions.

  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.

t/comp/require.t  view on Meta::CPAN

    # These are the test for feature 'module_true', which when in effect
    # avoids the requirement for a module to return a true value, and
    # in fact forces the return value to be a simple "true"
    # (eg, PL_sv_yes, aka 1).
    # we have a lot of permutations of how this code might trigger, and
    # etc. so we set up the test set here.

    my @params = (
            'use v5.37',
            'use feature ":5.38"',
            'use feature ":all"',
            'use feature "module_true"',
            'no feature "module_true"',
            '',
        );
    my @module_code = (
            '',
            'sub foo {};',
            'sub foo {}; 0;',
            'sub foo {}; return 0;',
            'sub foo {}; return (0,0,"some_true_value");',

t/op/svleak.t  view on Meta::CPAN

my $f = "use warnings FATAL =>";
my $all = "$f 'all';";
eleak(2, 0, "$f 'deprecated'; qq|\\c\{|", 'qq|\c{| with fatal warnings');
eleak(2, 0, "$f 'syntax'; qq|\\c`|", 'qq|\c`| with fatal warnings');
eleak(2, 0, "$all /\$\\ /", '/$\ / with fatal warnings');
eleak(2, 0, "$all s//\\1/", 's//\1/ with fatal warnings');
eleak(2, 0, "$all qq|\\i|", 'qq|\i| with fatal warnings');
eleak(2, 0, "$f 'digit'; qq|\\o{9}|", 'qq|\o{9}| with fatal warnings');
eleak(3, 1, "$f 'misc'; sub foo{} sub foo:lvalue",
     'ignored :lvalue with fatal warnings');
eleak(2, 0, "no warnings; use feature ':all'; $f 'misc';
             my sub foo{} sub foo:lvalue",
     'ignored mysub :lvalue with fatal warnings');
eleak(2, 0, "no warnings; use feature ':all'; $all
             my sub foo{} sub foo:lvalue{}",
     'fatal mysub redef warning');
eleak(2, 0, "$all sub foo{} sub foo{}", 'fatal sub redef warning');
eleak(2, 0, "$all *x=sub {}",
     'fatal sub redef warning with sub-to-glob assignment');
eleak(2, 0, "$all *x=sub() {1}",
     'fatal const sub redef warning with sub-to-glob assignment');
eleak(2, 0, "$all XS::APItest::newCONSTSUB(\\%main::=>name=>0=>1)",
     'newCONSTSUB sub redefinition with fatal warnings');
eleak(2, 0, "$f 'misc'; my\$a,my\$a", 'double my with fatal warnings');

t/op/svleak.t  view on Meta::CPAN



# [perl #114356] run-time rexexp with unchanging pattern got
# inflated refcounts
eleak(2, 0, q{ my $x = "x"; "abc" =~ /$x/ for 1..5 }, '#114356');

eleak(2, 0, 'sub', '"sub" with nothing following');
eleak(2, 0, '+sub:a{}', 'anon subs with invalid attributes');
eleak(2, 0, 'no warnings; sub a{1 1}', 'sub with syntax error');
eleak(2, 0, 'no warnings; sub {1 1}', 'anon sub with syntax error');
eleak(2, 0, 'no warnings; use feature ":all"; my sub a{1 1}',
     'my sub with syntax error');

# Reification (or lack thereof)
leak(2, 0, sub { sub { local $_[0]; shift }->(1) },
    'local $_[0] on surreal @_, followed by shift');
leak(2, 0, sub { sub { local $_[0]; \@_ }->(1) },
    'local $_[0] on surreal @_, followed by reification');

sub recredef {}
sub Recursive::Redefinition::DESTROY {



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