From: Toby Inkster Date: Sat, 15 Jun 2013 00:50:21 +0000 (+0100) Subject: use the _attr_desc function instead of reinventing it X-Git-Tag: v1.003000~52 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e7705b1d0126bc58cd0bf32473830b98e367a04c;p=gitmo%2FMoo.git use the _attr_desc function instead of reinventing it --- diff --git a/lib/Method/Generate/Accessor.pm b/lib/Method/Generate/Accessor.pm index 8c4b19d..8ac0fda 100644 --- a/lib/Method/Generate/Accessor.pm +++ b/lib/Method/Generate/Accessor.pm @@ -380,18 +380,13 @@ sub _generate_die_prefix { our ($CurrentArgument, $CurrentAttribute, $CurrentStep, $OrigSigDie); $OrigSigDie ||= sub { die $_[0] }; - $OrigSigDie->( - qq[$CurrentStep for "$CurrentAttribute"] - . ($CurrentArgument && ($CurrentArgument ne $CurrentAttribute) - ? qq[ (constructor argument: "$CurrentArgument")] - : "") - . qq[ failed: $_[0]] - ); + my $attr_desc = _attr_desc($CurrentAttribute, $CurrentArgument); + $OrigSigDie->("$CurrentStep for $attr_desc failed: $_[0]"); }; "do {\n" .' local $Method::Generate::Accessor::CurrentArgument = ' - . B::perlstring($init_arg) . ";\n" + . (defined $init_arg ? B::perlstring($init_arg) : 'undef') . ";\n" .' local $Method::Generate::Accessor::CurrentAttribute = ' . B::perlstring($name) . ";\n" .' local $Method::Generate::Accessor::CurrentStep = '