| 1 | package Seis; | ||
| 2 | 2 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 2 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 2 | ▶ | use 5.010001; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | our $VERSION = "0.12"; | ||
| 8 | |||
| 9 | 2 | ▶ | use Seis::Exceptions; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | 0 | ▶ | use Seis::Compiler; |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 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__ | ||