++ed by:
PLU STAUGAARD FIBO OALDERS JRMASH

8 PAUSE users
5 non-PAUSE users.

Author image Todd Hepler
and 1 contributors

NAME

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

SYNOPSIS

  package MyClass;
  use Moose;
  use MooseX::Types::Path::Class qw( Dir File );
  with 'MooseX::Getopt';      # if you want the Getopt Role

  has 'dir' => (
      is       => 'ro',
      isa      => Dir,
      required => 1,
      coerce   => 1,
  );

  has 'file' => (
      is       => 'ro',
      isa      => File,
      required => 1,
      coerce   => 1,
  );

  # these attributes are coerced to the
  # appropriate Path::Class objects
  MyClass->new( dir => '/some/directory/', file => '/some/file' );

  

DESCRIPTION

This is a utility that creates common Moose subtypes, coercions and option specifications useful for dealing with Path::Class objects as Moose attributes.

This module constructs coercions (see Moose::Util::TypeConstraints) from both 'Str' and 'ArrayRef' to both Path::Class::Dir and Path::Class::File objects. It also adds the Getopt option type ("=s") for both Path::Class::Dir and Path::Class::File (see MooseX::Getopt).

This is just meant to be a central place for these constructs, so you don't have to worry about whether they've been created or not, and you're not tempted to copy them into yet another class (like I was).

EXPORTS

See MooseX::Types for how these exports work.

Dir is_Dir to_Dir
File is_File to_File

DEPENDENCIES

Moose, MooseX::Types, MooseX::Getopt, Path::Class

BUGS AND LIMITATIONS

No bugs have been reported.

AUTHOR

Todd Hepler <thepler@employees.org>

LICENCE AND COPYRIGHT

Copyright (c) 2007, Todd Hepler <thepler@employees.org>. All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.