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