Zing/Entity.pm

filter: Statementstmt 71.7% 28 / 39 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 70.0% 7 / 10 Podpod 0.0% 0 / 3 totaltotal 59.3% 35 / 59 CC 3 SCAR 13.7
CC
3
Cov
64%
BUILD
12.0
new_app
2.0
new_env
2.0
CRAP 3.9
« Zing/Store.pm ↑ Summary Zing/Flow.pm »
1 package Zing::Entity;
2  
3 56 ▶use 5.014;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 56 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 56 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 56 ▶use registry 'Zing::Types';
Subroutine BEGIN: called CC=1 SCAR=0.0
9 56 ▶use routines;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 56 ▶use Data::Object::Class;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 56 ▶use Data::Object::ClassHas;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 56 extends 'Zing::Class';
15  
16 56 our $VERSION = '0.26'; # VERSION
17  
18 # ATTRIBUTES
19  
20 56 has app => (
21 is => 'ro',
22 isa => 'App',
23 new => 1,
24 );
25  
26 0 ▶fun new_app($self) {
Subroutine new_app: not called CC=1 SCAR=6.9
Pod undocumented
27 0 $self->env->app
28 56 }
29  
30 56 has env => (
31 is => 'ro',
32 isa => 'Env',
33 new => 1,
34 );
35  
36 0 ▶fun new_env($self) {
Subroutine new_env: not called CC=1 SCAR=6.9
Pod undocumented
37 0 require Zing::Env; Zing::Env->new;
38 56 }
39  
40 # BUILDERS
41  
42 0 ▶fun BUILD($self, $args) {
Subroutine BUILD: not called CC=3 SCAR=24.8
Pod undocumented
43 0 ▶ $self->{env} = $self->{app}->env if $self->{app} && !$self->{env};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"app"} and not $self->{"env"} 0 0 0
Condition0%0/3
$self->{"app"} and not $self->{"env"}
!ll&&!rl&&r
000
MC/DC0%0/2
$self->{"app"} and not $self->{"env"}
$self->{"app"} not $self->{"env"}
Truth table0%0/3
A and not(B)
A= $self->{"app"}B= not $self->{"env"}
ABresult
0X0
100
111
44  
45 0 return $self;
46 56 }
47  
48 56 1;
49  
50 =encoding utf8
51  
52 =head1 NAME
53  
54 Zing::Entity - Environment-aware Base Class
55  
56 =cut
57  
58 =head1 ABSTRACT
59  
60 Environment-aware Abstract Base Class
61  
62 =cut
63  
64 =head1 SYNOPSIS
65  
66 use Zing::Entity;
67  
68 my $entity = Zing::Entity->new;
69  
70 # $entity->app;
71 # $entity->env;
72  
73 =cut
74  
75 =head1 DESCRIPTION
76  
77 This package provides an environment-aware abstract base class for L<Zing>
78 classes that need to be environment-aware.
79  
80 =cut
81  
82 =head1 INHERITS
83  
84 This package inherits behaviors from:
85  
86 L<Zing::Class>
87  
88 =cut
89  
90 =head1 LIBRARIES
91  
92 This package uses type constraints from:
93  
94 L<Zing::Types>
95  
96 =cut
97  
98 =head1 ATTRIBUTES
99  
100 This package has the following attributes:
101  
102 =cut
103  
104 =head2 app
105  
106 app(App)
107  
108 This attribute is read-only, accepts C<(App)> values, and is optional.
109  
110 =cut
111  
112 =head2 env
113  
114 env(Env)
115  
116 This attribute is read-only, accepts C<(Env)> values, and is optional.
117  
118 =cut
119  
120 =head1 AUTHOR
121  
122 Al Newkirk, C<awncorp@cpan.org>
123  
124 =head1 LICENSE
125  
126 Copyright (C) 2011-2019, Al Newkirk, et al.
127  
128 This is free software; you can redistribute it and/or modify it under the terms
129 of the The Apache License, Version 2.0, as elucidated in the L<"license
130 file"|https://github.com/iamalnewkirk/zing/blob/master/LICENSE>.
131  
132 =head1 PROJECT
133  
134 L<Wiki|https://github.com/iamalnewkirk/zing/wiki>
135  
136 L<Project|https://github.com/iamalnewkirk/zing>
137  
138 L<Initiatives|https://github.com/iamalnewkirk/zing/projects>
139  
140 L<Milestones|https://github.com/iamalnewkirk/zing/milestones>
141  
142 L<Contributing|https://github.com/iamalnewkirk/zing/blob/master/CONTRIBUTE.md>
143  
144 L<Issues|https://github.com/iamalnewkirk/zing/issues>
145  
146 =cut
« Zing/Store.pm ↑ Summary Zing/Flow.pm »