WiX3/XML/CustomAction.pm untested

filter: Statementstmt 0.0% 0 / 99 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 10 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 111 CC 1 SCAR 6.9
CC
1
Cov
0%
as_string
2.0
get_namespace
2.0
BEGIN
2.0
CRAP 2.0
1 package WiX3::XML::CustomAction;
2  
3 ####################################################################
4 # WiX3::XML::CustomAction - Object that represents a <CustomAction> tag.
5 #
6 # Copyright 2009, 2010 Curtis Jewell
7 #
8 # License is the same as perl. See WiX3.pm for details.
9 #
10 use 5.008003;
11  
12 # Must be done before Moose, or it won't get picked up.
13 use metaclass (
14 metaclass => 'Moose::Meta::Class',
15 error_class => 'WiX3::Util::Error',
16 );
17 use Moose 2;
18 use Params::Util qw( _IDENTIFIER _STRING );
19 use WiX3::Types qw( YesNoType );
20 use MooseX::Types::Moose qw( Str Maybe );
21 use WiX3::Util::StrictConstructor;
22  
23 our $VERSION = '0.011';
24  
25 # http://wix.sourceforge.net/manual-wix3/wix_xsd_customaction.htm
26  
27 with qw(WiX3::XML::Role::Tag WiX3::XML::Role::InnerText);
28  
29 # No child tags allowed.
30  
31 #####################################################################
32 # Accessors:
33 # see new.
34  
35 has id => (
36 is => 'ro',
37 isa => Str,
38 reader => 'get_id',
39 required => 1,
40 );
41  
42 has binarykey => (
43 is => 'ro',
44 isa => Maybe [Str],
45 reader => '_get_binarykey',
46 default => undef,
47 );
48  
49 has directory => (
50 is => 'ro',
51 isa => Maybe [Str],
52 reader => '_get_directory',
53 default => undef,
54 );
55  
56 has dllentry => (
57 is => 'ro',
58 isa => Maybe [Str],
59 reader => '_get_dllentry',
60 default => undef,
61 );
62  
63 has error => (
64 is => 'ro',
65 isa => Maybe [Str],
66 reader => '_get_error',
67 default => undef,
68 );
69  
70 has execommand => (
71 is => 'ro',
72 isa => Maybe [Str],
73 reader => '_get_execommand',
74 default => undef,
75 );
76  
77 # TODO: Enum
78 has execute => (
79 is => 'ro',
80 isa => Maybe [Str],
81 reader => '_get_execute',
82 default => undef,
83 );
84  
85 has filekey => (
86 is => 'ro',
87 isa => Maybe [YesNoType],
88 reader => '_get_filekey',
89 default => undef,
90 );
91  
92 has hidetarget => (
93 is => 'ro',
94 isa => Maybe [YesNoType],
95 reader => '_get_hidetarget',
96 default => undef,
97 );
98  
99 has impersonate => (
100 is => 'ro',
101 isa => Maybe [YesNoType],
102 reader => '_get_impersonate',
103 default => undef,
104 );
105  
106 has jscriptcall => (
107 is => 'ro',
108 isa => Maybe [Str],
109 reader => '_get_jscriptcall',
110 default => undef,
111 );
112  
113 has patchuninstall => (
114 is => 'ro',
115 isa => Maybe [YesNoType],
116 reader => '_get_patchuninstall',
117 default => undef,
118 );
119  
120 has property => (
121 is => 'ro',
122 isa => Maybe [Str],
123 reader => '_get_property',
124 default => undef,
125 );
126  
127 # TODO: Enum
128 has return => (
129 is => 'ro',
130 isa => Maybe [Str],
131 reader => '_get_return',
132 default => undef,
133 );
134  
135 # TODO: Enum
136 has script => (
137 is => 'ro',
138 isa => Maybe [Str],
139 reader => '_get_script',
140 default => undef,
141 );
142  
143 has suppressmodularization => (
144 is => 'ro',
145 isa => Maybe [YesNoType],
146 reader => '_get_suppressmodularization',
147 default => undef,
148 );
149  
150 has terminalserveraware => (
151 is => 'ro',
152 isa => Maybe [YesNoType],
153 reader => '_get_terminalserveraware',
154 default => undef,
155 );
156  
157 has value => (
158 is => 'ro',
159 isa => Maybe [Str],
160 reader => '_get_value',
161 default => undef,
162 );
163  
164 has vbscriptcall => (
165 is => 'ro',
166 isa => Maybe [Str],
167 reader => '_get_vbscriptcall',
168 default => undef,
169 );
170  
171 has win64 => (
172 is => 'ro',
173 isa => Maybe [YesNoType],
174 reader => '_get_win64',
175 default => undef,
176 );
177  
178 #####################################################################
179 # Main Methods
180  
181 ########################################
182 # as_string
183 # Parameters:
184 # None.
185 # Returns:
186 # String containing <Environment> tag defined by this object.
187  
188 sub as_string {
189 my $self = shift;
190  
191 my $id = 'CA_' . $self->get_id();
192  
193 my $string;
194 $string = '<CustomAction';
195  
196 my @attribute = (
197 [ 'Id' => $id, ],
198 [ 'BinaryKey' => $self->_get_binarykey(), ],
199 [ 'Directory' => $self->_get_directory(), ],
200 [ 'DllEntry' => $self->_get_dllentry(), ],
201 [ 'ExeCommand' => $self->_get_execommand(), ],
202 [ 'Execute' => $self->_get_execute(), ],
203 [ 'FileKey' => $self->_get_filekey(), ],
204 [ 'HideTarget' => $self->_get_hidetarget(), ],
205 [ 'Impersonate' => $self->_get_impersonate(), ],
206 [ 'JScriptCall' => $self->_get_jscriptcall(), ],
207 [ 'PatchUninstall' => $self->_get_patchuninstall(), ],
208 [ 'Property' => $self->_get_property(), ],
209 [ 'Return' => $self->_get_return(), ],
210 [ 'Script' => $self->_get_script(), ],
211 [ 'SuppressModularization' =>
212 $self->_get_suppressmodularization(),
213 ],
214 [ 'TerminalServerAware' => $self->_get_terminalserveraware(), ],
215 [ 'Value' => $self->_get_value(), ],
216 [ 'VBScriptCall' => $self->_get_vbscriptcall(), ],
217 [ 'Win64' => $self->_get_win64(), ],
218 );
219  
220 my ( $k, $v );
221  
222 foreach my $ref (@attribute) {
223 ( $k, $v ) = @{$ref};
224 $string .= $self->print_attribute( $k, $v );
225 }
226  
227 $string .= $self->inner_text_as_string();
228  
229 return $string;
230 } ## end sub as_string
231  
232 sub get_namespace {
233 return q{xmlns='http://schemas.microsoft.com/wix/2006/wi'};
234 }
235  
236 no Moose;
237 __PACKAGE__->meta->make_immutable;
238  
239 1;