WiX3/XML/Merge.pm untested

filter: Statementstmt 0.0% 0 / 50 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 10 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 75 CC 3 SCAR 15.0
CC
3
Cov
0%
BUILDARGS
12.0
as_string
2.0
get_namespace
2.0
CRAP 4.5
1 package WiX3::XML::Merge;
2  
3 use 5.008003;
4  
5 # Must be done before Moose, or it won't get picked up.
6 use metaclass (
7 metaclass => 'Moose::Meta::Class',
8 error_class => 'WiX3::Util::Error',
9 );
10 use Moose 2;
11 use WiX3::Util::StrictConstructor;
12 use WiX3::Types qw( YesNoType );
13 use MooseX::Types::Moose qw( Str Int Maybe );
14  
15 our $VERSION = '0.011';
16  
17 # http://wix.sourceforge.net/manual-wix3/wix_xsd_merge.htm
18  
19 with 'WiX3::Role::Traceable';
20 with 'WiX3::XML::Role::Tag';
21  
22 has id => (
23 is => 'ro',
24 isa => Str,
25 required => 1,
26 reader => 'get_id',
27 );
28  
29 has disk_id => (
30 is => 'ro',
31 isa => Maybe [Int],
32 reader => '_get_disk_id',
33 default => 1,
34 );
35  
36 has file_compression => (
37 is => 'ro',
38 isa => Maybe [Str],
39 reader => '_get_file_compression',
40 default => undef,
41 );
42  
43 has language => (
44 is => 'ro',
45 isa => Int,
46 reader => '_get_language',
47 );
48  
49 has source_file => (
50 is => 'ro',
51 isa => Maybe [Str],
52 reader => '_get_source_file',
53 default => undef,
54 );
55  
56  
57 #####################################################################
58 # Main Methods
59  
60 sub BUILDARGS {
61 my $class = shift;
62  
63 if ( @_ == 1 && !ref $_[0] ) {
64 return { id => $_[0] };
65 } elsif ( @_ == 1 && 'HASH' eq ref $_[0] ) {
66 return $_[0];
67 } else {
68 my %hash = @_;
69 return \%hash;
70 }
71  
72 return;
73 } ## end sub BUILDARGS
74  
75 #####################################################################
76 # Methods to implement the Tag role.
77  
78 sub as_string {
79 my $self = shift;
80  
81 my $tags;
82  
83 $tags .= $self->print_attribute( 'Id', 'Merge_' . $self->get_id() );
84 $tags .= $self->print_attribute( 'DiskId', $self->_get_disk_id() );
85 $tags .=
86 $self->print_attribute( 'FileCompression',
87 $self->_get_file_compression() );
88 $tags .= $self->print_attribute( 'Language', $self->_get_language() );
89 $tags .=
90 $self->print_attribute( 'SourceFile', $self->_get_source_file() );
91  
92 return qq{<Merge$tags />\n};
93 } ## end sub as_string
94  
95 sub get_namespace {
96 return q{xmlns='http://schemas.microsoft.com/wix/2006/wi'};
97 }
98  
99 no Moose;
100 __PACKAGE__->meta->make_immutable;
101  
102 1;
103  
104 __END__