Aion-Spirit

 view release on metacpan or  search on metacpan

README.md  view on Meta::CPAN

58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
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

57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
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

129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
         
        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

57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#>>
#>> 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.271 second using v1.01-cache-2.11-cpan-ec4f86ec37b )