| 1 | package Function::Composition; | ||
| 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 | 2 | our $VERSION = '0.0.2'; | |
| 5 | |||
| 6 | 2 | ▶ | use parent qw(Exporter); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 2 | our @EXPORT_OK = qw(compose); | |
| 8 | |||
| 9 | 1 | ▶ | sub compose { |
|
Subroutine
compose: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 10 | 1 | my @functions = reverse @_; | |
| 11 | 1 | ▶ | return sub { |
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||
| 12 | 1 | my @res = @_; | |
| 13 | 1 | for my $f (@functions) { | |
| 14 | 2 | @res = $f->(@res); | |
| 15 | } | ||
| 16 | 1 | @res; | |
| 17 | } | ||
| 18 | 1 | } | |
| 19 | |||
| 20 | 2 | 1; | |
| 21 | __END__ | ||