| 1 | 27 | ▶ | use v5.36; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 2 | |||
| 3 | package Ekorn::Pipeline::Element; | ||
| 4 | |||
| 5 | 27 | ▶ | use namespace::clean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | # Called as a code reference, an element calls the closure it holds, | ||
| 8 | # which never refers to the element itself, so the element is freed as | ||
| 9 | # soon as nothing else holds it. | ||
| 10 | 27 | ▶ | use overload '&{}' => sub ($self, @) { $self->{call} }, fallback => 1; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 11 | |||
| 12 | # Call the element, as calling it as a code reference does. | ||
| 13 | 1 | ▶ | sub call ($self, @arguments) { |
|
Subroutine
call: called CC=1 SCAR=0.0
Pod
documented
| |||
| 14 | 1 | return $self->{call}->(@arguments); | |
| 15 | } | ||
| 16 | |||
| 17 | |||
| 18 | 27 | 1; | |
| 19 | |||
| 20 | __END__ | ||