File Coverage

blib/lib/Perl6/Variables.pm
Criterion Covered Total %
statement 3 3 100.0
branch n/a
condition n/a
subroutine 1 1 100.0
pod n/a
total 4 4 100.0


line stmt bran cond sub pod time code
1             package Perl6::Variables;
2             $VERSION = '0.01';
3 1     1   2818 use Filter::Simple;
  1         38431  
  1         89  
4              
5             my $ident = qr/ [_a-z] \w* (?: :: [_a-z] \w* )* /ix;
6             my $listlikely = qr/ (?: \.\. | => | , | qw | \@ $ident \b [^[] ) /x;
7             my $alist = qr/ [^]]* $listlikely /x;
8             my $hlist = qr/ [^}]* $listlikely /x;
9              
10             FILTER {
11             $DB::single=1;
12             my $text = "";
13             pos = 0;
14             while (pos($_)
15             m/\G \$ ($ident) \.? \[ (?=$alist) /sxgc and
16             $text .= qq/\@{\$$1}[/ and next;
17             m/\G \$ ($ident) \.? \[ (?!$alist) /sxgc and
18             $text .= qq/\$$1\->[/ and next;
19             m/\G \$ ($ident) \.? \{ (?=$hlist) /sxgc and
20             $text .= qq/\@{\$$1}{/ and next;
21             m/\G \$ ($ident) \.? \{ (?!$hlist) /sxgc and
22             $text .= qq/\$$1\->{/ and next;
23             m/\G \@ ($ident) \[ (?=$alist) /sxgc and
24             $text .= qq/\@$1\[/ and next;
25             m/\G \@ ($ident) \[ (?!$alist) /sxgc and
26             $text .= qq/\$$1\[/ and next;
27             m/\G \% ($ident) \{ (?=$hlist) /sxgc and
28             $text .= qq/\@$1\{/ and next;
29             m/\G \% ($ident) \{ (?!$hlist) /sxgc and
30             $text .= qq/\$$1\{/ and next;
31             m/\G ([^\$\@%]+|.) /xgcs and
32             $text .= $1;
33             }
34             $_ = $text . substr($_,pos);
35             };
36              
37             __END__