line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!perl |
2
|
|
|
|
|
|
|
package Tie::Subset; |
3
|
3
|
|
|
3
|
|
117270
|
use warnings; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
107
|
|
4
|
3
|
|
|
3
|
|
25
|
use strict; |
|
3
|
|
|
|
|
10
|
|
|
3
|
|
|
|
|
60
|
|
5
|
3
|
|
|
3
|
|
13
|
use Carp; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
679
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# For AUTHOR, COPYRIGHT, AND LICENSE see the bottom of this file |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 Name |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Tie::Subset - Tie an array or hash to a subset of another array or hash, respectively |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 Synopsis |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
use Tie::Subset; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
my %hash = ( foo=>11, bar=>22, quz=>33 ); |
18
|
|
|
|
|
|
|
tie my %subset, 'Tie::Subset', \%hash, ['bar','quz']; |
19
|
|
|
|
|
|
|
# same as tie-ing to 'Tie::Subset::Hash' |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
my @array = (55,66,77,88,99); |
22
|
|
|
|
|
|
|
tie my @subset, 'Tie::Subset', \@array, [1,2,3]; |
23
|
|
|
|
|
|
|
# same as tie-ing to 'Tie::Subset::Array' |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 Description |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
This class simply delegates to |
28
|
|
|
|
|
|
|
B> or |
29
|
|
|
|
|
|
|
B> as appropriate. |
30
|
|
|
|
|
|
|
Please see the documentation of those modules. |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=cut |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub TIEHASH { ## no critic (RequireArgUnpacking) |
37
|
3
|
|
|
3
|
|
1183
|
require Tie::Subset::Hash; |
38
|
3
|
100
|
|
|
|
90
|
@_>1 or croak "bad number of arguments to tie"; |
39
|
2
|
100
|
|
|
|
89
|
croak "Tie::Subset can't (yet) be subclassed" unless shift eq __PACKAGE__; |
40
|
1
|
|
|
|
|
4
|
return Tie::Subset::Hash::TIEHASH('Tie::Subset::Hash', @_); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub TIEARRAY { ## no critic (RequireArgUnpacking) |
44
|
3
|
|
|
3
|
|
1184
|
require Tie::Subset::Array; |
45
|
3
|
100
|
|
|
|
87
|
@_>1 or croak "bad number of arguments to tie"; |
46
|
2
|
100
|
|
|
|
88
|
croak "Tie::Subset can't (yet) be subclassed" unless shift eq __PACKAGE__; |
47
|
1
|
|
|
|
|
4
|
return Tie::Subset::Array::TIEARRAY('Tie::Subset::Array', @_); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |
51
|
|
|
|
|
|
|
__END__ |