1MooseX::Types::Path::ClUassesr(3C)ontributed Perl DocumeMnotoasteiXo:n:Types::Path::Class(3)
2
3
4

NAME

6       MooseX::Types::Path::Class - A Path::Class type library for Moose
7

SYNOPSIS

9         package MyClass;
10         use Moose;
11         use MooseX::Types::Path::Class;
12         with 'MooseX::Getopt';  # optional
13
14         has 'dir' => (
15             is       => 'ro',
16             isa      => 'Path::Class::Dir',
17             required => 1,
18             coerce   => 1,
19         );
20
21         has 'file' => (
22             is       => 'ro',
23             isa      => 'Path::Class::File',
24             required => 1,
25             coerce   => 1,
26         );
27
28         # these attributes are coerced to the
29         # appropriate Path::Class objects
30         MyClass->new( dir => '/some/directory/', file => '/some/file' );
31

DESCRIPTION

33       MooseX::Types::Path::Class creates common Moose types, coercions and
34       option specifications useful for dealing with Path::Class objects as
35       Moose attributes.
36
37       Coercions (see Moose::Util::TypeConstraints) are made from both 'Str'
38       and 'ArrayRef' to both Path::Class::Dir and Path::Class::File objects.
39       If you have MooseX::Getopt installed, the Getopt option type ("=s")
40       will be added for both Path::Class::Dir and Path::Class::File.
41

EXPORTS

43       None of these are exported by default.  They are provided via
44       MooseX::Types.
45
46       Dir, File
47           These exports can be used instead of the full class names.
48           Example:
49
50             package MyClass;
51             use Moose;
52             use MooseX::Types::Path::Class qw(Dir File);
53
54             has 'dir' => (
55                 is       => 'ro',
56                 isa      => Dir,
57                 required => 1,
58                 coerce   => 1,
59             );
60
61             has 'file' => (
62                 is       => 'ro',
63                 isa      => File,
64                 required => 1,
65                 coerce   => 1,
66             );
67
68           Note that there are no quotes around Dir or File.
69
70       is_Dir($value), is_File($value)
71           Returns true or false based on whether $value is a valid Dir or
72           File.
73
74       to_Dir($value), to_File($value)
75           Attempts to coerce $value to a Dir or File.  Returns the coerced
76           value or false if the coercion failed.
77

DEPENDENCIES

79       Moose, MooseX::Types, Path::Class
80

BUGS AND LIMITATIONS

82       If you find a bug please either email the author, or add the bug to
83       cpan-RT <http://rt.cpan.org>.
84

AUTHOR

86       Todd Hepler  "<thepler@employees.org>"
87
89       Copyright (c) 2007-2008, Todd Hepler "<thepler@employees.org>".
90
91       This module is free software; you can redistribute it and/or modify it
92       under the same terms as Perl itself. See perlartistic.
93
94
95
96perl v5.12.0                      2008-07-09     MooseX::Types::Path::Class(3)
Impressum