WiX3/XML/Icon.pm untested

filter: Statementstmt 0.0% 0 / 39 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 9 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 56 CC 4 SCAR 20.8
CC
4
Cov
0%
as_string
20.0
get_namespace
2.0
BEGIN
2.0
CRAP 8.0
1 package WiX3::XML::Icon;
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 Params::Util qw( _STRING );
12 use MooseX::Types::Moose qw( Str );
13 use WiX3::Util::StrictConstructor;
14  
15 our $VERSION = '0.011';
16  
17 # http://wix.sourceforge.net/manual-wix3/wix_xsd_icon.htm
18  
19 with 'WiX3::XML::Role::Tag';
20  
21 ## Allows no child tags.
22  
23 has id => (
24 is => 'ro',
25 isa => Str,
26 reader => 'get_id',
27 required => 1,
28 );
29  
30 has sourcefile => (
31 is => 'ro',
32 isa => Str,
33 reader => 'get_sourcefile',
34 required => 1,
35 );
36  
37 #####################################################################
38 # Methods to implement the Tag role.
39  
40 sub as_string {
41 my $self = shift;
42  
43 my $directory = $self->_get_directory();
44 my $children = $self->has_child_tags();
45  
46 if ($children) {
47 my $child_string = $self->as_string_children();
48 if ( defined $directory ) {
49 return
50 qq{<CreateFolder Directory='$directory'>\n$child_string<CreateFolder />\n};
51 } else {
52 return qq{<CreateFolder>\n$child_string<CreateFolder />\n};
53 }
54 } else {
55 if ( defined $directory ) {
56 return qq{<CreateFolder Directory='$directory' />\n};
57 } else {
58 return qq{<CreateFolder />\n};
59 }
60 }
61  
62 } ## end sub as_string
63  
64 sub get_namespace {
65 return q{xmlns='http://schemas.microsoft.com/wix/2006/wi'};
66 }
67  
68 no Moose;
69 __PACKAGE__->meta->make_immutable;
70  
71 1;
72  
73 __END__