File Coverage

blib/lib/WWW/Wookie/Widget/Category.pm
Criterion Covered Total %
statement 20 25 80.0
branch n/a
condition n/a
subroutine 7 9 77.7
pod 2 2 100.0
total 29 36 80.5


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