File Coverage

blib/lib/Kavorka/TraitFor/ReturnType/doc.pm
Criterion Covered Total %
statement 11 11 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 15 15 100.0


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