Devel-DumpTrace

 view release on metacpan or  search on metacpan

lib/Devel/DumpTrace/PPI.pm  view on Meta::CPAN

displayed when the compound C<for> statement is not the last statement
in the current block, as this feature works by attaching
additional information to the statement that I<follows> the end
of the C<for> loop.

=head2 Special handling for other foreach loops

When a program containing the regular C<foreach [$var] LIST> construction
is traced, the C<foreach ...> statement only appears in the trace 
output for the first iteration of the loop, just like the C-style
for loop construct. For all subsequent iterations the 
C<Devel::DumpTrace::PPI> module will prepend the first statement in the
block with C<FOREACH: {> I<loop-variable> C<}> to show the new
value of the loop variable at the beginning of each iteration.

  $ perl -d:DumpTrace::PPI -e '
  for (1 .. 6) {
    $n += 2 * $_ - 1;
    print $_, "\t", $n, "\n"
  }
  '

t/ppi/88-smoke-decorators.t  view on Meta::CPAN


ok($c1 == 0, "ran level $level") or $keep++;

open XH, '<', $file;
my @xh = <XH>; 
close XH;

# tests:
#   C-style for loops:
#     for loop statement appears only on first iteration
#     on other iterations, there are lines matching
#          FOR-UPDATE: {.*} FOR-COND: {.*}
#     the FOR-UPDATE ... lines have file/line information
#     the lines _after_ FOR-UPDATE ... do not have file/line information
#     condition statement for last iteration is observed
#
#   while/until loops
#     while / until keyword appears only on first iteration
#     on other iterations, there are lines matching
#         WHILE:\s*(.*)  or   UNTIL:\s*(.*)
#     WHILE:/UNTIL: lines have file/line information
#     lines _after_ WHILE:/UNTIL: ... do not have file/line information
#     condition statement for last iteration observed
#
#   if/elsif/else blocks
#     line with if keyword has file/line info
#     line after if keyword has file/line info
#     line with ELSEIF has a condition clause
#     line with ELSE or ELSIF either



( run in 2.511 seconds using v1.01-cache-2.11-cpan-71847e10f99 )