line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/usr/bin/perl |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# $Id: Member.pm,v 1.5 2003/06/06 18:45:02 unimlo Exp $ |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Net::ACL::Match::Member; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
30
|
|
8
|
1
|
|
|
1
|
|
5
|
use vars qw( $VERSION @ISA ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
59
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
## Inheritance and Versioning ## |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
@ISA = qw( Net::ACL::Match::Scalar ); |
13
|
|
|
|
|
|
|
$VERSION = '0.07'; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
## Module Imports ## |
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
5
|
use Net::ACL::Match::Scalar; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
35
|
|
18
|
1
|
|
|
1
|
|
5
|
use Net::ACL::Rule qw( :rc ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
81
|
|
19
|
1
|
|
|
1
|
|
4
|
use Carp; |
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
207
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
## Public Object Methods ## |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub match |
24
|
|
|
|
|
|
|
{ |
25
|
4
|
|
|
4
|
1
|
7
|
my $this = shift; |
26
|
4
|
|
|
|
|
8
|
my @data = @_; |
27
|
4
|
|
|
|
|
6
|
my $data = $data[$this->{_index}]; |
28
|
4
|
50
|
|
|
|
12
|
croak __PACKAGE__ . "->match needs to operate on an array reference!" |
29
|
|
|
|
|
|
|
unless ref $data eq 'ARRAY'; |
30
|
4
|
|
|
|
|
5
|
my %miss; |
31
|
4
|
|
|
|
|
4
|
foreach my $elem ( @{$this->{_value}} ) |
|
4
|
|
|
|
|
8
|
|
32
|
|
|
|
|
|
|
{ |
33
|
4
|
|
|
|
|
13
|
$miss{$elem} = 1; |
34
|
|
|
|
|
|
|
}; |
35
|
4
|
|
|
|
|
5
|
foreach my $elem ( @{$data} ) |
|
4
|
|
|
|
|
8
|
|
36
|
|
|
|
|
|
|
{ |
37
|
4
|
|
|
|
|
9
|
delete $miss{$elem}; |
38
|
|
|
|
|
|
|
}; |
39
|
4
|
100
|
|
|
|
17
|
return scalar (keys %miss) ? ACL_NOMATCH : ACL_MATCH; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
## POD ## |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=pod |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 NAME |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Net::ACL::Match::Member - Class matching one or more members of an array |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 SYNOPSIS |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
use Net::ACL::Match::Member; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
# Construction |
55
|
|
|
|
|
|
|
my $match = new Net::ACL::Match::Member(1,[41,42]); |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
# Accessor Methods |
58
|
|
|
|
|
|
|
$rc = $match->match(@data); |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 DESCRIPTION |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
This module is a very simple array element testing utility to allow |
63
|
|
|
|
|
|
|
simple value matching with L. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 CONSTRUCTOR |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=over 4 |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=item new() - create a new Net::ACL::Match::Member object |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
my $match = new Net::ACL::Match::Member(1,[41,42]); |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
This is the constructor for Net::ACL::Match::Scalar objects. |
74
|
|
|
|
|
|
|
It returns a reference to the newly created object. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
It takes one argument. If the argument is a array reference with one element, |
77
|
|
|
|
|
|
|
the element will be matched with the first argument to the match method. |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
If an array reference has more then one element, the second element should be |
80
|
|
|
|
|
|
|
the argument number to be matched in the match method. |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Otherwise, the value it self will be matched with the first argument of |
83
|
|
|
|
|
|
|
the match method. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=back |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 ACCESSOR METHODS |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=over 4 |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=item match() |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
This function matches the arguments according to the arguments of the |
94
|
|
|
|
|
|
|
constructor and returns either C or C as exported by |
95
|
|
|
|
|
|
|
Net::ACL::Rule with C<:rc>. |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=back |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 SEE ALSO |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Net::ACL::Match, Net::ACL::Rule, Net::ACL, Net::ACL::Set::Union |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 AUTHOR |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Martin Lorensen |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=cut |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
## End Package Net::ACL::Match::Member ## |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
1; |