- Commandline option shouldn't be required in the
case that the given "required" attribute has
been loaded from config (MooseX::ConfigFromFile)
+ - Support for MooseX::ConfigFromFile shouldn't require
+ that role be added at the same level as Getopt.
0.12 Fri. March 14, 2008
~~ updated copyright dates ~~
$opt_parser->getoptions( "configfile=s" => \$configfile );
if(!defined $configfile) {
- my $cfmeta = $class->meta->get_attribute('configfile');
+ my $cfmeta = $class->meta->find_attribute_by_name('configfile');
$configfile = $cfmeta->default if $cfmeta->has_default;
}
}
else
{
- plan tests => 24;
+ plan tests => 25;
}
{
'... optional_from_config is undef as expected' );
}
+{
+ package BaseApp::WithConfig;
+ use Moose;
+ with 'MooseX::ConfigFromFile';
+
+ sub get_config_from_file { return {}; }
+}
+
+{
+ package DerivedApp::Getopt;
+ use Moose;
+ extends 'BaseApp::WithConfig';
+ with 'MooseX::Getopt';
+}
+
+# With DerivedApp, the Getopt role was applied at a different level
+# than the ConfigFromFile role
+{
+ lives_ok { DerivedApp::Getopt->new_with_options } 'Can create DerivedApp';
+}
+
sub app_ok {
my $app = shift;