File Coverage

blib/lib/WWW/Wookie/Widget/Property.pm
Criterion Covered Total %
statement 23 23 100.0
branch n/a
condition n/a
subroutine 8 8 100.0
pod n/a
total 31 31 100.0


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::Property v1.1.4;
4 4     4   1099 use strict;
  4         9  
  4         133  
5 4     4   23 use warnings;
  4         7  
  4         120  
6              
7 4     4   22 use utf8;
  4         8  
  4         30  
8 4     4   151 use 5.020000;
  4         13  
9              
10 4     4   20 use Moose qw/around has/;
  4         9  
  4         41  
11 4     4   20574 use namespace::autoclean '-except' => 'meta', '-also' => qr/^_/sxm;
  4         11  
  4         52  
12              
13 4     4   378 use Readonly;
  4         9  
  4         1203  
14             ## no critic qw(ProhibitCallsToUnexportedSubs)
15             Readonly::Scalar my $MORE_ARGS => 3;
16             ## use critic
17              
18             has '_name' => (
19             'is' => 'rw',
20             'isa' => 'Str',
21             'reader' => 'getName',
22             'writer' => 'setName',
23             );
24              
25             has '_value' => (
26             'is' => 'rw',
27             'isa' => 'Any',
28             'reader' => 'getValue',
29             'writer' => 'setValue',
30             );
31              
32             has '_public' => (
33             'is' => 'rw',
34             'isa' => 'Bool',
35             'reader' => 'getIsPublic',
36             'writer' => 'setIsPublic',
37             );
38              
39             around 'BUILDARGS' => sub {
40             my $orig = shift;
41             my $class = shift;
42              
43             if ( 1 == @_ && !ref $_[0] ) {
44             push @_, undef;
45             }
46             if ( 2 == @_ && !ref $_[0] ) {
47             push @_, 0;
48             }
49             if ( @_ == $MORE_ARGS && !ref $_[0] ) {
50             return $class->$orig(
51             '_name' => $_[0],
52             '_value' => $_[1],
53             '_public' => $_[2],
54             );
55             }
56             return $class->$orig(@_);
57             };
58              
59 4     4   32 no Moose;
  4         7  
  4         44  
60              
61             __PACKAGE__->meta->make_immutable;
62              
63             1;
64              
65             __END__
66              
67             =encoding utf8
68              
69             =for stopwords Bitbucket boolean Readonly Ipenburg MERCHANTABILITY
70              
71             =head1 NAME
72              
73             WWW::Wookie::Widget::Property - Property class
74              
75             =head1 VERSION
76              
77             This document describes WWW::Wookie::Widget::Property version C<v1.1.4>
78              
79             =head1 SYNOPSIS
80              
81             use WWW::Wookie::Widget::Property;
82             $p = WWW::Wookie::Widget::Property->new($name, $value, 0);
83              
84             =head1 DESCRIPTION
85              
86             =head1 SUBROUTINES/METHODS
87              
88             =head2 C<new>
89              
90             Construct a new property.
91              
92             =over
93              
94             =item 1. Property name as string
95              
96             =item 2. Property value as string
97              
98             =item 3. Is property public (handled as shared data key) or private as boolean
99              
100             =back
101              
102             =head2 C<getValue>
103              
104             Get property value. Returns value of property as sting.
105              
106             =head2 C<getName>
107              
108             Get property name. Returns name of property as sting.
109              
110             =head2 C<isPublic>
111              
112             Get property C<isPublic> flag. Return the C<isPublic> flag of the property as
113             string.
114              
115             =head2 C<setValue>
116              
117             Set property value.
118              
119             =over
120              
121             =item 1. New value as string
122              
123             =back
124              
125             =head2 C<setName>
126              
127             Set property name.
128              
129             =over
130              
131             =item 1. New name as string
132              
133             =back
134              
135             =head2 C<setIsPublic>
136              
137             Set C<isPublic> flag, 1 or 0.
138              
139             =over
140              
141             =item 1. Flag 1 or 0
142              
143             =back
144              
145             =head1 CONFIGURATION AND ENVIRONMENT
146              
147             =head1 DEPENDENCIES
148              
149             =over 4
150              
151             =item * L<Moose|Moose>
152              
153             =item * L<Readonly|Readonly>
154              
155             =item * L<namespace::autoclean|namespace::autoclean>
156              
157             =back
158              
159             =head1 INCOMPATIBILITIES
160              
161             =head1 DIAGNOSTICS
162              
163             =head1 BUGS AND LIMITATIONS
164              
165             Please report any bugs or feature requests at
166             L<Bitbucket|https://bitbucket.org/rolandvanipenburg/www-wookie/issues>.
167              
168             =head1 AUTHOR
169              
170             Roland van Ipenburg, E<lt>roland@rolandvanipenburg.comE<gt>
171              
172             =head1 LICENSE AND COPYRIGHT
173              
174             Copyright 2010-2021 by Roland van Ipenburg
175              
176             This library is free software; you can redistribute it and/or modify
177             it under the same terms as Perl itself, either Perl version 5.14.0 or,
178             at your option, any later version of Perl 5 you may have available.
179              
180             =head1 DISCLAIMER OF WARRANTY
181              
182             BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
183             FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
184             OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
185             PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
186             EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
187             WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
188             ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
189             YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
190             NECESSARY SERVICING, REPAIR, OR CORRECTION.
191              
192             IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
193             WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
194             REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENSE, BE
195             LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL,
196             OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
197             THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
198             RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
199             FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
200             SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
201             SUCH DAMAGES.
202              
203             =cut