Tangence/Meta/Method.pm

filter: Statementstmt 100% 26 / 26 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 80.0% 4 / 5 totaltotal 97.4% 38 / 39 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Tangence/Server/Context.pm ↑ Summary Tangence.pm »
1 # You may distribute under the terms of either the GNU General Public License
2 # or the Artistic License (the same terms as Perl itself)
3 #
4 # (C) Paul Evans, 2011-2024 -- leonerd@leonerd.org.uk
5  
6 15 ▶use v5.26;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 15 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 15 ▶use Object::Pad 0.800 ':experimental(adjust_params)';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 package Tangence::Meta::Method 0.33;
11 class Tangence::Meta::Method :strict(params);
12  
13 15 =head1 NAME
14  
15 C<Tangence::Meta::Method> - structure representing one C<Tangence> method
16  
17 =head1 DESCRIPTION
18  
19 This data structure object stores information about one L<Tangence> class
20 method. Once constructed, such objects are immutable.
21  
22 =cut
23  
24 =head1 CONSTRUCTOR
25  
26 =cut
27  
28 =head2 new
29  
30 $method = Tangence::Meta::Method->new( %args )
31  
32 Returns a new instance initialised by the given arguments.
33  
34 =over 8
35  
36 =item class => Tangence::Meta::Class
37  
38 Reference to the containing class
39  
40 =item name => STRING
41  
42 Name of the method
43  
44 =item arguments => ARRAY
45  
46 Optional ARRAY reference containing arguments as
47 L<Tangence::Meta::Argument> references.
48  
49 =item ret => STRING
50  
51 Optional string giving the return value type as a L<Tangence::Meta::Type>
52 reference
53  
54 =back
55  
56 =cut
57  
58 1 ▶field $class :param :weak :reader;
Subroutine class: called CC=1 SCAR=0.0
Pod documented
59 4 ▶field $name :param :reader;
Subroutine name: called CC=1 SCAR=0.0
Pod documented
60 15 field @arguments;
61 62 ▶field $ret :param :reader;
Subroutine ret: called CC=1 SCAR=0.0
Pod documented
62  
63 ADJUST :params (
64 :$arguments = undef,
65 ) {
66 @arguments = $arguments->@* if $arguments;
67 }
68  
69 15 =head1 ACCESSORS
70  
71 =cut
72  
73 =head2 class
74  
75 $class = $method->class
76  
77 Returns the class the method is a member of
78  
79 =cut
80  
81 =head2 name
82  
83 $name = $method->name
84  
85 Returns the name of the class
86  
87 =cut
88  
89 =head2 arguments
90  
91 @arguments = $method->arguments
92  
93 Return the arguments in a list of L<Tangence::Meta::Argument> references.
94  
95 =cut
96  
97 29 ▶method arguments { @arguments }
Subroutine arguments: called CC=1 SCAR=0.0
Pod documented
98  
99 =head2 argtype
100  
101 @argtypes = $method->argtypes
102  
103 Return the argument types in a list of L<Tangence::Meta::Type> references.
104  
105 =cut
106  
107 method argtypes
108 11 ▶{
Subroutine argtypes: called CC=1 SCAR=0.0
Pod undocumented
109 11 return map { $_->type } @arguments;
110 15 }
111  
112 =head2 ret
113  
114 $ret = $method->ret
115  
116 Returns the return type as a L<Tangence::Meta::Type> reference or C<undef> if
117 the method does not return a value.
118  
119 =cut
120  
121 =head1 AUTHOR
122  
123 Paul Evans <leonerd@leonerd.org.uk>
124  
125 =cut
126  
127 15 0x55AA;
« Tangence/Server/Context.pm ↑ Summary Tangence.pm »