Strip/Account.pm untested

filter: Statementstmt 0.0% 0 / 37 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 9 Podpod 0.0% 0 / 6 totaltotal 0.0% 0 / 62 CC 6 SCAR 29.5
CC
6
Cov
0%
new
42.0
get_system
2.0
get_username
2.0
CRAP 19.1
1 package Palm::Zetetic::Strip::Account;
2  
3 use strict;
4  
5 use vars qw(@ISA $VERSION);
6  
7 require Exporter;
8  
9 @ISA = qw(Palm::Raw);
10 $VERSION = "1.02";
11  
12 =head1 NAME
13  
14 Palm::Zetetic::Strip::Account - An immutable account object
15  
16 =head1 SYNOPSIS
17  
18 use Palm::Zetetic::Strip;
19  
20 # Create and load a new Palm::Zetetic::Strip object
21  
22 @accounts = $strip->get_accounts();
23 $system = $accounts[0]->get_system();
24 $username = $accounts[0]->get_username();
25 $password = $accounts[0]->get_password();
26 $system_id = $accouns[0]->get_system_id();
27 $comment = $accounts[0]->get_comment();
28  
29 =head1 DESCRIPTION
30  
31 This is an immutable data object that represents an account. A
32 Palm::Zetetic::Strip(3) object is a factory for account objects.
33  
34 =head1 METHODS
35  
36 =cut
37  
38 sub new
39 {
40 my $class = shift;
41 my (%args) = @_;
42 my $self = {};
43  
44 bless $self, $class;
45 $self->{system} = "";
46 $self->{username} = "";
47 $self->{password} = "";
48 $self->{system_id} = "";
49 $self->{comment} = "";
50  
51 $self->{system} = $args{system} if defined($args{system});
52 $self->{username} = $args{username} if defined($args{username});
53 $self->{password} = $args{password} if defined($args{password});
54 $self->{system_id} = $args{system_id} if defined($args{system_id});
55 $self->{comment} = $args{comment} if defined($args{comment});
56 return $self;
57 }
58  
59 =head2 get_system
60  
61 $system = $account->get_system();
62  
63 Returns the system name. B<Note:> this has nothing to do with the
64 name of a Palm::Zetetic::Strip::System(3) object. This is what the
65 user enters as a system name.
66  
67 =cut
68  
69 sub get_system
70 {
71 my ($self) = @_;
72 return $self->{system};
73 }
74  
75 =head2 get_username
76  
77 $username = $account->get_username();
78  
79 Returns the username.
80  
81 =cut
82  
83 sub get_username
84 {
85 my ($self) = @_;
86 return $self->{username};
87 }
88  
89 =head2 get_password
90  
91 $password = $account->get_password();
92  
93 Returns the password.
94  
95 =cut
96  
97 sub get_password
98 {
99 my ($self) = @_;
100 return $self->{password};
101 }
102  
103 =head2 get_system_id
104  
105 $system_id = $account->get_system_id();
106  
107 Returns the system ID. This can be used to lookup a
108 Palm::Zetetic::Strip::System(3) object.
109  
110 =cut
111  
112 sub get_system_id
113 {
114 my ($self) = @_;
115 return $self->{system_id};
116 }
117  
118 =head2 get_comment
119  
120 $comment = $account->get_comment();
121  
122 Returns the comment.
123  
124 =cut
125  
126 sub get_comment
127 {
128 my ($self) = @_;
129 return $self->{comment};
130 }
131  
132 1;
133  
134 __END__