From: Guillermo Roditi Date: Sat, 23 Feb 2008 23:45:32 +0000 (+0000) Subject: I forgot about init_arg oops X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a8676f0fa02027c61b5a8d31bd3729c62bbe9d9c;p=gitmo%2FMooseX-AutoDoc.git I forgot about init_arg oops --- diff --git a/blib/lib/MooseX/AutoDoc.pm b/blib/lib/MooseX/AutoDoc.pm index c2b3e1d..5701536 100644 --- a/blib/lib/MooseX/AutoDoc.pm +++ b/blib/lib/MooseX/AutoDoc.pm @@ -249,6 +249,8 @@ sub attribute_info{ $info->{reader} = $attr->reader if $attr->has_reader; $info->{accessor} = $attr->accessor if $attr->has_accessor; } + $info->{'constructor key'} = $attr->init_arg + if $attr->has_init_arg && $attr->init_arg ne $attr_name; if( defined(my $lazy = $attr->is_lazy) ){ $description .= 'lazy-building '; diff --git a/lib/MooseX/AutoDoc.pm b/lib/MooseX/AutoDoc.pm index c2b3e1d..5701536 100644 --- a/lib/MooseX/AutoDoc.pm +++ b/lib/MooseX/AutoDoc.pm @@ -249,6 +249,8 @@ sub attribute_info{ $info->{reader} = $attr->reader if $attr->has_reader; $info->{accessor} = $attr->accessor if $attr->has_accessor; } + $info->{'constructor key'} = $attr->init_arg + if $attr->has_init_arg && $attr->init_arg ne $attr_name; if( defined(my $lazy = $attr->is_lazy) ){ $description .= 'lazy-building '; diff --git a/t/002-attributes.t b/t/002-attributes.t index 07e90e1..6ca793d 100644 --- a/t/002-attributes.t +++ b/t/002-attributes.t @@ -108,7 +108,8 @@ my %attributes = map { $_ => $meta->get_attribute($_) } { 'info' => { 'reader' => 'attr7', - 'writer' => '_attr7' + 'writer' => '_attr7', + 'constructor key' => '-attr7', }, 'name' => 'attr7', 'description' => 'Optional value' diff --git a/t/lib/AutoDocTest1.pm b/t/lib/AutoDocTest1.pm index 1fd979c..6497329 100644 --- a/t/lib/AutoDocTest1.pm +++ b/t/lib/AutoDocTest1.pm @@ -8,7 +8,7 @@ has attr3 => (is => 'rw', isa => 'ArrayRef[Str]'); has attr4 => (is => 'rw', isa => 'ArrayRef[Str]', required => 1); has attr5 => (is => 'rw', isa => 'ArrayRef[Str]', required => 1, auto_deref => 1); has attr6 => (is => 'rw', lazy_build => 1); -has attr7 => (reader => 'attr7', writer => '_attr7'); +has attr7 => (reader => 'attr7', writer => '_attr7', init_arg => '-attr7'); sub foo {