line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/usr/bin/perl |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# $Id: Scalar.pm,v 1.11 2003/06/06 18:45:02 unimlo Exp $ |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Net::ACL::Set::Scalar; |
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
2401
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
78
|
|
8
|
2
|
|
|
2
|
|
10
|
use vars qw( $VERSION @ISA ); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
142
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
## Inheritance and Versioning ## |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
@ISA = qw( Net::ACL::Set ); |
13
|
|
|
|
|
|
|
$VERSION = '0.07'; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
## Module Imports ## |
16
|
|
|
|
|
|
|
|
17
|
2
|
|
|
2
|
|
1059
|
use Net::ACL::Set; |
|
2
|
|
|
|
|
499
|
|
|
2
|
|
|
|
|
81
|
|
18
|
2
|
|
|
2
|
|
10
|
use Carp; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
473
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
## Public Class Methods ## |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub new |
23
|
|
|
|
|
|
|
{ |
24
|
4
|
|
|
4
|
1
|
2310
|
my $proto = shift; |
25
|
4
|
|
33
|
|
|
51
|
my $class = ref $proto || $proto; |
26
|
4
|
100
|
66
|
|
|
19
|
@_ = @{$_[0]} if (scalar @_ == 1) && (ref $_[0] eq 'ARRAY'); |
|
1
|
|
|
|
|
4
|
|
27
|
|
|
|
|
|
|
|
28
|
4
|
|
|
|
|
12
|
my $this = { |
29
|
|
|
|
|
|
|
_index => shift, |
30
|
|
|
|
|
|
|
_value => shift |
31
|
|
|
|
|
|
|
}; |
32
|
|
|
|
|
|
|
|
33
|
4
|
50
|
33
|
|
|
32
|
croak "Index need to be a number\n" unless defined $this->{_index} && $this->{_index} =~ /^[0-9]+$/; |
34
|
|
|
|
|
|
|
|
35
|
4
|
|
|
|
|
23
|
bless($this,$class); |
36
|
4
|
|
|
|
|
16
|
return $this; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
## Public Object Methods ## |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub set |
42
|
|
|
|
|
|
|
{ |
43
|
14
|
|
|
14
|
1
|
442
|
my $this = shift; |
44
|
|
|
|
|
|
|
# $_[$this->{_index}] = $this->{_value}; # Doesn't work with constants! |
45
|
14
|
|
|
|
|
26
|
my @data = @_; |
46
|
14
|
|
|
|
|
46
|
$data[$this->{_index}] = $this->{_value}; |
47
|
14
|
|
|
|
|
66
|
return @data; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub value |
51
|
|
|
|
|
|
|
{ |
52
|
0
|
|
|
0
|
0
|
|
my $this = shift; |
53
|
0
|
0
|
|
|
|
|
$this->{_value} = @_ ? shift : $this->{_value}; |
54
|
0
|
|
|
|
|
|
return $this->{_value}; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
## POD ## |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=pod |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 NAME |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Net::ACL::Set::Scalar - Class replacing a scalar data element |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 SYNOPSIS |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
use Net::ACL::Set::Scalar; |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
# Construction |
70
|
|
|
|
|
|
|
my $set = new Net::ACL::Set::Scalar(1,42); |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
# Accessor Methods |
73
|
|
|
|
|
|
|
@data = $set->set(@data); # same as: $data[1] = 42; |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 DESCRIPTION |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
This module is a very simpel array ellement replacement utility to allow |
78
|
|
|
|
|
|
|
simple value replacement with L. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 CONSTRUCTOR |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=over 4 |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=item new() |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
my $set = new Net::ACL::Set::Scalar(1,42); |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
This is the constructor for Net::ACL::Set::Scalar objects. |
89
|
|
|
|
|
|
|
It returns a reference to the newly created object. |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
It takes one argument. If the argument is an array reference with one element, |
92
|
|
|
|
|
|
|
the element will be placed instead of the first argument to the set method. |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
If an array reference has more then one element, the second element should be |
95
|
|
|
|
|
|
|
the argument number to be replaced in the set method. |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Otherwise, the value will directly be used instead of the first argument of |
98
|
|
|
|
|
|
|
the set method. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=back |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 ACCESSOR METHODS |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=over 4 |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=item set() |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
This function modifies the arguments according to the arguments of the |
109
|
|
|
|
|
|
|
constructor and returns them. |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=back |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 SEE ALSO |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
Net::ACL::Set, Net::ACL::Rule, Net::ACL |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head1 AUTHOR |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
Martin Lorensen |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=cut |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
## End Package Net::ACL::Set::Scalar ## |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
1; |