WiX3/XML/CreateFolder.pm untested

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