File Coverage

blib/lib/Tangence/Meta/Event.pm
Criterion Covered Total %
statement 12 12 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod 2 2 100.0
total 19 19 100.0


line stmt bran cond sub pod time code
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     15   232 use v5.26;
  15         371  
7 15     15   93 use warnings;
  15         31  
  15         1085  
8 15     15   96 use Object::Pad 0.800 ':experimental(adjust_params)';
  15         118  
  15         695  
9              
10             package Tangence::Meta::Event 0.33;
11             class Tangence::Meta::Event :strict(params);
12              
13             =head1 NAME
14              
15             C - structure representing one C event
16              
17             =head1 DESCRIPTION
18              
19             This data structure object stores information about one L class
20             event. Once constructed, such objects are immutable.
21              
22             =cut
23              
24             =head1 CONSTRUCTOR
25              
26             =cut
27              
28             =head2 new
29              
30             $event = Tangence::Meta::Event->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 event
43              
44             =item arguments => ARRAY
45              
46             Optional ARRAY reference containing arguments as
47             L references.
48              
49             =back
50              
51             =cut
52              
53 1     1 1 1267 field $class :param :weak :reader;
  1         8  
54 4     4 1 1274 field $name :param :reader;
  4         32  
55             field @arguments;
56              
57             ADJUST :params (
58             :$arguments = undef,
59             ) {
60             @arguments = $arguments->@* if $arguments;
61             }
62              
63             =head1 ACCESSORS
64              
65             =cut
66              
67             =head2 class
68              
69             $class = $event->class
70              
71             Returns the class the event is a member of
72              
73             =cut
74              
75             =head2 name
76              
77             $name = $event->name
78              
79             Returns the name of the class
80              
81             =cut
82              
83             =head2 arguments
84              
85             @arguments = $event->arguments
86              
87             Return the arguments in a list of L references.
88              
89             =cut
90              
91             method arguments { @arguments }
92              
93             =head2 argtypes
94              
95             @argtypes = $event->argtypes
96              
97             Return the argument types in a list of strings.
98              
99             =cut
100              
101             method argtypes
102             {
103             return map { $_->type } @arguments;
104             }
105              
106             =head1 AUTHOR
107              
108             Paul Evans
109              
110             =cut
111              
112             0x55AA;