Wombat/Core/MapperBase.pm untested

filter: Statementstmt 0.0% 0 / 30 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 10 Podpod 0.0% 0 / 6 totaltotal 0.0% 0 / 48 CC 2 SCAR 10.0
CC
2
Cov
0%
new
6.0
getContainer
2.0
setContainer
2.0
CRAP 2.7
1 # -*- Mode: Perl; indent-tabs-mode: nil; -*-
2  
3 package Wombat::Core::MapperBase;
4  
5 =pod
6  
7 =head1 NAME
8  
9 Wombat::Core::MapperBase - internal mapper base class
10  
11 =head1 SYNOPSIS
12  
13 =head1 DESCRIPTION
14  
15 Convenience base implementation of B<Wombat::Mapper>. Classes
16 extending this base class must implement C<map()>.
17  
18 =cut
19  
20 use base qw(Wombat::Mapper);
21 use fields qw(container protocol);
22 use strict;
23 use warnings;
24  
25 =pod
26  
27 =head1 CONSTRUCTOR
28  
29 =over
30  
31 =item new()
32  
33 Construct and return a B<Wombat::Core::MapperBase> instance,
34 initializing fields appropriately. If subclasses override the
35 constructor, they must be sure to call
36  
37 $self->SUPER::new();
38  
39 =back
40  
41 =cut
42  
43 sub new {
44 my $self = shift;
45  
46 $self = fields::new($self) unless ref $self;
47  
48 $self->{container} = undef;
49 $self->{protocol} = undef;
50  
51 return $self;
52 }
53  
54 =pod
55  
56 =head1 ACCESSOR METHODS
57  
58 =over
59  
60 =item getContainer()
61  
62 Return the Container with which the Mapper is associated.
63  
64 =cut
65  
66 sub getContainer {
67 my $self = shift;
68  
69 return $self->{container};
70 }
71  
72 =pod
73  
74 =item setContainer($container)
75  
76 Set the Container with which the Mapper is associated.
77  
78 B<Parameters:>
79  
80 =over
81  
82 =item $container
83  
84 the B<Wombat::Container> used for processing Requests
85  
86 =back
87  
88 B<Throws:>
89  
90 =over
91  
92 =item B<Servlet::Util::IllegalArgumentException>
93  
94 if the Container is not acceptable to this Mapper
95  
96 =back
97  
98 =cut
99  
100 sub setContainer {
101 my $self = shift;
102 my $container = shift;
103  
104 $self->{container} = $container;
105  
106 return 1;
107 }
108  
109 =pod
110  
111 =item getProtocol()
112  
113 Return the protocol for which this Mapper is responsible.
114  
115 =cut
116  
117 sub getProtocol {
118 my $self = shift;
119  
120 return $self->{protocol};
121 }
122  
123 =pod
124  
125 =item setProtocol($protocol)
126  
127 Set the protocol for which this Mapper is responsible.
128  
129 B<Parameters:>
130  
131 =over
132  
133 =item $protocol
134  
135 the protocol
136  
137 =back
138  
139 =cut
140  
141 sub setProtocol {
142 my $self = shift;
143 my $protocol = shift;
144  
145 $self->{protocol} = $protocol;
146  
147 return 1;
148 }
149  
150 =pod
151  
152 =back
153  
154 =head1 PUBLIC METHODS
155  
156 =over
157  
158 =item map($request)
159  
160 Return the child Container that should be used to process the
161 Request, or C<undef> f no such child Container can be identified.
162  
163 B<Parameters:>
164  
165 =over
166  
167 =item $request
168  
169 the B<Wombat::Request> being processed
170  
171 =back
172  
173 =cut
174  
175 sub map {}
176  
177 1;
178 __END__