Aion-Spirit
view release on metacpan or search on metacpan
sub x_1() { 1 }
sub x_2() { 2 }
sub y_1($) { 1+shift }
sub y_2($) { 2+shift }
1;
```
```perl
use lib ".";
use N;
N::x_1 # -> 1
N::x_2 # -> 2.03
N::y_1 0.5 # -> 1.5
N::y_2 0.5 # -> 2.53
```
## wrapsub ($sub, $around)
lib/Aion/Spirit.md view on Meta::CPAN
sub x_1() { 1 }
sub x_2() { 2 }
sub y_1($) { 1+shift }
sub y_2($) { 2+shift }
1;
```
```perl
use lib ".";
use N;
N::x_1 # -> 1
N::x_2 # -> 2.03
N::y_1 0.5 # -> 1.5
N::y_2 0.5 # -> 2.53
```
## wrapsub ($sub, $around)
lib/Aion/Spirit.pm view on Meta::CPAN
sub x_1() { 1 }
sub x_2() { 2 }
sub y_1($) { 1+shift }
sub y_2($) { 2+shift }
1;
use lib ".";
use N;
N::x_1 # -> 1
N::x_2 # -> 2.03
N::y_1 0.5 # -> 1.5
N::y_2 0.5 # -> 2.53
=head2 wrapsub ($sub, $around)
Wraps a function in the specified.
t/aion/spirit.t view on Meta::CPAN
#>>
#>> sub x_1() { 1 }
#>> sub x_2() { 2 }
#>> sub y_1($) { 1+shift }
#>> sub y_2($) { 2+shift }
#>>
#>> 1;
#@< EOF
#
done_testing; }; subtest 'aroundsub ($pkg, $re, $around)' => sub {
use lib ".";
use N;
::is scalar do {N::x_1}, scalar do{1}, 'N::x_1 # -> 1';
::is scalar do {N::x_2}, scalar do{2.03}, 'N::x_2 # -> 2.03';
::is scalar do {N::y_1 0.5}, scalar do{1.5}, 'N::y_1 0.5 # -> 1.5';
::is scalar do {N::y_2 0.5}, scalar do{2.53}, 'N::y_2 0.5 # -> 2.53';
#
# ## wrapsub ($sub, $around)
#
( run in 0.247 second using v1.01-cache-2.11-cpan-ec4f86ec37b )