Farly.pm

filter: Statementstmt 98.1% 53 / 54 Branchbran 50.0% 2 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 12 / 12 Podpod 66.6% 2 / 3 totaltotal 94.5% 69 / 73 CC 3 SCAR 3.6
CC
3
Cov
95%
process
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.4
« Farly/Value/String.pm ↑ Summary Farly/Director.pm »
1 package Farly;
2
3 11 ▶use 5.008008;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 11 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 11 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 11 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 11 ▶use IO::File;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 11 ▶use File::Spec;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 11 ▶use Log::Any qw($log);
Subroutine BEGIN: called CC=1 SCAR=0.0
10 11 ▶use Farly::Director;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 11 ▶use Farly::Object;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 11 require Time::HiRes;
13
14 11 our $VERSION = '0.26';
15
16 5 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
17 5 my ( $class, $container ) = @_;
18
19 5 my $self = { DIRECTOR => Farly::Director->new(), };
20 5 bless $self, $class;
21
22 5 $log->info("$self NEW");
23
24 5 return $self;
25 }
26
27 15 ▶sub director {
Subroutine director: called CC=1 SCAR=0.0
Pod undocumented
28 15 return $_[0]->{DIRECTOR};
29 }
30
31 5 ▶sub process {
Subroutine process: called CC=3 SCAR=11.1
Pod documented
32 5 my ( $self, $type, $file_name ) = @_;
33
34 5 ▶ croak "$file_name is not a file" unless ( -f $file_name );
Branch: 1 branch
BranchTrueFalseTotal
unless -f $file_name 0 5 5
35
36 5 my $location = "Farly/$type/Builder.pm";
37 5 my $builder_class = 'Farly::'.$type.'::Builder';
38
39 5 require $location;
40
41 5 my $builder = $builder_class->new();
42
43 5 my $file = IO::File->new($file_name);
44
45 5 $self->director()->set_file($file);
46 5 $self->director()->set_builder($builder);
47
48 5 my $start = [ Time::HiRes::gettimeofday() ];
49
50 5 my $container;
51
52 5 eval { $container = $self->director()->run(); };
53 5 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 5 5
54 0 die "Import of $file_name failed\n", $@, "\n";
55 }
56
57 5 my $elapsed = Time::HiRes::tv_interval($start);
58
59 5 $log->info("parse time: $elapsed seconds");
60
61 5 $log->info( "imported " . $container->size() . " objects" );
62
63 5 return $container;
64 }
65
66 11 1;
67 __END__
« Farly/Value/String.pm ↑ Summary Farly/Director.pm »