X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMooseX%2FGetopt.pm;h=d0dbb3f70180d36965c710be2403d73a7a1b902b;hb=topic%2Fconfigfile_default_codref_call;hp=45500827477d2797774fbb69efd62a14381898d1;hpb=a0697e31416fe1ae65c9933821f453a1adf9d455;p=gitmo%2FMooseX-Getopt.git diff --git a/lib/MooseX/Getopt.pm b/lib/MooseX/Getopt.pm index 4550082..d0dbb3f 100644 --- a/lib/MooseX/Getopt.pm +++ b/lib/MooseX/Getopt.pm @@ -31,6 +31,11 @@ sub new_with_options { if(!defined $configfile) { my $cfmeta = $class->meta->find_attribute_by_name('configfile'); $configfile = $cfmeta->default if $cfmeta->has_default; + if (ref $configfile eq 'CODE') { + # not sure theres a lot you can do with the class and may break some assumptions + # warn? + $configfile = &$configfile($class); + } if (defined $configfile) { $config_from_file = eval { $class->get_config_from_file($configfile);