WiX3/XML/RegistryKey.pm untested

filter: Statementstmt 0.0% 0 / 49 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 10 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 65 CC 3 SCAR 15.0
CC
3
Cov
0%
as_string
12.0
get_namespace
2.0
BEGIN
2.0
CRAP 4.5
1 package WiX3::XML::RegistryKey;
2  
3 ####################################################################
4 # WiX3::XML::RegistryKey - Object that represents an <RegistryKey> tag.
5 #
6 # Copyright 2010 Curtis Jewell, Alexandr Ciornii
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( EnumRegistryRootType EnumRegistryKeyAction );
20 use MooseX::Types::Moose qw( Str Maybe Bool );
21 use WiX3::Util::StrictConstructor;
22  
23 our $VERSION = '0.011';
24  
25 # http://wix.sourceforge.net/manual-wix3/wix_xsd_registrykey.htm
26  
27 with 'WiX3::XML::Role::TagAllowsChildTags';
28  
29 # Has WiX3::XML::RegistryKey and WiX3::XML::RegistryValue as children.
30  
31 #####################################################################
32 # Accessors:
33 # see new.
34  
35 has id => (
36 is => 'ro',
37 isa => Str,
38 reader => 'get_id',
39 required => 0,
40 );
41  
42 has action => (
43 is => 'ro',
44 isa => EnumRegistryKeyAction,
45 reader => '_get_action',
46 );
47  
48 has root => (
49 is => 'ro',
50 isa => EnumRegistryRootType,
51 reader => '_get_root',
52 );
53  
54 has key => (
55 is => 'ro',
56 isa => Maybe [Str],
57 reader => '_get_key',
58 );
59  
60 #####################################################################
61 # Main Methods
62  
63 ########################################
64 # as_string
65 # Parameters:
66 # None.
67 # Returns:
68 # String containing <RegistryKey> tag defined by this object.
69  
70 sub as_string {
71 my $self = shift;
72  
73 my $id;
74 if ( $self->get_id() ) {
75 $id = 'RK_' . $self->get_id();
76 }
77  
78 # Print tag.
79 my $answer;
80 $answer = '<RegistryKey';
81 $answer .= $self->print_attribute( 'Id', $id );
82 $answer .= $self->print_attribute( 'Root', $self->_get_root() );
83 $answer .= $self->print_attribute( 'Key', $self->_get_key() );
84 $answer .= $self->print_attribute( 'Action', $self->_get_action() );
85 $answer .= ">\n";
86 my $child_string = q{};
87 $child_string = $self->indent( 2, $self->as_string_children() )
88 if $self->has_child_tags();
89 chomp $child_string;
90 $answer .= "$child_string\n</RegistryKey>\n";
91  
92 return $answer;
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;