X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMooseX%2FConfigFromFile.pm;h=43168637aa40a3736eb0b2edc3092ee11e35f9f8;hb=75faf71e9f906a22899b2728fee90d3906b1c0f6;hp=0f4ecc1a68e0ab76bbdc1bc6f91754340671b727;hpb=79d1178e5314e72793610c7669b4ea1757045c2b;p=gitmo%2FMooseX-ConfigFromFile.git diff --git a/lib/MooseX/ConfigFromFile.pm b/lib/MooseX/ConfigFromFile.pm index 0f4ecc1..4316863 100644 --- a/lib/MooseX/ConfigFromFile.pm +++ b/lib/MooseX/ConfigFromFile.pm @@ -1,18 +1,18 @@ 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; -our $VERSION = '0.05'; +our $VERSION = '0.06'; 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)