B-DeparseTree

 view release on metacpan or  search on metacpan

t/testdata/small.pm  view on Meta::CPAN

my @s;
print /$s[1]/;
####
# all the flags (tr///)
# SKIP
tr/X/Y/c;
tr/X//d;
tr/X//s;
tr/X//r;
####
# [perl #91008]
# SKIP ?($] >= 5.023 || $] < 5.019) && "autoderef deleted in this Perl version"
# CONTEXT no warnings 'experimental::autoderef';
each $@;
keys $~;
values $!;
####
# readpipe with complex expression
readpipe $a + $b;
####
# aelemfast
$b::a[0] = 1;
####
# aelemfast for a lexical
my @a;
$a[0] = 1;
####
# $#- $#+ $#{%} etc.
# SKIP ?$] < 5.023
my @x;
@x = ($#{`}, $#{~}, $#{!}, $#{@}, $#{$}, $#{%}, $#{^}, $#{&}, $#{*});
@x = ($#{(}, $#{)}, $#{[}, $#{{}, $#{]}, $#{}}, $#{'}, $#{"}, $#{,});
@x = ($#{<}, $#{.}, $#{>}, $#{/}, $#{?}, $#{=}, $#+, $#{\}, $#{|}, $#-);
@x = ($#{;}, $#{:}, $#{1}), $#_
# ####
# # [perl #86060] $( $| $) in regexps need braces
# /${(}/;
# /${|}/;
# /${)}/;
# /${(}${|}${)}/;
# /@{+}@{-}/;
####
# ()[...]
my(@a) = ()[()];
####
# sort(foo(bar))
# sort(foo(bar)) is interpreted as sort &foo(bar)
# sort foo(bar) is interpreted as sort foo bar
# parentheses are not optional in this case
print sort(foo('bar'));
>>>>
print sort(foo('bar'));
####
# substr assignment
# SKIP $?
substr(my $a, 0, 0) = (foo(), bar());
$a++;
# ####
# # This following line works around an unfixed bug that we are not trying to
# # test for here:
# # CONTEXT BEGIN { $^H{a} = "b"; delete $^H{a} } # make %^H localised
# # hint hash
# BEGIN { $^H{'foo'} = undef; }
# {
#  BEGIN { $^H{'bar'} = undef; }
#  {
#   BEGIN { $^H{'baz'} = undef; }
#   {
#    print $_;
#   }
#   print $_;
#  }
#  print $_;
# }
# BEGIN { $^H{q[']} = '('; }
# print $_;
# ####
# # This following line works around an unfixed bug that we are not trying to
# # test for here:
# # CONTEXT BEGIN { $^H{a} = "b"; delete $^H{a} } # make %^H localised
# # hint hash changes that serialise the same way with sort %hh
# BEGIN { $^H{'a'} = 'b'; }
# {
#  BEGIN { $^H{'b'} = 'a'; delete $^H{'a'}; }
#  print $_;
# }
# print $_;
####
# Precedence conundrums with argument-less function calls
() = (eof) + 1;
() = (return) + 1;
() = (return, 1);
() = warn;
() = warn() + 1;
() = setpgrp() + 1;
####
# [perl #63558] open local(*FH)
open local *FH;
pipe local *FH, local *FH;
####
# require <binop>
require 'a' . $1;
####
# 'my' works with padrange op
my($z, @z);
my $m1;
$m1 = 1;
$z = $m1;
my $m2 = 2;
my($m3, $m4);
($m3, $m4) = (1, 2);
@z = ($m3, $m4);
my($m5, $m6) = (1, 2);
my($m7, undef, $m8) = (1, 2, 3);
@z = ($m7, undef, $m8);
($m7, undef, $m8) = (1, 2, 3);
####
# 'state' works with padrange op
# CONTEXT no strict; use feature 'state';
state($z, @z);
state $s1;
$s1 = 1;
$z = $s1;
state $s2 = 2;
state($s3, $s4);
($s3, $s4) = (1, 2);
@z = ($s3, $s4);
# assignment of state lists isn't implemented yet
#state($s5, $s6) = (1, 2);
#state($s7, undef, $s8) = (1, 2, 3);
#@z = ($s7, undef, $s8);
($s7, undef, $s8) = (1, 2, 3);
####
# slices with padrange
# SKIP ?$] < 5.023
my($a, $b);
my(@x, %y);
@x = @x[$a, $b];
@x = @y{$a, $b};
####
# binops with padrange
my($a, $b, $c);
$c = $a cmp $b;
$c = $a + $b;



( run in 1.062 second using v1.01-cache-2.11-cpan-5a3173703d6 )