1MooseX::Types::Path::ClUassesr(3Cpomn)tributed Perl DocuMmoeonsteaXt:i:oTnypes::Path::Class(3pm)
2
3
4

NAME

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

VERSION

9       version 0.09
10

SYNOPSIS

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

DESCRIPTION

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

EXPORTS

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

SEE ALSO

82       MooseX::Types::Path::Class::MoreCoercions, MooseX::FileAttribute,
83       MooseX::Types::URI
84

DEPENDENCIES

86       Moose, MooseX::Types, Path::Class
87

SUPPORT

89       Bugs may be submitted through the RT bug tracker
90       <https://rt.cpan.org/Public/Dist/Display.html?Name=MooseX-Types-Path-
91       Class> (or bug-MooseX-Types-Path-Class@rt.cpan.org <mailto:bug-MooseX-
92       Types-Path-Class@rt.cpan.org>).
93
94       There is also a mailing list available for users of this distribution,
95       at <http://lists.perl.org/list/moose.html>.
96
97       There is also an irc channel available for users of this distribution,
98       at "#moose" on "irc.perl.org" <irc://irc.perl.org/#moose>.
99

AUTHOR

101       Todd Hepler <thepler@employees.org>
102

CONTRIBUTORS

104       ·   Karen Etheridge <ether@cpan.org>
105
106       ·   Jonathan Rockway <jon@jrock.us>
107
108       ·   Yuval Kogman <nothingmuch@woobling.org>
109
111       This software is copyright (c) 2007 by Todd Hepler.
112
113       This is free software; you can redistribute it and/or modify it under
114       the same terms as the Perl 5 programming language system itself.
115
116
117
118perl v5.30.1                      2020-01-30   MooseX::Types::Path::Class(3pm)
Impressum