SJ/VirtualMachine.pm untested

filter: Statementstmt 0.0% 0 / 75 Branchbran 0.0% 0 / 20 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 13 Podpod 0.0% 0 / 11 totaltotal 0.0% 0 / 119 CC 11 SCAR 19.0
CC
11
Cov
0%
default
12.0
add_param
12.0
name
6.0
CRAP 6.7
1 ###########################################################################
2 #
3 # Java::SJ::VirtualMachine
4 #
5 # $Id: VirtualMachine.pm,v 1.3 2003/07/20 18:52:21 wiggly Exp $
6 #
7 # $Author: wiggly $
8 #
9 # $DateTime$
10 #
11 # $Revision: 1.3 $
12 #
13 ###########################################################################
14  
15 package Java::SJ::VirtualMachine;
16  
17 use Carp;
18 use Data::Dumper;
19  
20 our $VERSION = '0.01';
21  
22 ###########################################################################
23 #
24 # Constructor
25 #
26 ###########################################################################
27 sub new
28 {
29 my $class = shift;
30 my $self = {};
31 bless $self, $class;
32  
33 # attributes
34 $self->{'name'} = '';
35 $self->{'vendor'} = '';
36 $self->{'version'} = '';
37 $self->{'language'} = '';
38 $self->{'home'} = '';
39 $self->{'default'} = '';
40 $self->{'ref'} = '';
41  
42 # properties
43 $self->{'prop'} = undef;
44  
45 # environment
46 $self->{'env'} = undef;
47  
48 # environment
49 $self->{'param'} = undef;
50  
51 #print STDERR "[DEBUG] VIRTUAL MACHINE\n" . Dumper( $self ) . "\n\n";
52 return $self;
53 }
54  
55 ###########################################################################
56 #
57 # name
58 #
59 ###########################################################################
60 sub name
61 {
62 my $self = shift;
63 my $arg = shift;
64  
65 if( $arg )
66 {
67 $self->{'name'} = $arg;
68 }
69  
70 $self->{'name'};
71 }
72  
73 ###########################################################################
74 #
75 # vendor
76 #
77 ###########################################################################
78 sub vendor
79 {
80 my $self = shift;
81 my $arg = shift;
82  
83 if( $arg )
84 {
85 $self->{'vendor'} = $arg;
86 }
87  
88 $self->{'vendor'};
89 }
90  
91 ###########################################################################
92 #
93 # version
94 #
95 ###########################################################################
96 sub version
97 {
98 my $self = shift;
99 my $arg = shift;
100  
101 if( $arg )
102 {
103 $self->{'version'} = $arg;
104 }
105  
106 $self->{'version'};
107 }
108  
109 ###########################################################################
110 #
111 # language
112 #
113 ###########################################################################
114 sub language
115 {
116 my $self = shift;
117 my $arg = shift;
118  
119 if( $arg )
120 {
121 $self->{'language'} = $arg;
122 }
123  
124 $self->{'language'};
125 }
126  
127 ###########################################################################
128 #
129 # home
130 #
131 ###########################################################################
132 sub home
133 {
134 my $self = shift;
135 my $arg = shift;
136  
137 if( $arg )
138 {
139 $self->{'home'} = $arg;
140 }
141  
142 $self->{'home'};
143 }
144  
145 ###########################################################################
146 #
147 # default
148 #
149 ###########################################################################
150 sub default
151 {
152 my $self = shift;
153 my $arg = shift;
154  
155 if( $arg )
156 {
157 if( $arg =~ m/^(true|1|y|yes)$/i )
158 {
159 $self->{'default'} = 1;
160 }
161 else
162 {
163 $self->{'default'} = 0;
164 }
165 }
166  
167 $self->{'default'};
168 }
169  
170 ###########################################################################
171 #
172 # ref
173 #
174 ###########################################################################
175 sub ref
176 {
177 my $self = shift;
178 my $arg = shift;
179  
180 if( $arg )
181 {
182 $self->{'ref'} = $arg;
183 }
184  
185 $self->{'ref'};
186 }
187  
188 ###########################################################################
189 #
190 # add_property
191 #
192 ###########################################################################
193 sub add_property
194 {
195 my $self = shift;
196 my $name = shift;
197 my $value = shift;
198 $self->{'prop'}{$name} = $value;
199 1;
200 }
201  
202 ###########################################################################
203 #
204 # add_environment
205 #
206 ###########################################################################
207 sub add_environment
208 {
209 my $self = shift;
210 my $name = shift;
211 my $value = shift;
212 $self->{'env'}{$name} = $value;
213 1;
214 }
215  
216 ###########################################################################
217 #
218 # add_param
219 #
220 ###########################################################################
221 sub add_param
222 {
223 my $self = shift;
224 my $name = shift;
225 my $value = shift;
226 my $sep = shift;
227  
228 if( $sep =~ /^$/ )
229 {
230 $sep = ' ';
231 }
232  
233 if( $value !~ /^$/ )
234 {
235 $self->{'param'}{$name} = $sep . $value;
236 }
237 else
238 {
239 $self->{'param'}{$name} = '';
240 }
241 1;
242 }
243  
244  
245  
246  
247 ###########################################################################
248 1;
249  
250 =pod
251  
252 =head1 NAME
253  
254 Java::SJ::VirtualMachine - Java virtual machine
255  
256 =head1 DESCRIPTION
257  
258 This module is used by L<Java::SJ::Config> when generating virtual machine
259 representations.
260  
261 =head1 TODO
262  
263 Test, test, test.
264  
265 =head1 BUGS
266  
267 None known so far. Please report any and all to Nigel Rantor <F<wiggly@wiggly.org>>
268  
269 =head1 SUPPORT / WARRANTY
270  
271 This module is free software. IT COMES WITHOUT WARRANTY OF ANY KIND.
272  
273 =head1 LICENSE
274  
275 The Java::SJ::VirtualMachine module is Copyright (c) 2003 Nigel Rantor.
276 England. All rights reserved.
277  
278 You may distribute under the terms of either the GNU General Public License
279 or the Artistic License, as specified in the Perl README file.
280  
281 =head1 AUTHORS
282  
283 Nigel Rantor <F<wiggly@wiggly.org>>
284  
285 =head1 SEE ALSO
286  
287 L<Java::SJ>. L<Java::SJ::Config>.
288  
289 =cut