WiX3/XML/Custom.pm untested

filter: Statementstmt 0.0% 0 / 56 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 10 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 68 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::Custom;
2  
3 ####################################################################
4 # WiX3::XML::Custom - Object that represents an <Custom> tag.
5 #
6 # Copyright 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 Int Maybe );
21 use WiX3::Util::StrictConstructor;
22  
23 our $VERSION = '0.011';
24  
25 # http://wix.sourceforge.net/manual-wix3/wix_xsd_custom.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 action => (
36 is => 'ro',
37 isa => Str,
38 reader => '_get_action',
39 required => 1,
40 );
41  
42 has after => (
43 is => 'ro',
44 isa => Str,
45 reader => '_get_after',
46 default => undef,
47 );
48  
49 has before => (
50 is => 'ro',
51 isa => Maybe [Str],
52 reader => '_get_before',
53 default => undef,
54 );
55  
56 # TODO: This one is an enums. Define a type accordingly.
57  
58 has onexit => (
59 is => 'ro',
60 isa => Maybe [Str],
61 reader => '_get_onexit',
62 default => undef,
63 );
64  
65 has overridable => (
66 is => 'ro',
67 isa => Maybe [YesNoType],
68 reader => '_get_overridable',
69 default => undef,
70 );
71  
72 has sequence => (
73 is => 'ro',
74 isa => Maybe [Int],
75 reader => '_get_sequence',
76 default => undef,
77 );
78  
79 #####################################################################
80 # Main Methods
81  
82 sub as_string {
83 my $self = shift;
84  
85 my $string;
86 $string = '<Custom';
87  
88 my @attribute = (
89 [ 'Action' => $self->_get_action(), ],
90 [ 'After' => $self->_get_after(), ],
91 [ 'Before' => $self->_get_before(), ],
92 [ 'OnExit' => $self->_get_onexit(), ],
93 [ 'Overridable' => $self->_get_overridable(), ],
94 [ 'Sequence' => $self->_get_sequence(), ],
95 );
96  
97 my ( $k, $v );
98  
99 foreach my $ref (@attribute) {
100 ( $k, $v ) = @{$ref};
101 $string .= $self->print_attribute( $k, $v );
102 }
103  
104 $string .= $self->inner_text_as_string();
105  
106 return $string;
107 } ## end sub as_string
108  
109 sub get_namespace {
110 return q{xmlns='http://schemas.microsoft.com/wix/2006/wi'};
111 }
112  
113 no Moose;
114 __PACKAGE__->meta->make_immutable;
115  
116 1;