From: Karen Etheridge Date: Fri, 8 Feb 2013 01:46:16 +0000 (-0800) Subject: use OO syntax for handling subref X-Git-Tag: v0.54~4 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=afa8f0e64427bf3571b98614b54a1d2dd88eb157;p=gitmo%2FMooseX-Getopt.git use OO syntax for handling subref --- diff --git a/lib/MooseX/Getopt/Basic.pm b/lib/MooseX/Getopt/Basic.pm index 691f672..152aaf7 100644 --- a/lib/MooseX/Getopt/Basic.pm +++ b/lib/MooseX/Getopt/Basic.pm @@ -46,11 +46,10 @@ sub process_argv { $configfile = $cfmeta->default if not defined $configfile and $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); - } + + # note that this will die horribly if the default sub depends on + # other attributes + $configfile = $configfile->($class) if ref $configfile eq 'CODE'; if (defined $configfile) { $config_from_file = try { $class->get_config_from_file($configfile);