line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!perl |
2
|
|
|
|
|
|
|
package Tie::Subset; |
3
|
3
|
|
|
3
|
|
108889
|
use warnings; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
120
|
|
4
|
3
|
|
|
3
|
|
16
|
use strict; |
|
3
|
|
|
|
|
15
|
|
|
3
|
|
|
|
|
62
|
|
5
|
3
|
|
|
3
|
|
14
|
use Carp; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
710
|
|
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.01'; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub TIEHASH { ## no critic (RequireArgUnpacking) |
37
|
1
|
|
|
1
|
|
538
|
require Tie::Subset::Hash; |
38
|
1
|
50
|
|
|
|
4
|
@_>1 or croak "bad number of arguments to tie"; |
39
|
1
|
|
|
|
|
2
|
my $class = shift; |
40
|
1
|
50
|
|
|
|
3
|
$class = 'Tie::Subset::Hash' if $class eq __PACKAGE__; |
41
|
1
|
|
|
|
|
3
|
return Tie::Subset::Hash::TIEHASH($class, @_); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub TIEARRAY { ## no critic (RequireArgUnpacking) |
45
|
1
|
|
|
1
|
|
517
|
require Tie::Subset::Array; |
46
|
1
|
50
|
|
|
|
5
|
@_>1 or croak "bad number of arguments to tie"; |
47
|
1
|
|
|
|
|
1
|
my $class = shift; |
48
|
1
|
50
|
|
|
|
4
|
$class = 'Tie::Subset::Array' if $class eq __PACKAGE__; |
49
|
1
|
|
|
|
|
3
|
return Tie::Subset::Array::TIEARRAY($class, @_); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |
53
|
|
|
|
|
|
|
__END__ |