blib/lib/Kavorka/TraitFor/Parameter/doc.pm

filter: Statementstmt 100% 13 / 13 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 100% 17 / 17 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Build ↑ Summary blib/lib/Kavorka/TraitFor/ReturnType/doc.pm »
1 1 ▶use 5.14.0;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 package Kavorka::TraitFor::Parameter::doc;
6  
7 1 our $VERSION = '0.1103'; # VERSION
8 # ABSTRACT: Document method parameters in the signature
9  
10 1 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 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
« Build ↑ Summary blib/lib/Kavorka/TraitFor/ReturnType/doc.pm »