| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
#!/usr/bin/perl |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# $Id: Bootstrap.pm,v 1.14 2003/06/06 18:45:02 unimlo Exp $ |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Net::ACL::Bootstrap; |
|
6
|
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
1337
|
use strict; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
76
|
|
|
8
|
2
|
|
|
2
|
|
11
|
use vars qw( $VERSION @ISA $AUTOLOAD ); |
|
|
2
|
|
|
|
|
20
|
|
|
|
2
|
|
|
|
|
160
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
## Inheritance and Versioning ## |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
@ISA = qw( Exporter ); |
|
13
|
|
|
|
|
|
|
$VERSION = '0.07'; |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
## Module Imports ## |
|
16
|
|
|
|
|
|
|
|
|
17
|
2
|
|
|
2
|
|
12
|
use Carp; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
142
|
|
|
18
|
2
|
|
|
2
|
|
697
|
use Net::ACL; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
1406
|
|
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
## Public Class Methods ## |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub renew |
|
23
|
|
|
|
|
|
|
{ |
|
24
|
2
|
|
|
2
|
1
|
604
|
my $proto = shift; |
|
25
|
2
|
|
33
|
|
|
15
|
my $class = ref $proto || $proto; |
|
26
|
|
|
|
|
|
|
|
|
27
|
2
|
|
|
|
|
13
|
my $this = renew Net::ACL(@_); |
|
28
|
2
|
100
|
|
|
|
26
|
return $this if defined $this; |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# Try to bootstrap! |
|
31
|
1
|
|
|
|
|
2
|
my ($name,$type) = (undef,$class); |
|
32
|
1
|
|
|
|
|
6
|
while ( defined(my $arg = shift) ) |
|
33
|
|
|
|
|
|
|
{ |
|
34
|
2
|
|
|
|
|
5
|
my $value = shift; |
|
35
|
2
|
100
|
|
|
|
10
|
if ( $arg =~ /name/i ) |
|
|
|
50
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
{ |
|
37
|
1
|
|
|
|
|
4
|
$name = $value; |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
elsif ( $arg =~ /type/i ) |
|
40
|
|
|
|
|
|
|
{ |
|
41
|
1
|
|
|
|
|
4
|
$type = $value; |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
else |
|
44
|
|
|
|
|
|
|
{ |
|
45
|
0
|
|
|
|
|
0
|
croak "Can only bootstrap using name/type data - Not '$arg'."; |
|
46
|
|
|
|
|
|
|
}; |
|
47
|
|
|
|
|
|
|
}; |
|
48
|
|
|
|
|
|
|
|
|
49
|
1
|
|
|
|
|
3
|
$this = {}; |
|
50
|
1
|
|
|
|
|
3
|
bless($this, $class); |
|
51
|
1
|
|
|
|
|
4
|
@{$this}{qw(_name _type _realist)} = ($name,$type,undef), |
|
|
1
|
|
|
|
|
12
|
|
|
52
|
|
|
|
|
|
|
return $this; |
|
53
|
|
|
|
|
|
|
} |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub name |
|
56
|
|
|
|
|
|
|
{ |
|
57
|
3
|
|
|
3
|
1
|
753
|
my $this = shift; |
|
58
|
3
|
100
|
|
|
|
13
|
$this->fetch unless defined $this->{_reallist}; |
|
59
|
3
|
50
|
|
|
|
15
|
return $this->{_reallist}->name(@_) if defined $this->{_reallist}; |
|
60
|
|
|
|
|
|
|
# Modification is too odd! |
|
61
|
0
|
|
|
|
|
0
|
return $this->{_name}; |
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub type |
|
65
|
|
|
|
|
|
|
{ |
|
66
|
1
|
|
|
1
|
1
|
2
|
my $this = shift; |
|
67
|
1
|
50
|
|
|
|
5
|
$this->fetch unless defined $this->{_reallist}; |
|
68
|
1
|
50
|
|
|
|
7
|
return $this->{_reallist}->type(@_) if defined $this->{_reallist}; |
|
69
|
|
|
|
|
|
|
# Modification is too odd! |
|
70
|
0
|
|
|
|
|
0
|
return $this->{_type}; |
|
71
|
|
|
|
|
|
|
} |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub AUTOLOAD |
|
74
|
|
|
|
|
|
|
{ |
|
75
|
6
|
|
|
6
|
|
513
|
my $method = $AUTOLOAD; |
|
76
|
6
|
|
|
|
|
9
|
my $this = shift; |
|
77
|
6
|
|
33
|
|
|
20
|
my $class = ref $this || $this; |
|
78
|
6
|
|
|
|
|
45
|
$method =~ s/${class}:://; |
|
79
|
6
|
50
|
|
|
|
20
|
$this->fetch unless defined $this->{_reallist}; |
|
80
|
6
|
50
|
0
|
|
|
16
|
croak 'Operation on non-existing Net::ACL (' . |
|
|
|
|
0
|
|
|
|
|
|
81
|
|
|
|
|
|
|
($this->type || '(type n/a)') . ' ' . ($this->name || '(name n/a)') . ")!\n" |
|
82
|
|
|
|
|
|
|
unless defined $this->{_reallist}; |
|
83
|
6
|
|
|
|
|
46
|
$this->{_reallist}->$method(@_); |
|
84
|
|
|
|
|
|
|
} |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub DESTROY |
|
87
|
0
|
|
|
0
|
|
0
|
{ # Don't do anything - But don't proxy this! |
|
88
|
|
|
|
|
|
|
} |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub fetch |
|
91
|
|
|
|
|
|
|
{ |
|
92
|
1
|
|
|
1
|
1
|
3
|
my $this = shift; |
|
93
|
1
|
|
|
|
|
9
|
$this->{_reallist} = renew Net::ACL( |
|
94
|
|
|
|
|
|
|
Name => $this->{_name}, |
|
95
|
|
|
|
|
|
|
Type => $this->{_type} |
|
96
|
|
|
|
|
|
|
); |
|
97
|
|
|
|
|
|
|
} |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
## POD ## |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=pod |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 NAME |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Net::ACL::Bootstrap - A proxy/bootstrap class for the L class |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
use Net::ACL::Bootstrap; |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
# Constructor |
|
112
|
|
|
|
|
|
|
$list = renew Net::ACL::Bootstrap( |
|
113
|
|
|
|
|
|
|
Name => 'MyACL', |
|
114
|
|
|
|
|
|
|
Type => 'prefix-list', |
|
115
|
|
|
|
|
|
|
); |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
This module works as a wrapper/proxy/bootstrap for the Net::ACL class. |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
It makes it possible to renew() a list that has not yet been constructed |
|
122
|
|
|
|
|
|
|
using its name and type. The real list should be constructed before any |
|
123
|
|
|
|
|
|
|
method is used on this object (except name(), type() and fetch()). |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head1 CONSTRUCTOR |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=over 4 |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=item renew() - create a new Net::ACL::Bootstrap object: |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
$list = renew Net::ACL( |
|
132
|
|
|
|
|
|
|
Name => 'MyACL', |
|
133
|
|
|
|
|
|
|
Type => 'prefix-list', |
|
134
|
|
|
|
|
|
|
); |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
This is the only constructor for Net::ACL::Bootstrap class. The arguments |
|
137
|
|
|
|
|
|
|
are the same as the renew() constructor of the Net::ACL class. |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
It either returns an existing Net::ACL object matching the arguments or a |
|
140
|
|
|
|
|
|
|
reference to the newly created Net::ACL::Bootstrap object. |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=back |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=head1 ACCESSOR METHODS |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=over 4 |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=item fetch() |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
Forces the class to load the reference to the list or croak if that fails. |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=item name() |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=item type() |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
It is possible to query name and type data of the list, however, not to |
|
157
|
|
|
|
|
|
|
change them, unless the list is loaded. But only if the list can be loaded, |
|
158
|
|
|
|
|
|
|
change the name or type can be done. |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=item AUTOLOAD() |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
All other methods are forwarded to the real Net::ACL object. |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=back |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
Net::ACL |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=head1 AUTHOR |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
Martin Lorensen |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=cut |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
## End Package Net::ACL::Bootstrap ## |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
1; |