The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
Reading database from ...


------------------------------------------ ------ ------ ------ ------ ------
File                                         stmt   bran   cond    sub  total
------------------------------------------ ------ ------ ------ ------ ------
tests/dynamic_subs                           94.5   75.0    n/a   80.0   90.2
Total                                        94.5   75.0    n/a   80.0   90.2
------------------------------------------ ------ ------ ------ ------ ------


Run: ...
Perl version: ...
OS: ...
Start: ...
Finish: ...

tests/dynamic_subs

line  err   stmt   bran   cond    sub   code
1                                       #!/usr/bin/perl
2                                       
3                                       # Copyright 2004-2014, Paul Johnson (paul@pjcj.net)
4                                       
5                                       # This software is free.  It is licensed under the same terms as Perl itself.
6                                       
7                                       # The latest version of this software should be available from my homepage:
8                                       # http://www.pjcj.net
9                                       
10    ***      0                    0   sub unused { 0 }
11    ***      0                    0   sub empty  {   }
12                                      
13                                      sub gen {
14             4                    4       my $x = shift;
15                                          sub {
16             5                    5           my $y = shift;
17    ***      5     50                         return $x + $y if $y;
18                                          }
19             4                        };
20                                      
21             1                        my $o = gen(1);
22             1                        my $p = $o->(7);
23             1                        my $q = $o->(8);
24             1                        my $r = gen(1)->(2);
25             1                        my $s = gen(3)->(4);
26             1                        my $t = gen(5)->(6);
27                                      
28             1                        print "$p, $q, $r, $s, $t\n";
29                                      
30             1                        for my $func (qw(f1 f2 f3)) {
31             1                    1       no strict "refs";
               1                        
               1                        
32                                          *$func = sub {
33             2                    2           print "$func\n";
34                                          }
35             3                        }
36                                      
37             1                        f1();
38             1                        f2();
39                                      
40                                      sub AUTOLOAD {
41             3                    3       my $func = $AUTOLOAD;
42             3                            $func =~ s/^.*:://;
43             1                    1       no strict "refs";
               1                        
               1                        
44             3    100                     if ($func eq "add") {
45                                              *$func = sub {
46             3                    3               print "Add!\n";
47             1                                };
48                                          } else {
49                                              *$func = sub {
50             2                    2               print "$func\n";
51             2                                };
52                                          }
53             3                            goto &$func
54                                      }
55                                      
56             1                        add();
57             1                        add();
58             1                        add();
59             1                        qaz();
60             1                        wsx();


Branches
--------

line  err      %   true  false   branch
----- --- ------ ------ ------   ------
17    ***     50      5      0   if $y
44           100      1      2   if ($func eq 'add') { }


Covered Subroutines
-------------------

Subroutine Count Location             
---------- ----- ---------------------
AUTOLOAD       3 tests/dynamic_subs:41
BEGIN          1 tests/dynamic_subs:31
BEGIN          1 tests/dynamic_subs:43
__ANON__       5 tests/dynamic_subs:16
__ANON__       2 tests/dynamic_subs:33
__ANON__       3 tests/dynamic_subs:46
__ANON__       2 tests/dynamic_subs:50
gen            4 tests/dynamic_subs:14

Uncovered Subroutines
---------------------

Subroutine Count Location             
---------- ----- ---------------------
empty          0 tests/dynamic_subs:11
unused         0 tests/dynamic_subs:10