| 1 | package WiX3::XML::RemoveFolder; | ||
| 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( Maybe Str ); | ||
| 13 | use WiX3::Types qw( EnumRemoveFolderOn ); | ||
| 14 | use WiX3::Util::StrictConstructor; | ||
| 15 | |||
| 16 | our $VERSION = '0.011'; | ||
| 17 | |||
| 18 | with 'WiX3::XML::Role::Tag'; | ||
| 19 | |||
| 20 | # http://wix.sourceforge.net/manual-wix3/wix_xsd_createfolder.htm | ||
| 21 | |||
| 22 | ##################################################################### | ||
| 23 | # Accessors: | ||
| 24 | # None. | ||
| 25 | |||
| 26 | has directory => ( | ||
| 27 | is => 'ro', | ||
| 28 | isa => Maybe [Str], | ||
| 29 | reader => '_get_directory', | ||
| 30 | default => undef, | ||
| 31 | ); | ||
| 32 | |||
| 33 | has property => ( | ||
| 34 | is => 'ro', | ||
| 35 | isa => Maybe [Str], | ||
| 36 | reader => '_get_property', | ||
| 37 | default => undef, | ||
| 38 | ); | ||
| 39 | |||
| 40 | has id => ( | ||
| 41 | is => 'ro', | ||
| 42 | isa => Str, | ||
| 43 | reader => 'get_id', | ||
| 44 | required => 1, | ||
| 45 | ); | ||
| 46 | |||
| 47 | has on => ( | ||
| 48 | is => 'ro', | ||
| 49 | isa => EnumRemoveFolderOn, | ||
| 50 | reader => '_get_on', | ||
| 51 | required => 1, | ||
| 52 | ); | ||
| 53 | |||
| 54 | ##################################################################### | ||
| 55 | # Methods to implement the Tag role. | ||
| 56 | |||
| 57 | sub as_string { | ||
| 58 | my $self = shift; | ||
| 59 | my $string = '<RemoveFolder'; | ||
| 60 | |||
| 61 | my @attribute = ( | ||
| 62 | [ 'Id' => $self->get_id(), ], | ||
| 63 | [ 'On' => $self->_get_on(), ], | ||
| 64 | [ 'Directory' => $self->_get_directory(), ], | ||
| 65 | [ 'Property' => $self->_get_property(), ], | ||
| 66 | ); | ||
| 67 | |||
| 68 | my ( $k, $v ); | ||
| 69 | |||
| 70 | foreach my $ref (@attribute) { | ||
| 71 | ( $k, $v ) = @{$ref}; | ||
| 72 | $string .= $self->print_attribute( $k, $v ); | ||
| 73 | } | ||
| 74 | |||
| 75 | $string .= qq{ />\n}; | ||
| 76 | |||
| 77 | return $string; | ||
| 78 | |||
| 79 | } ## end sub as_string | ||
| 80 | |||
| 81 | sub get_namespace { | ||
| 82 | return q{xmlns='http://schemas.microsoft.com/wix/2006/wi'}; | ||
| 83 | } | ||
| 84 | |||
| 85 | no Moose; | ||
| 86 | __PACKAGE__->meta->make_immutable; | ||
| 87 | |||
| 88 | 1; | ||
| 89 | |||
| 90 | __END__ |