lib/PurpleWiki/User.pm untested

filter: Statementstmt 0.0% 0 / 38 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 10 Podpod 0.0% 0 / 8 totaltotal 0.0% 0 / 71 CC 7 SCAR 16.1
CC
7
Cov
0%
new
6.0
id
6.0
username
6.0
CRAP 5.0
1 # PurpleWiki::User.pm
2 # vi:sw=4:ts=4:ai:sm:et:tw=0
3 #
4 # $Id: User.pm 463 2004-08-09 01:31:48Z cdent $
5 #
6 # Copyright (c) Blue Oxen Associates 2002-2004. All rights reserved.
7 #
8 # This file is part of PurpleWiki. PurpleWiki is derived from:
9 #
10 # UseModWiki v0.92 (c) Clifford A. Adams 2000-2001
11 # AtisWiki v0.3 (c) Markus Denker 1998
12 # CVWiki CVS-patches (c) Peter Merel 1997
13 # The Original WikiWikiWeb (c) Ward Cunningham
14 #
15 # PurpleWiki is free software; you can redistribute it and/or modify
16 # it under the terms of the GNU General Public License as published by
17 # the Free Software Foundation; either version 2 of the License, or
18 # (at your option) any later version.
19 #
20 # This program is distributed in the hope that it will be useful,
21 # but WITHOUT ANY WARRANTY; without even the implied warranty of
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 # GNU General Public License for more details.
24 #
25 # You should have received a copy of the GNU General Public License
26 # along with this program; if not, write to the
27 # Free Software Foundation, Inc.
28 # 59 Temple Place, Suite 330
29 # Boston, MA 02111-1307 USA
30  
31 package PurpleWiki::User;
32  
33 use strict;
34 use PurpleWiki::Config;
35  
36 our $VERSION;
37 $VERSION = sprintf("%d", q$Id: User.pm 463 2004-08-09 01:31:48Z cdent $ =~ /\s(\d+)\s/);
38  
39 sub new {
40 my $class = shift;
41 my $userId = shift;
42 my $self = {};
43 $self->{config} = PurpleWiki::Config->instance();
44 $self->{id} = $userId if ($userId);
45 bless ($self, $class);
46 return $self;
47 }
48  
49 ### accessors/mutators
50  
51 sub id {
52 my $self = shift;
53  
54 $self->{id} = shift if @_;
55 return $self->{id};
56 }
57  
58 sub username {
59 my $self = shift;
60  
61 $self->{username} = shift if @_;
62 return $self->{username};
63 }
64  
65 sub tzOffset {
66 my $self = shift;
67  
68 $self->{tzOffset} = shift if @_;
69 return $self->{tzOffset};
70 }
71  
72 sub createTime {
73 my $self = shift;
74  
75 $self->{createTime} = shift if @_;
76 return $self->{createTime};
77 }
78  
79 sub createIp {
80 my $self = shift;
81  
82 $self->{createIp} = shift if @_;
83 return $self->{createIp};
84 }
85  
86 # the following may eventually go away. here mostly for backwards
87 # compatibility.
88  
89 sub getField {
90 my $self = shift;
91 my $field = shift;
92  
93 return ($self->{$field} || '');
94 }
95  
96 sub setField {
97 my $self = shift;
98 my $field = shift;
99 my $value = shift;
100  
101 $self->{$field} = $value;
102 }
103  
104 1;
105 __END__