line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Method::Slice;
|
2
|
2
|
|
|
2
|
|
26439
|
use 5.010;
|
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
81
|
|
3
|
2
|
|
|
2
|
|
13
|
use strict;
|
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
78
|
|
4
|
2
|
|
|
2
|
|
15
|
use warnings;
|
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
57
|
|
5
|
2
|
|
|
2
|
|
12
|
use Exporter qw/import/;
|
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
64
|
|
6
|
2
|
|
|
2
|
|
9
|
use Carp;
|
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
199
|
|
7
|
2
|
|
|
2
|
|
5481
|
use Want;
|
|
2
|
|
|
|
|
10288
|
|
|
2
|
|
|
|
|
603
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.02';
|
10
|
|
|
|
|
|
|
our @EXPORT = qw/mslice/;
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub mslice : lvalue {
|
13
|
5
|
|
|
5
|
1
|
4820
|
my ($obj, @meths) = @_;
|
14
|
5
|
100
|
|
|
|
16
|
if (want('LVALUE')) {
|
15
|
2
|
50
|
|
|
|
84
|
if (my @rvals = want('ASSIGN')) {
|
16
|
|
|
|
|
|
|
# call each method as a setter accessor
|
17
|
2
|
|
|
|
|
208
|
for my $i (0 .. $#meths) {
|
18
|
5
|
|
|
|
|
18
|
my $meth = $meths[$i];
|
19
|
5
|
|
|
|
|
14
|
$obj->$meth($rvals[$i]);
|
20
|
|
|
|
|
|
|
}
|
21
|
2
|
|
|
|
|
17
|
lnoreturn;
|
22
|
|
|
|
|
|
|
}
|
23
|
|
|
|
|
|
|
else {
|
24
|
0
|
|
|
|
|
0
|
croak "mslice used in LVALUE context but without ASSIGN .. "
|
25
|
|
|
|
|
|
|
. "don't know what to do :-(";
|
26
|
|
|
|
|
|
|
}
|
27
|
|
|
|
|
|
|
}
|
28
|
|
|
|
|
|
|
else {
|
29
|
|
|
|
|
|
|
# call each method as a getter accessor, and gather values
|
30
|
3
|
|
|
|
|
169
|
my @values = map {scalar $obj->$_()} @meths;
|
|
8
|
|
|
|
|
40
|
|
31
|
3
|
|
|
|
|
26
|
rreturn @values;
|
32
|
|
|
|
|
|
|
}
|
33
|
0
|
|
|
|
|
|
return;
|
34
|
|
|
|
|
|
|
}
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
__END__
|