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