WiX3/XML/Fragment.pm untested

filter: Statementstmt 0.0% 0 / 38 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 9 Podpod 0.0% 0 / 4 totaltotal 0.0% 0 / 65 CC 4 SCAR 16.4
CC
4
Cov
0%
BUILDARGS
12.0
as_string
6.0
get_namespace
2.0
CRAP 5.2
1 package WiX3::XML::Fragment;
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  
13 our $VERSION = '0.011';
14  
15 # http://wix.sourceforge.net/manual-wix3/wix_xsd_fragment.htm
16  
17 with 'WiX3::Role::Traceable';
18 with 'WiX3::XML::Role::Fragment';
19 with 'WiX3::XML::Role::TagAllowsChildTags';
20  
21 #####################################################################
22 # Main Methods
23  
24 sub BUILDARGS {
25 my $class = shift;
26  
27 if ( @_ == 1 && !ref $_[0] ) {
28 return { id => $_[0] };
29 } elsif ( @_ == 1 && 'HASH' eq ref $_[0] ) {
30 return $_[0];
31 } else {
32 my %hash = @_;
33 return \%hash;
34 }
35  
36 return;
37 } ## end sub BUILDARGS
38  
39 #####################################################################
40 # Methods to implement the Tag role.
41  
42 sub as_string {
43 my $self = shift;
44  
45 my @namespaces = $self->get_namespaces();
46 my $namespaces = join q{ }, @namespaces;
47 my $id = 'Fr_' . $self->get_id();
48 my $child_string = q{};
49 $child_string = $self->indent( 2, $self->as_string_children() )
50 if $self->has_child_tags();
51 chomp $child_string;
52  
53 return <<"EOF";
54 <?xml version='1.0' encoding='windows-1252'?>
55 <Wix $namespaces>
56 <Fragment Id='$id'>
57 $child_string
58 </Fragment>
59 </Wix>
60 EOF
61 } ## end sub as_string
62  
63 sub get_namespace {
64 return q{xmlns='http://schemas.microsoft.com/wix/2006/wi'};
65 }
66  
67 #####################################################################
68 # Methods to implement the Tag role.
69  
70 # Unless this method is overwritten, this fragment does not need
71 # to regenerate itself before the .msi/.msm is built.
72  
73 sub regenerate {
74 return;
75 }
76  
77 no Moose;
78 __PACKAGE__->meta->make_immutable;
79  
80 1;
81  
82 __END__