File Coverage

lib/Cheater/Parser/Util.pm
Criterion Covered Total %
statement 9 18 50.0
branch 0 4 0.0
condition n/a
subroutine 3 4 75.0
pod 0 1 0.0
total 12 27 44.4


line stmt bran cond sub pod time code
1             package Cheater::Parser::Util;
2              
3 11     11   56 use strict;
  11         24  
  11         353  
4 11     11   64 use warnings;
  11         22  
  11         389  
5 11     11   62 use Exporter qw( import );
  11         24  
  11         2035  
6              
7             our @EXPORT_OK = qw(
8             parse_included_file
9             );
10              
11             sub parse_included_file ($$) {
12 0     0 0   my ($file, $lineno) = @_;
13 0 0         open my $in, $file or
14             die "Failed to include file $file: $!\n";
15 0           my $src = do { local $/; <$in> };
  0            
  0            
16 0           close $in;
17              
18 0           my $parser = Cheater::Parser->new;
19 0 0         my $parse_tree = $parser->spec($src) or
20             die "ERROR: line $lineno: Failed to parse the included file $file\n";
21              
22 0           return $parse_tree;
23             }
24              
25             1;