File Coverage

blib/lib/Seis.pm
Criterion Covered Total %
statement 13 15 86.6
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 18 20 90.0


line stmt bran cond sub pod time code
1             package Seis;
2 2     2   30652 use strict;
  2         5  
  2         85  
3 2     2   11 use warnings;
  2         4  
  2         68  
4              
5 2     2   66 use 5.010001;
  2         7  
  2         128  
6              
7             our $VERSION = "0.12";
8              
9 2     2   2642 use Seis::Exceptions;
  2         7  
  2         64  
10 2     2   2127 use Seis::Compiler;
  0            
  0            
11             use Seis::Array;
12             use Seis::Bool;
13             use File::Spec;
14             use File::ShareDir ();
15              
16             my $compiler = Seis::Compiler->new();
17              
18             @Seis::INC = do {
19             my @inc;
20             unshift @inc, '.';
21             unshift @inc, 'share/seislib/' if -d 'share/seislib/'; # while building?
22             eval {
23             unshift @inc, File::Spec->catdir(File::ShareDir::dist_dir('Seis'), 'seislib');
24             };
25             if (my $env = $ENV{PERL_SEIS_LIB}) {
26             unshift @inc, split /:/, $ENV{PERL_SEIS_LIB};
27             }
28             @inc;
29             };
30              
31             unshift @INC, sub {
32             my ($self, $fname) = @_;
33             for my $inc (@Seis::INC) {
34             my $real = File::Spec->catfile($inc, $fname);
35             next unless -f $real;
36              
37             open my $fh, '<', $real or die $!;
38             my $code = do { local $/; <$fh> };
39             my $compiled = $compiler->compile($code, $real) . ";1;";
40             open my $tmpfh, '<', \$compiled;
41             return $tmpfh;
42             }
43             return;
44             };
45              
46              
47             1;
48             __END__