From: Karen Etheridge Date: Sat, 2 Feb 2013 21:06:38 +0000 (-0800) Subject: convert from Path::Class to Path::Tiny X-Git-Tag: 0.06~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2f049fc1ad9cb0ee9c2d4cd21ec3a138da3bf020;p=gitmo%2FMooseX-ConfigFromFile.git convert from Path::Class to Path::Tiny --- diff --git a/Makefile.PL b/Makefile.PL index f550eb5..67444f3 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -16,7 +16,7 @@ test_requires 'Test::NoWarnings' => '1.04'; test_requires 'Test::Without::Module'; requires 'Moose' => '0.35'; -requires 'MooseX::Types::Path::Class' => '0.04'; +requires 'MooseX::Types::Path::Tiny'; requires 'Try::Tiny'; requires 'namespace::autoclean'; diff --git a/lib/MooseX/ConfigFromFile.pm b/lib/MooseX/ConfigFromFile.pm index 0f4ecc1..15d6773 100644 --- a/lib/MooseX/ConfigFromFile.pm +++ b/lib/MooseX/ConfigFromFile.pm @@ -1,7 +1,7 @@ package MooseX::ConfigFromFile; use Moose::Role; -use MooseX::Types::Path::Class qw( File ); +use MooseX::Types::Path::Tiny 'Path'; use Try::Tiny qw/ try /; use Carp qw(croak); use namespace::autoclean; @@ -12,7 +12,7 @@ requires 'get_config_from_file'; has configfile => ( is => 'ro', - isa => File, + isa => Path, coerce => 1, predicate => 'has_configfile', do { try { require MooseX::Getopt; (traits => ['Getopt']) } }, @@ -127,8 +127,9 @@ during its normal C. =head2 configfile -This is a L object which can be coerced from a regular pathname -string. This is the file your attributes are loaded from. You can add a default +This is a L object which can be coerced from a regular pathname +string or any object that supports stringification. +This is the file your attributes are loaded from. You can add a default configfile in the consuming class and it will be honored at the appropriate time (note that a simple sub declaration is not sufficient, as there is already a sub by that name being added by Moose as the attribute reader)