| 1 | package FindApp::Object::State::Group::State; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | 6 | ▶ | use v5.10; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | 6 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | 6 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | 6 | ▶ | use mro "c3"; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 7 | |||||||||||||||||||||
| 8 | 6 | ▶ | use FindApp::Vars qw(:all); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 9 | 6 | ▶ | use FindApp::Utils qw(:all); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | ################################################################# | ||||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | sub dir_field ( _ ) ; | ||||||||||||||||||||
| 14 | sub dir_fields ( ) ; | ||||||||||||||||||||
| 15 | sub dir_types ( ) ; | ||||||||||||||||||||
| 16 | sub field_map ( & @ ) ; | ||||||||||||||||||||
| 17 | sub type_map ( & @ ) ; | ||||||||||||||||||||
| 18 | |||||||||||||||||||||
| 19 | ################################################################# | ||||||||||||||||||||
| 20 | |||||||||||||||||||||
| 21 | sub dir_types() { | ||||||||||||||||||||
| 22 | 12 | ▶ | return qw(allowed wanted found); | ||||||||||||||||||
|
Subroutine
dir_types: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 23 | } | ||||||||||||||||||||
| 24 | |||||||||||||||||||||
| 25 | sub dir_field(_) { | ||||||||||||||||||||
| 26 | 18 | ▶ | my($type) = @_; | ||||||||||||||||||
|
Subroutine
dir_field: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 27 | 6 | ▶ | no strict "refs"; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 28 | 18 | return &{uc $type}; | |||||||||||||||||||
| 29 | } | ||||||||||||||||||||
| 30 | |||||||||||||||||||||
| 31 | sub type_map(&@) { | ||||||||||||||||||||
| 32 | 12 | ▶ | my $code = shift; | ||||||||||||||||||
|
Subroutine
type_map: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 33 | 12 | return map { &$code } +dir_types, @_; | |||||||||||||||||||
| 34 | } | ||||||||||||||||||||
| 35 | |||||||||||||||||||||
| 36 | sub dir_fields() { | ||||||||||||||||||||
| 37 | my $fields = [ type_map{dir_field} ]; | ||||||||||||||||||||
| 38 | return @$fields; | ||||||||||||||||||||
| 39 | } | ||||||||||||||||||||
| 40 | |||||||||||||||||||||
| 41 | sub field_map(&@) { | ||||||||||||||||||||
| 42 | my $code = shift; | ||||||||||||||||||||
| 43 | return map { &$code } +dir_fields, @_; | ||||||||||||||||||||
| 44 | } | ||||||||||||||||||||
| 45 | |||||||||||||||||||||
| 46 | 6 | ▶ | use namespace::clean; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 47 | |||||||||||||||||||||
| 48 | ################################################################ | ||||||||||||||||||||
| 49 | |||||||||||||||||||||
| 50 | use pluskeys qw{ | ||||||||||||||||||||
| 51 | NAME | ||||||||||||||||||||
| 52 | EXPORTED | ||||||||||||||||||||
| 53 | 6 | ▶ | } => type_map{uc}; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 54 | |||||||||||||||||||||
| 55 | sub unexported { | ||||||||||||||||||||
| 56 | 56 | ▶ | bad_args(!@_ || @_ > 2); | ||||||||||||||||||
|
Subroutine
unexported: called CC=3 SCAR=11.8
Pod
documented
Condition33%1/3
!@_ || @_ > 2
MC/DC0%0/2
!@_ || @_ > 2
!@_
@_ > 2
Truth table33%1/3
not(A) || B
A= !@_B= @_ > 2
| |||||||||||||||||||||
| 57 | 56 | my($self, $value) = @_; | |||||||||||||||||||
| 58 | 56 | ▶ | if ($value) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 59 | 56 | $$self{+EXPORTED} = 0; | |||||||||||||||||||
| 60 | } | ||||||||||||||||||||
| 61 | 56 | return !$$self{+EXPORTED}; | |||||||||||||||||||
| 62 | } | ||||||||||||||||||||
| 63 | |||||||||||||||||||||
| 64 | sub have_exported { | ||||||||||||||||||||
| 65 | 14 | ▶ | good_args(@_ == 1); | ||||||||||||||||||
|
Subroutine
have_exported: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 66 | 14 | my $self = shift; | |||||||||||||||||||
| 67 | 14 | return $$self{+EXPORTED}; | |||||||||||||||||||
| 68 | } | ||||||||||||||||||||
| 69 | |||||||||||||||||||||
| 70 | sub bump_exports { | ||||||||||||||||||||
| 71 | 12 | ▶ | good_args(@_ == 1); | ||||||||||||||||||
|
Subroutine
bump_exports: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 72 | 12 | my $self = shift; | |||||||||||||||||||
| 73 | 12 | return ++$$self{+EXPORTED}; | |||||||||||||||||||
| 74 | } | ||||||||||||||||||||
| 75 | |||||||||||||||||||||
| 76 | sub exported { | ||||||||||||||||||||
| 77 | 72 | ▶ | bad_args(@_ > 2); | ||||||||||||||||||
|
Subroutine
exported: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 78 | 72 | my $self = shift; | |||||||||||||||||||
| 79 | 6 | ▶ | use warnings FATAL => qw(numeric uninitialized); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 80 | 72 | ▶ | $$self{+EXPORTED} += shift if @_; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 81 | 72 | $$self{+EXPORTED}; | |||||||||||||||||||
| 82 | } | ||||||||||||||||||||
| 83 | |||||||||||||||||||||
| 84 | sub name { | ||||||||||||||||||||
| 85 | 274 | ▶ | bad_args(@_ > 2); | ||||||||||||||||||
|
Subroutine
name: called CC=7 SCAR=19.9
Pod
documented
| |||||||||||||||||||||
| 86 | 274 | my $self = shift; | |||||||||||||||||||
| 87 | 274 | ▶ | return $$self{+NAME} unless @_; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 88 | 56 | my $old_name = $$self{+NAME}; | |||||||||||||||||||
| 89 | 56 | my $new_name = shift; | |||||||||||||||||||
| 90 | 56 | for ($new_name) { | |||||||||||||||||||
| 91 | 56 | ▶ | defined || die "name cannot be undef"; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 92 | 56 | ▶ | length || die "name cannot be zero length"; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 93 | 56 | ▶ | !ref || die "name cannot be a reference"; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 94 | 56 | ▶ | !/\0/ || die "name cannot contain NUL characters"; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 95 | } | ||||||||||||||||||||
| 96 | 56 | $$self{+NAME} = $new_name; | |||||||||||||||||||
| 97 | 56 | return $old_name; | |||||||||||||||||||
| 98 | } | ||||||||||||||||||||
| 99 | |||||||||||||||||||||
| 100 | sub access_AWF_subdir { | ||||||||||||||||||||
| 101 | 472 | ▶ | my($self, $dirs, @values) = @_; | ||||||||||||||||||
|
Subroutine
access_AWF_subdir: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||
| 102 | 472 | ▶ | $dirs->set(@values) if @values; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 103 | 472 | ▶ | if (wantarray) { return $dirs->get } | ||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||
| 104 | 310 | elsif (defined wantarray) { return $dirs } | |||||||||||||||||||
| 105 | 86 | else { return } | |||||||||||||||||||
| 106 | } | ||||||||||||||||||||
| 107 | |||||||||||||||||||||
| 108 | BEGIN { | ||||||||||||||||||||
| 109 | 6 | ▶ | my %ACCESSOR = type_map { $_ => dir_field }; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=2 SCAR=6.9
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 110 | # BUILD: allowed, wanted, found | ||||||||||||||||||||
| 111 | 6 | ▶ | while (my($TYPE, $FIELD) = each %ACCESSOR) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 112 | 102 | ▶ | function $TYPE => sub { &ENTER_TRACE_2; | ||||||||||||||||||
|
Subroutine
allowed: called CC=1 SCAR=0.0
Subroutine
wanted: called CC=1 SCAR=0.0
Subroutine
found: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 113 | 102 | my $self = shift; | |||||||||||||||||||
| 114 | 102 | $self->access_AWF_subdir($$self{$FIELD}, @_); | |||||||||||||||||||
| 115 | 18 | }; | |||||||||||||||||||
| 116 | } | ||||||||||||||||||||
| 117 | } | ||||||||||||||||||||
| 118 | |||||||||||||||||||||
| 119 | 1 | 1; | |||||||||||||||||||
| 120 | |||||||||||||||||||||
| 121 | =encoding utf8 | ||||||||||||||||||||
| 122 | |||||||||||||||||||||
| 123 | =head1 NAME | ||||||||||||||||||||
| 124 | |||||||||||||||||||||
| 125 | FindApp::Object::State::Group::Object::State - FIXME | ||||||||||||||||||||
| 126 | |||||||||||||||||||||
| 127 | =head1 SYNOPSIS | ||||||||||||||||||||
| 128 | |||||||||||||||||||||
| 129 | use FindApp::Object::State::Group::Object::State; | ||||||||||||||||||||
| 130 | |||||||||||||||||||||
| 131 | =head1 DESCRIPTION | ||||||||||||||||||||
| 132 | |||||||||||||||||||||
| 133 | =head2 Pluskey Attributes | ||||||||||||||||||||
| 134 | |||||||||||||||||||||
| 135 | These are always private; use the methods insteads. | ||||||||||||||||||||
| 136 | |||||||||||||||||||||
| 137 | =over | ||||||||||||||||||||
| 138 | |||||||||||||||||||||
| 139 | =item ALLOWED | ||||||||||||||||||||
| 140 | |||||||||||||||||||||
| 141 | =item EXPORTED | ||||||||||||||||||||
| 142 | |||||||||||||||||||||
| 143 | =item FOUND | ||||||||||||||||||||
| 144 | |||||||||||||||||||||
| 145 | =item NAME | ||||||||||||||||||||
| 146 | |||||||||||||||||||||
| 147 | =item WANTED | ||||||||||||||||||||
| 148 | |||||||||||||||||||||
| 149 | =back | ||||||||||||||||||||
| 150 | |||||||||||||||||||||
| 151 | =head2 Public Methods | ||||||||||||||||||||
| 152 | |||||||||||||||||||||
| 153 | =over | ||||||||||||||||||||
| 154 | |||||||||||||||||||||
| 155 | =item ALLOWED | ||||||||||||||||||||
| 156 | |||||||||||||||||||||
| 157 | =item FOUND | ||||||||||||||||||||
| 158 | |||||||||||||||||||||
| 159 | =item WANTED | ||||||||||||||||||||
| 160 | |||||||||||||||||||||
| 161 | =item access_AWF_subdir | ||||||||||||||||||||
| 162 | |||||||||||||||||||||
| 163 | =item allowed | ||||||||||||||||||||
| 164 | |||||||||||||||||||||
| 165 | =item bump_exports | ||||||||||||||||||||
| 166 | |||||||||||||||||||||
| 167 | =item exported | ||||||||||||||||||||
| 168 | |||||||||||||||||||||
| 169 | =item found | ||||||||||||||||||||
| 170 | |||||||||||||||||||||
| 171 | =item have_exported | ||||||||||||||||||||
| 172 | |||||||||||||||||||||
| 173 | =item name | ||||||||||||||||||||
| 174 | |||||||||||||||||||||
| 175 | =item unexported | ||||||||||||||||||||
| 176 | |||||||||||||||||||||
| 177 | =item wanted | ||||||||||||||||||||
| 178 | |||||||||||||||||||||
| 179 | =item FIXME | ||||||||||||||||||||
| 180 | |||||||||||||||||||||
| 181 | =back | ||||||||||||||||||||
| 182 | |||||||||||||||||||||
| 183 | =head2 Exports | ||||||||||||||||||||
| 184 | |||||||||||||||||||||
| 185 | =over | ||||||||||||||||||||
| 186 | |||||||||||||||||||||
| 187 | =item FIXME | ||||||||||||||||||||
| 188 | |||||||||||||||||||||
| 189 | =back | ||||||||||||||||||||
| 190 | |||||||||||||||||||||
| 191 | =head1 EXAMPLES | ||||||||||||||||||||
| 192 | |||||||||||||||||||||
| 193 | =head1 ENVIRONMENT | ||||||||||||||||||||
| 194 | |||||||||||||||||||||
| 195 | =head1 SEE ALSO | ||||||||||||||||||||
| 196 | |||||||||||||||||||||
| 197 | =over | ||||||||||||||||||||
| 198 | |||||||||||||||||||||
| 199 | =item L<FindApp> | ||||||||||||||||||||
| 200 | |||||||||||||||||||||
| 201 | =back | ||||||||||||||||||||
| 202 | |||||||||||||||||||||
| 203 | =head1 CAVEATS AND PROVISOS | ||||||||||||||||||||
| 204 | |||||||||||||||||||||
| 205 | =head1 BUGS AND LIMITATIONS | ||||||||||||||||||||
| 206 | |||||||||||||||||||||
| 207 | =head1 HISTORY | ||||||||||||||||||||
| 208 | |||||||||||||||||||||
| 209 | =head1 AUTHOR | ||||||||||||||||||||
| 210 | |||||||||||||||||||||
| 211 | Tom Christiansen << <tchrist@perl.com> >> | ||||||||||||||||||||
| 212 | |||||||||||||||||||||
| 213 | =head1 LICENCE AND COPYRIGHT | ||||||||||||||||||||
| 214 | |||||||||||||||||||||
| 215 | Copyright (c) 2016, Tom Christiansen C<< <tchrist@perl.com> >>. | ||||||||||||||||||||
| 216 | All Rights Reserved. | ||||||||||||||||||||
| 217 | |||||||||||||||||||||
| 218 | This module is free software; you can redistribute it and/or | ||||||||||||||||||||
| 219 | modify it under the same terms as Perl itself. See L<perlartistic>. | ||||||||||||||||||||
| 220 | |||||||||||||||||||||
| 221 | =cut | ||||||||||||||||||||
| 222 | |||||||||||||||||||||