blib/lib/WWW/Wookie/Widget/Category.pm

filter: Statementstmt 81.0% 30 / 37 Branchbran 50.0% 1 / 2 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 81.8% 9 / 11 Podpod 100% 2 / 2 totaltotal 75.4% 43 / 57 CC 3 SCAR 5.9
CC
3
Cov
76%
__ANON__
3.8
put
2.0
get
2.0
CRAP 1.8
« blib/lib/WWW/Wookie/Widget.pm ↑ Summary blib/lib/WWW/Wookie/Widget/Instance.pm »
1 # -*- cperl; cperl-indent-level: 4 -*-
2 package WWW::Wookie::Widget::Category v1.1.1;
3 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 5 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 5 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 5 ▶use 5.020000;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 5 ▶use Moose qw/around has/;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 5 ▶use namespace::autoclean '-except' => 'meta', '-also' => qr/^_/sxm;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 5 has '_name' => (
13 'is' => 'ro',
14 'isa' => 'Str',
15 'reader' => 'getName',
16 );
17  
18 has '_widgets' => (
19 'traits' => ['Hash'],
20 'is' => 'rw',
21 'isa' => 'HashRef[WWW::Wookie::Widget]',
22 2 ▶ 'default' => sub { {} },
Subroutine __ANON__: called CC=1 SCAR=0.0
23 5 );
24  
25 sub put {
26 0 ▶ my ( $self, $widget ) = @_;
Subroutine put: not called CC=1 SCAR=6.9
Pod documented
27 0 $self->_widgets->{ $widget->getIdentifier } = $widget;
28 0 return;
29 }
30  
31 sub get {
32 0 ▶ my $self = shift;
Subroutine get: not called CC=1 SCAR=6.9
Pod documented
33 0 return $self->_widgets;
34 }
35  
36 around 'BUILDARGS' => sub {
37 2 ▶ my $orig = shift;
Subroutine __ANON__: called CC=3 SCAR=13.5
38 2 my $class = shift;
39  
40 2 ▶ if ( 1 == @_ && !ref $_[0] ) {
Branch: 1 branch
BranchTrueFalseTotal
if (1 == @_ and not ref $_[0]) 0 2 2
Condition33%1/3
1 == @_ and not ref $_[0]
!ll&&!rl&&r
200
MC/DC0%0/2
1 == @_ and not ref $_[0]
1 == @_ not ref $_[0]
Truth table33%1/3
A and not(B)
A= 1 == @_B= not ref $_[0]
ABresult
0X0
100
111
41 0 my ($name) = @_;
42 0 return $class->$orig( '_name' => $name, );
43 }
44 2 return $class->$orig(@_);
45 5 };
46  
47 5 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
48  
49 5 __PACKAGE__->meta->make_immutable;
50  
51 5 1;
52  
53 __END__
54  
55 =encoding utf8
56  
57 =for stopwords Ipenburg MERCHANTABILITY
58  
59 =head1 NAME
60  
61 WWW::Wookie::Widget::Category - client side representation of a widget service
62 category
63  
64 =head1 VERSION
65  
66 This document describes WWW::Wookie::Widget::Category version v1.1.1
67  
68 =head1 SYNOPSIS
69  
70 use WWW::Wookie::Widget::Category;
71 $c = WWW::Wookie::Widget::Category->new($name);
72 $c->getName;
73  
74 =head1 DESCRIPTION
75  
76 =head1 SUBROUTINES/METHODS
77  
78 =head2 C<new>
79  
80 Create a new service type.
81  
82 =over
83  
84 =item 1. Service name as string
85  
86 =back
87  
88 =head2 C<getName>
89  
90 Gets the name of the service. Returns the name of the service as string.
91  
92 =head2 C<get>
93  
94 Gets the widgets available for this service. Returns an array of
95 L<WWW::Wookie::Widget|WWW::Wookie::Widget> objects.
96  
97 =head2 C<put>
98  
99 Adds a L<WWW::Wookie::Widget|WWW::Wookie::Widget> object to this service.
100  
101 =head1 CONFIGURATION AND ENVIRONMENT
102  
103 =head1 DEPENDENCIES
104  
105 =over 4
106  
107 =item * L<Moose|Moose>
108  
109 =item * L<namespace::autoclean|namespace::autoclean>
110  
111 =back
112  
113 =head1 INCOMPATIBILITIES
114  
115 =head1 DIAGNOSTICS
116  
117 =head1 BUGS AND LIMITATIONS
118  
119 Please report any bugs or feature requests at L<RT for
120 rt.cpan.org|https://rt.cpan.org/Dist/Display.html?Queue=WWW-Wookie>.
121  
122 =head1 AUTHOR
123  
124 Roland van Ipenburg, E<lt>ipenburg@xs4all.nlE<gt>
125  
126 =head1 LICENSE AND COPYRIGHT
127  
128 Copyright 2017 by Roland van Ipenburg
129  
130 This library is free software; you can redistribute it and/or modify
131 it under the same terms as Perl itself, either Perl version 5.14.0 or,
132 at your option, any later version of Perl 5 you may have available.
133  
134 =head1 DISCLAIMER OF WARRANTY
135  
136 BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
137 FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
138 OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
139 PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
140 EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
141 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
142 ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
143 YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
144 NECESSARY SERVICING, REPAIR, OR CORRECTION.
145  
146 IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
147 WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
148 REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENSE, BE
149 LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL,
150 OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
151 THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
152 RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
153 FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
154 SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
155 SUCH DAMAGES.
156  
157 =cut
« blib/lib/WWW/Wookie/Widget.pm ↑ Summary blib/lib/WWW/Wookie/Widget/Instance.pm »