From ed2f44f5b8ef7a0127abcfb0bbffc52945dc266c Mon Sep 17 00:00:00 2001 From: franck cuny Date: Tue, 8 Jun 2010 11:24:12 +0200 Subject: add documentation to method --- lib/MooseX/Net/API/Meta/Method.pm | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'lib') diff --git a/lib/MooseX/Net/API/Meta/Method.pm b/lib/MooseX/Net/API/Meta/Method.pm index 29be4fc..9a9ab09 100644 --- a/lib/MooseX/Net/API/Meta/Method.pm +++ b/lib/MooseX/Net/API/Meta/Method.pm @@ -69,6 +69,25 @@ has required => ( auto_deref => 1, required => 0, ); +has documentation => ( + is => 'ro', + isa => 'Str', + lazy => 1, + default => sub { + my $self = shift; + my $doc; + $doc .= "name: " . $self->name . "\n"; + $doc .= "description: " . $self->description . "\n" + if $self->has_description; + $doc .= "method: " . $self->method . "\n"; + $doc .= "path: " . $self->path . "\n"; + $doc .= "arguments: " . join(', ', $self->params) . "\n" + if $self->params; + $doc .= "required: " . join(', ', $self->required) . "\n" + if $self->required; + $doc; + } +); before wrap => sub { my ($class, %args) = @_; -- cgit 1.4.1