blib/lib/WWW/Wookie/User.pm

filter: Statementstmt 100% 47 / 47 Branchbran 100% 4 / 4 Conditioncond 66.6% 4 / 6 MC/DCmcdc 50.0% 2 / 4 Subroutinesub 100% 12 / 12 Podpod n/a totaltotal 94.5% 69 / 73 SCAR 16.1
CC
5
Cov
96%
__ANON__
5.0
BEGIN
1.0
BEGIN
1.0
CRAP 5.0
« blib/lib/WWW/Wookie/Server/Connection.pm ↑ Summary blib/lib/WWW/Wookie/Widget/Category.pm »
1 # -*- cperl; cperl-indent-level: 4 -*-
2 # Copyright (C) 2010-2021, Roland van Ipenburg
3 package WWW::Wookie::User v1.1.3;
4 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 4 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 4 ▶use 5.020000;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 4 ▶use Moose qw/around has/;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 4 ▶use Moose::Util::TypeConstraints qw/as coerce from where subtype via/;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 4 ▶use namespace::autoclean '-except' => 'meta', '-also' => qr/^_/sxm;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 4 ▶use Readonly;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 ## no critic qw(ProhibitCallsToUnexportedSubs)
16 4 Readonly::Scalar my $EMPTY => q{};
17 4 Readonly::Scalar my $UNKNOWN => q{UNKNOWN};
18 4 Readonly::Scalar my $MORE_ARGS => 3;
19 ## use critic
20  
21 44 ▶subtype 'Trimmed' => as 'Str' => where { m{(^$|(^\S|\S$))}gsmx };
Subroutine __ANON__: called CC=1 SCAR=0.0
22  
23 14 ▶coerce 'Trimmed' => from 'Str' => via { s{^\s+(.*)\s+$}{$1}gsmx; $_ };
Subroutine __ANON__: called CC=1 SCAR=0.0
24  
25 4 has 'loginName' => (
26 'is' => 'rw',
27 'isa' => 'Trimmed',
28 'coerce' => 1,
29 'default' => $UNKNOWN,
30 'reader' => 'getLoginName',
31 'writer' => 'setLoginName',
32 );
33  
34 4 has 'screenName' => (
35 'is' => 'rw',
36 'isa' => 'Trimmed',
37 'coerce' => 1,
38 'default' => $UNKNOWN,
39 'reader' => 'getScreenName',
40 'writer' => 'setScreenName',
41 );
42  
43 4 has 'thumbnailUrl' => (
44 'is' => 'ro',
45 'isa' => 'Str',
46 'default' => $EMPTY,
47 'reader' => 'getThumbnailUrl',
48 'writer' => 'setThumbnailUrl',
49 );
50  
51 around 'BUILDARGS' => sub {
52 11 ▶ my $orig = shift;
Subroutine __ANON__: called CC=5 SCAR=16.2
53 11 my $class = shift;
54  
55 11 ▶ if ( 2 == @_ && !ref $_[0] ) {
Branch: 1 branch
BranchTrueFalseTotal
if (2 == @_ and not ref $_[0]) 7 4 11
Condition66%2/3
2 == @_ and not ref $_[0]
!ll&&!rl&&r
407
MC/DC50%1/2
2 == @_ and not ref $_[0]
2 == @_ not ref $_[0]
Truth table66%2/3
A and not(B)
A= 2 == @_B= not ref $_[0]
ABresult
0X0
100
111
56 7 push @_, $EMPTY;
57 }
58 11 ▶ if ( @_ == $MORE_ARGS && !ref $_[0] ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == $MORE_ARGS and not ref $_[0]) 7 4 11
Condition66%2/3
@_ == $MORE_ARGS and not ref $_[0]
!ll&&!rl&&r
407
MC/DC50%1/2
@_ == $MORE_ARGS and not ref $_[0]
@_ == $MORE_ARGS not ref $_[0]
Truth table66%2/3
A and not(B)
A= @_ == $MORE_ARGSB= not ref $_[0]
ABresult
0X0
100
111
59 7 return $class->$orig(
60 'loginName' => $_[0],
61 'screenName' => $_[1],
62 'thumbnailUrl' => $_[2],
63 );
64 }
65 4 return $class->$orig(@_);
66 4 };
67  
68 4 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
69  
70 4 __PACKAGE__->meta->make_immutable;
71  
72 4 1;
73  
74 __END__
75  
76 =encoding utf8
77  
78 =for stopwords Bitbucket url Readonly Ipenburg login MERCHANTABILITY
79  
80 =head1 NAME
81  
82 WWW::Wookie::User - represent a possible user of a widget
83  
84 =head1 VERSION
85  
86 This document describes WWW::Wookie::User version C<v1.1.3>
87  
88 =head1 SYNOPSIS
89  
90 use WWW::Wookie::User;
91 $u = WWW::Wookie::User->new($login, $nick);
92  
93 =head1 DESCRIPTION
94  
95 A user represents a possible user of a widget. This class provides a standard
96 way of representing users in plugins for host environments.
97  
98 =head1 SUBROUTINES/METHODS
99  
100 =head2 C<new>
101  
102 Create a new user.
103  
104 =over
105  
106 =item 1. User login name as string
107  
108 =item 2. User display name as string
109  
110 =item 3. Optional thumbnail URL as string
111  
112 =back
113  
114 =head2 C<getLoginName>
115  
116 Get the login name for this user. Returns the user login name as string.
117  
118 =head2 C<getScreenName>
119  
120 Get the screen name for this user. This is the name that is intended to be
121 displayed on screen. In many cases it will be the same as the login name.
122 Returns the user display name as a string.
123  
124 =head2 C<setLoginName>
125  
126 Set the login name for this user. this is the value that is used by the user
127 to register on the system, it is guaranteed to be unique.
128  
129 =over
130  
131 =item 1. New login name as string
132  
133 =back
134  
135 =head2 C<setScreenName>
136  
137 Set the screen name for this user. This is the value that should be displayed
138 on screen. In many cases it will be the same as the login name.
139  
140 =over
141  
142 =item 1. New screen name as string
143  
144 =back
145  
146 =head2 C<getThumbnailUrl>
147  
148 Get the URL for a thumbnail representing this user. Returns the user thumbnail
149 icon url as string.
150  
151 =head2 C<setThumbnailUrl>
152  
153 Set the URL for a thumbnail representing this user.
154  
155 =over
156  
157 =item 1. New thumbnail URL as string
158  
159 =back
160  
161 =head1 CONFIGURATION AND ENVIRONMENT
162  
163 =head1 DEPENDENCIES
164  
165 =over 4
166  
167 =item * L<Moose|Moose>
168  
169 =item * L<Moose::Util::TypeConstraints|Moose::Util::TypeConstraints>
170  
171 =item * L<Readonly|Readonly>
172  
173 =item * L<namespace::autoclean|namespace::autoclean>
174  
175 =back
176  
177 =head1 INCOMPATIBILITIES
178  
179 =head1 DIAGNOSTICS
180  
181 =head1 BUGS AND LIMITATIONS
182  
183 Please report any bugs or feature requests at
184 L<Bitbucket|https://bitbucket.org/rolandvanipenburg/www-wookie/issues>.
185  
186 =head1 AUTHOR
187  
188 Roland van Ipenburg, E<lt>roland@rolandvanipenburg.comE<gt>
189  
190 =head1 LICENSE AND COPYRIGHT
191  
192 Copyright 2010-2021 by Roland van Ipenburg
193  
194 This library is free software; you can redistribute it and/or modify
195 it under the same terms as Perl itself, either Perl version 5.14.0 or,
196 at your option, any later version of Perl 5 you may have available.
197  
198 =head1 DISCLAIMER OF WARRANTY
199  
200 BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
201 FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
202 OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
203 PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
204 EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
205 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
206 ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
207 YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
208 NECESSARY SERVICING, REPAIR, OR CORRECTION.
209  
210 IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
211 WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
212 REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENSE, BE
213 LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL,
214 OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
215 THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
216 RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
217 FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
218 SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
219 SUCH DAMAGES.
220  
221 =cut
« blib/lib/WWW/Wookie/Server/Connection.pm ↑ Summary blib/lib/WWW/Wookie/Widget/Category.pm »