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~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0b75e547a4ce27cb7f70bb6b4f29938efe81ac08;p=gitmo%2FMooseX-ConfigFromFile.git convert from Path::Class to Path::Tiny --- diff --git a/ChangeLog b/ChangeLog index 003ee5e..75a5874 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ Revision history for Perl extension MooseX::ConfigFromFile + - the configfile attribute is now a Path::Tiny, not a Path::Class + (coercions from strings are still supported, and now also from any other + type that has a string coercion). + 0.05 - 2013-02-03 (Karen Etheridge) - documentation corrected to demostrate how to properly override the configfile method to provide a default from the consuming class, without diff --git a/t/06_path_tiny.t b/t/06_path_tiny.t new file mode 100644 index 0000000..24c45ae --- /dev/null +++ b/t/06_path_tiny.t @@ -0,0 +1,27 @@ +use strict; +use warnings; + +use Test::More tests => 5; +use Test::NoWarnings 1.04 ':early'; +use Path::Tiny 'path'; +use Path::Class 'file'; + +{ + package Generic; + use Moose; + with 'MooseX::SimpleConfig'; + sub get_config_from_file { } +} + +{ + my $obj = Generic->new(configfile => path('i/do/not_exist')); + is($obj->configfile, 'i/do/not_exist', 'stringification returns path'); + isa_ok($obj->configfile, 'Path::Tiny'); +} + +{ + my $obj = Generic->new(configfile => file('i/do/not_exist')); + is($obj->configfile, 'i/do/not_exist', 'stringification returns path'); + isa_ok($obj->configfile, 'Path::Tiny'); +} +