WebApp/User.pm

filter: Statementstmt 90.9% 20 / 22 Branchbran 75.0% 3 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 50.0% 1 / 2 totaltotal 87.8% 29 / 33 CC 3 SCAR 5.1
CC
3
Cov
88%
types
2.3
id
2.0
BEGIN
1.0
CRAP 1.7
« WebApp/Template.pm ↑ Summary WebApp/Template/Error.pm »
1 =head1 NAME
2  
3 OpenFrame::WebApp::User - users for OpenFrame-WebApp
4  
5 =head1 SYNOPSIS
6  
7 use OpenFrame::WebApp::User;
8  
9 my $user = new OpenFrame::WebApp::User()->id('fred2003');
10  
11 =cut
12  
13 package OpenFrame::WebApp::User;
14  
15 7 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 7 ▶use warnings::register;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 7 our $VERSION = (split(/ /, '$Revision: 1.5 $'))[1];
19  
20 7 ▶use base qw( OpenFrame::Object );
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 7 our $TYPES = { webapp => __PACKAGE__ };
23  
24 15 ▶sub types {
Subroutine types: called CC=2 SCAR=8.4
Pod undocumented
25 15 my $self = shift;
26 15 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 15 15
27 0 $TYPES = shift;
28 0 return $self;
29 } else {
30 15 return $TYPES;
31 }
32 }
33  
34 8 ▶sub id {
Subroutine id: called CC=2 SCAR=6.9
Pod documented
35 8 my $self = shift;
36 8 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 4 4 8
37 4 $self->{user_id} = shift;
38 4 return $self;
39 } else {
40 4 return $self->{user_id};
41 }
42 }
43  
44 7 1;
45  
46 =head1 DESCRIPTION
47  
48 The C<OpenFrame::WebApp::User> class implements a I<very> basic user with an
49 identifier, and nothing more. This class exists to be sub-classed to suit
50 your application's needs.
51  
52 This class was meant to be used with L<OpenFrame::WebApp::User::Factory>.
53  
54 =head1 METHODS
55  
56 =over 4
57  
58 =item $user->id
59  
60 set/get the user id. chosen over 'login' and 'name' as these can have other
61 menaings & actions associated with them.
62  
63 =back
64  
65 =head1 SUB-CLASSING
66  
67 Read through the source of this package and the known sub-classes first.
68 The minumum you need to do is this:
69  
70 use base qw( OpenFrame::WebApp::User );
71  
72 OpenFrame::WebApp::User->types->{my_type} = __PACKAGE__;
73  
74 You must register your user type if you want to use the User::Factory.
75  
76 =head1 AUTHOR
77  
78 Steve Purkis <spurkis@epn.nu>
79  
80 =head1 COPYRIGHT
81  
82 Copyright (c) 2003 Steve Purkis. All rights reserved.
83 Released under the same license as Perl itself.
84  
85 =head1 SEE ALSO
86  
87 L<OpenFrame::WebApp::User::Factory>,
88 L<OpenFrame::WebApp::Segment::User::Loader>
89  
90 =cut
« WebApp/Template.pm ↑ Summary WebApp/Template/Error.pm »