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
↑ Summary ReturnType/doc.pm »
1 2 ▶use 5.14.0;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 package Kavorka::TraitFor::Parameter::doc;
6  
7 2 our $VERSION = '0.1104'; # VERSION
8 # ABSTRACT: Document method parameters in the signature
9  
10 2 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 2 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  
25  
26 =begin HTML
27  
28 <p><img src="https://img.shields.io/badge/perl-5.14+-brightgreen.svg" alt="Requires Perl 5.14+" /> <a href="https://travis-ci.org/Csson/p5-Kavorka-TraitFor-Parameter-doc"><img src="https://api.travis-ci.org/Csson/p5-Kavorka-TraitFor-Parameter-doc.svg?branch=master" alt="Travis status" /></a> <img src="https://img.shields.io/badge/coverage-100.0%-brightgreen.svg" alt="coverage 100.0%" /></p>
29  
30 =end HTML
31  
32  
33 =begin markdown
34  
35 ![Requires Perl 5.14+](https://img.shields.io/badge/perl-5.14+-brightgreen.svg) [![Travis status](https://api.travis-ci.org/Csson/p5-Kavorka-TraitFor-Parameter-doc.svg?branch=master)](https://travis-ci.org/Csson/p5-Kavorka-TraitFor-Parameter-doc) ![coverage 100.0%](https://img.shields.io/badge/coverage-100.0%-brightgreen.svg)
36  
37 =end markdown
38  
39 =head1 VERSION
40  
41 Version 0.1104, released 2016-01-26.
42  
43 =head1 SYNOPSIS
44  
45 # The class
46 use Moops;
47  
48 class My::Class using Moose {
49  
50 method square(Int $integer does doc('The integer to square.')) {
51  
52 return $integer * $integer;
53  
54 }
55  
56 }
57  
58 # Elsewhere
59 my $param = My::Class->meta->get_method('square')->signature->params->[1];
60 say sprintf '%s %s. %s', $param->optional ? 'Optional' : 'Required',
61 $param->type->name,
62 $param->traits->{'doc'}[0];
63  
64 # says 'Required Int. The integer to square.'
65  
66 =head1 DESCRIPTION
67  
68 Kavorka::TraitFor::Parameter::doc adds a trait (C<doc>) that is useful for documenting in L<Moops> classes created using L<Moose>.
69  
70 =head1 SEE ALSO
71  
72 =over 4
73  
74 =item *
75  
76 L<Kavorka::TraitFor::ReturnType::doc>
77  
78 =item *
79  
80 L<Moops>
81  
82 =item *
83  
84 L<Kavorka>
85  
86 =item *
87  
88 L<Moose>
89  
90 =back
91  
92 =head1 SOURCE
93  
94 L<https://github.com/Csson/p5-Kavorka-TraitFor-Parameter-doc>
95  
96 =head1 HOMEPAGE
97  
98 L<https://metacpan.org/release/Kavorka-TraitFor-Parameter-doc>
99  
100 =head1 AUTHOR
101  
102 Erik Carlsson <info@code301.com>
103  
104 =head1 COPYRIGHT AND LICENSE
105  
106 This software is copyright (c) 2016 by Erik Carlsson.
107  
108 This is free software; you can redistribute it and/or modify it under
109 the same terms as the Perl 5 programming language system itself.
110  
111 =cut
↑ Summary ReturnType/doc.pm »