blib/lib/Pinto/Schema/Result/Prerequisite.pm

filter: Statementstmt 98.0% 49 / 50 Branchbran n/a Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 92.3% 12 / 13 Podpod 0.0% 0 / 2 totaltotal 91.1% 62 / 68 CC 2 SCAR 1.4
CC
2
Cov
96%
FOREIGNBUILDARGS
2.0
__ANON__
1.0
BEGIN
1.0
CRAP 1.1
« blib/lib/Pinto/Action/Statistics.pm ↑ Summary blib/lib/Pinto/Action.pm »
1 63 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
2  
3 package Pinto::Schema::Result::Prerequisite;
4  
5 # Created by DBIx::Class::Schema::Loader
6 # DO NOT MODIFY THE FIRST PART OF THIS FILE
7  
8  
9 63 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 63 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 63 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 63 ▶use MooseX::NonMoose;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 63 ▶use MooseX::MarkAsMethods autoclean => 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 63 extends 'DBIx::Class::Core';
16  
17  
18 63 __PACKAGE__->table("prerequisite");
19  
20  
21 63 __PACKAGE__->add_columns(
22 "id", { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
23 "phase", { data_type => "text", is_nullable => 0 },
24 "distribution", { data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
25 "package_name", { data_type => "text", is_nullable => 0 },
26 "package_version", { data_type => "text", is_nullable => 0 },
27 );
28  
29  
30 63 __PACKAGE__->set_primary_key("id");
31  
32  
33 63 __PACKAGE__->add_unique_constraint(
34 "distribution_phase_package_name_unique",
35 [ "distribution", "phase", "package_name" ],
36 );
37  
38  
39 63 __PACKAGE__->belongs_to(
40 "distribution",
41 "Pinto::Schema::Result::Distribution",
42 { id => "distribution" },
43 { is_deferrable => 0, on_delete => "CASCADE", on_update => "NO ACTION" },
44 );
45  
46  
47 63 with 'Pinto::Role::Schema::Result';
48  
49 # Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-03-26 11:05:47
50 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:p++Wil511AYW5fZ8Xoe4Jg
51  
52 #------------------------------------------------------------------------------
53  
54 # ABSTRACT: Represents a Distribution -> Package dependency
55  
56 #------------------------------------------------------------------------------
57  
58 63 ▶use Pinto::Target::Package;
Subroutine BEGIN: called CC=1 SCAR=0.0
59  
60 63 ▶use overload ( '""' => 'to_string' );
Subroutine BEGIN: called CC=1 SCAR=0.0
61  
62 #------------------------------------------------------------------------------
63  
64 63 our $VERSION = '0.14'; # VERSION
65  
66 #------------------------------------------------------------------------------
67 # NOTE: We often convert a Prerequsite to/from a PackageSpec object. They don't
68 # use quite the same names for their attributes, so we shuffle them around here.
69  
70 21 ▶sub FOREIGNBUILDARGS {
Subroutine FOREIGNBUILDARGS: called CC=2 SCAR=7.0
Pod undocumented
71 21 my ( $class, $args ) = @_;
72  
73 21 ▶ $args ||= {};
Condition50%1/2
$args ||= {}
l!l
210
MC/DC0%0/1
$args ||= {}
$args
Truth table50%1/2
A
A= $args
Aresult
11
00
74 21 $args->{package_name} = delete $args->{name};
75 21 $args->{package_version} = delete $args->{version};
76  
77 21 return $args;
78 }
79  
80 #------------------------------------------------------------------------------
81  
82 has as_target => (
83 is => 'ro',
84 isa => 'Pinto::Target::Package',
85 init_arg => undef,
86 lazy => 1,
87 handles => [qw(is_core is_perl)],
88 4 ▶ default => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
89 4 Pinto::Target::Package->new(
90 name => $_[0]->package_name,
91 version => $_[0]->package_version
92 );
93 },
94 63 );
95  
96 #------------------------------------------------------------------------------
97  
98 4 ▶sub to_string {
Subroutine to_string: called CC=1 SCAR=0.0
Pod undocumented
99 4 my ($self) = @_;
100  
101 4 return $self->as_target->to_string;
102 }
103  
104 #------------------------------------------------------------------------------
105  
106 63 for my $phase ( qw(configure build test runtime develop) ) {
107 63 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
108 0 ▶ *{__PACKAGE__ . "::is_$phase"} = sub {shift->phase eq $phase};
Subroutine __ANON__: not called CC=1 SCAR=0.4
109 }
110  
111 #------------------------------------------------------------------------------
112  
113 63 __PACKAGE__->meta->make_immutable;
114  
115 #------------------------------------------------------------------------------
116 63 1;
117  
118 __END__
« blib/lib/Pinto/Action/Statistics.pm ↑ Summary blib/lib/Pinto/Action.pm »