| Perl-Dist-WiX documentation | Contained in the Perl-Dist-WiX distribution. |
Perl::Dist::WiX::Types - Public types used in Perl::Dist::WiX.
This document describes Perl::Dist::WiX::Types version 1.500001.
use Perl::Dist::WiX::Types qw( ExistingDirectory ExistingFile TemplateObj );
This module exists to provide Moose types that Perl::Dist::WiX and subclasses can use.
It may be updated or replaced at any time.
has bar => ( is => 'ro', isa => ExistingDirectory, #... );
has bar => ( is => 'ro', isa => ExistingFile, #... );
has bar => ( is => 'ro', isa => TemplateObj, #... );
No support is available for this class.
Curtis Jewell <csjewell@cpan.org>
Copyright 2009 - 2011 Curtis Jewell.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this distribution.
| Perl-Dist-WiX documentation | Contained in the Perl-Dist-WiX distribution. |
package Perl::Dist::WiX::Types;
use 5.010; use MooseX::Types -declare => [ qw( ExistingDirectory ExistingFile TemplateObj _NoDoubleSlashes _NoSpaces _NoForwardSlashes _NoSlashAtEnd _NotRootDir _NoDots ExistingSubdirectory ExistingDirectory_Spaceless ExistingDirectory_SaneSlashes DirectoryRef DirectoryTag ) ]; use MooseX::Types::Moose qw( Str Object ArrayRef ); use MooseX::Types::Path::Class qw( Dir File ); use Template qw(); our $VERSION = '1.500001'; $VERSION =~ s/_//ms;
subtype ExistingDirectory, as Dir, where { -d "$_" }, message {'Directory does not exist'}; subtype _NoDoubleSlashes, as ExistingDirectory, where { "$_" !~ m{\\\\}ms }, message {'cannot contain two consecutive slashes'}; subtype _NoForwardSlashes, as _NoDoubleSlashes, where { "$_" !~ m{/}ms }, message {'Forward slashes are not allowed'}; subtype _NoSlashAtEnd, as _NoForwardSlashes, where { "$_" !~ m{\\\z}ms }, message {'Cannot have a slash at the end'}; subtype _NoDots, as _NoSlashAtEnd, where { "$_" !~ m{[.]}ms }, message {'Cannot have a period'}; subtype ExistingDirectory_SaneSlashes, as _NoDots; coerce ExistingDirectory_SaneSlashes, from Str, via { to_Dir($_) }, from ArrayRef, via { to_Dir($_) }; subtype _NoSpaces, as _NoDots, where { "$_" !~ m{\s}ms }, message {'Spaces are not allowed'}; subtype ExistingDirectory_Spaceless, as _NoSpaces; coerce ExistingDirectory_Spaceless, from Str, via { to_Dir($_) }, from ArrayRef, via { to_Dir($_) }; subtype _NotRootDir, as _NoDots, where { "$_" !~ m{:\z}ms }, message {'Cannot be a root directory'}; subtype ExistingSubdirectory, as _NotRootDir; coerce ExistingSubdirectory, from Str, via { to_Dir($_) }, from ArrayRef, via { to_Dir($_) };
subtype ExistingFile, as File, where { -f "$_" }, message {'File does not exist'}; coerce ExistingFile, from Str, via { to_File($_) }, from ArrayRef, via { to_File($_) };
subtype TemplateObj, as Object, where { $_->isa('Template') }, message {'Template is not the correct type of object'}; class_type DirectoryRef, { class => 'Perl::Dist::WiX::Tag::DirectoryRef' }; class_type DirectoryTag, { class => 'Perl::Dist::WiX::Tag::Directory' }; 1; __END__