| 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::Event 0.33; | ||
| 11 | class Tangence::Meta::Event :strict(params); | ||
| 12 | |||
| 13 | 15 | =head1 NAME | |
| 14 | |||
| 15 | C<Tangence::Meta::Event> - structure representing one C<Tangence> event | ||
| 16 | |||
| 17 | =head1 DESCRIPTION | ||
| 18 | |||
| 19 | This data structure object stores information about one L<Tangence> 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<Tangence::Meta::Argument> references. | ||
| 48 | |||
| 49 | =back | ||
| 50 | |||
| 51 | =cut | ||
| 52 | |||
| 53 | 1 | ▶ | field $class :param :weak :reader; |
|
Subroutine
class: called CC=1 SCAR=0.0
Pod
documented
| |||
| 54 | 4 | ▶ | field $name :param :reader; |
|
Subroutine
name: called CC=1 SCAR=0.0
Pod
documented
| |||
| 55 | 15 | field @arguments; | |
| 56 | |||
| 57 | ADJUST :params ( | ||
| 58 | :$arguments = undef, | ||
| 59 | ) { | ||
| 60 | @arguments = $arguments->@* if $arguments; | ||
| 61 | } | ||
| 62 | |||
| 63 | 15 | =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<Tangence::Meta::Argument> references. | ||
| 88 | |||
| 89 | =cut | ||
| 90 | |||
| 91 | 29 | ▶ | method arguments { @arguments } |
|
Subroutine
arguments: called CC=1 SCAR=0.0
Pod
documented
| |||
| 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 | 8 | ▶ | { |
|
Subroutine
argtypes: called CC=1 SCAR=0.0
Pod
documented
| |||
| 103 | 8 | return map { $_->type } @arguments; | |
| 104 | 15 | } | |
| 105 | |||
| 106 | =head1 AUTHOR | ||
| 107 | |||
| 108 | Paul Evans <leonerd@leonerd.org.uk> | ||
| 109 | |||
| 110 | =cut | ||
| 111 | |||
| 112 | 15 | 0x55AA; | |