File Coverage

blib/lib/Kavorka/TraitFor/Parameter/doc.pm
Criterion Covered Total %
statement 12 12 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 16 16 100.0


line stmt bran cond sub pod time code
1 1     1   972663 use 5.14.0;
  1         3  
  1         57  
2 1     1   4 use strict;
  1         1  
  1         27  
3 1     1   4 use warnings;
  1         1  
  1         50  
4              
5             package Kavorka::TraitFor::Parameter::doc;
6              
7             our $VERSION = '0.1103'; # VERSION
8             # ABSTRACT: Document method parameters in the signature
9              
10 1     1   4 use Moo::Role;
  1         1  
  1         6  
11              
12             1;
13              
14             __END__
15              
16             =pod
17              
18             =encoding UTF-8
19              
20             =head1 NAME
21              
22             Kavorka::TraitFor::Parameter::doc - Document method parameters in the signature
23              
24             =head1 VERSION
25              
26             Version 0.1103, released 2015-02-16.
27              
28             =head1 SYNOPSIS
29              
30             # The class
31             use Moops;
32              
33             class My::Class using Moose {
34              
35             method square(Int $integer does doc('The integer to square.')) {
36              
37             return $integer * $integer;
38              
39             }
40              
41             }
42              
43             # Elsewhere
44             my $param = My::Class->meta->get_method('square')->signature->params->[1];
45             say sprintf '%s %s. %s', $param->optional ? 'Optional' : 'Required',
46             $param->type->name,
47             $param->traits->{'doc'}[0];
48              
49             # says 'Required Int. The integer to square.'
50              
51             =head1 DESCRIPTION
52              
53             Kavorka::TraitFor::Parameter::doc adds a trait (C<doc>) that is useful for documenting in L<Moops> classes created using L<Moose>.
54              
55             =head1 SEE ALSO
56              
57             =over 4
58              
59             =item *
60              
61             L<Kavorka::TraitFor::ReturnType::doc>
62              
63             =item *
64              
65             L<Moops>
66              
67             =item *
68              
69             L<Kavorka>
70              
71             =item *
72              
73             L<Moose>
74              
75             =back
76              
77             =head1 SOURCE
78              
79             L<https://github.com/Csson/p5-Kavorka-TraitFor-Parameter-doc>
80              
81             =head1 HOMEPAGE
82              
83             L<https://metacpan.org/release/Kavorka-TraitFor-Parameter-doc>
84              
85             =head1 AUTHOR
86              
87             Erik Carlsson <info@code301.com>
88              
89             =head1 COPYRIGHT AND LICENSE
90              
91             This software is copyright (c) 2015 by Erik Carlsson <info@code301.com>.
92              
93             This is free software; you can redistribute it and/or modify it under
94             the same terms as the Perl 5 programming language system itself.
95              
96             =cut