line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::Route; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
34422
|
use 5.008; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
123
|
|
4
|
1
|
|
|
1
|
|
609
|
use Moose; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
use version; our $VERSION = qv( 'v0.02' ); |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use NetAddr::IP; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
has 'destination' => ( is => 'ro', required => 1, isa => 'NetAddr::IP' ); |
10
|
|
|
|
|
|
|
has 'gateway' => ( is => 'ro', required => 1, isa => 'NetAddr::IP' ); |
11
|
|
|
|
|
|
|
has 'metric' => ( is => 'ro', required => 1, isa => 'Int' ); |
12
|
|
|
|
|
|
|
has 'interface' => ( is => 'ro', required => 1, isa => 'Str' ); |
13
|
|
|
|
|
|
|
has 'is_active' => ( is => 'ro', required => 1, ); |
14
|
|
|
|
|
|
|
has 'is_dynamic' => ( is => 'ro', required => 1, ); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
no Moose; |
17
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable(); |
18
|
|
|
|
|
|
|
1; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
__END__ |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 NAME |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
Net::Route - Portable interface to the routing table |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 SYNOPSIS |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
use Net::Route::Table; |
30
|
|
|
|
|
|
|
my $table_ref = Net::Route::Table->from_system(); |
31
|
|
|
|
|
|
|
my $route_ref = $table_ref->default_route(); |
32
|
|
|
|
|
|
|
print "Default gateway: ", $route_ref->gateway(), "\n"; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 VERSION |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
Version 0.02, $Revision: 372 $ |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 DESCRIPTION |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head2 The Net::Route Module |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
Every OS provides its custom interface to the routing table: Linux' C<route> |
44
|
|
|
|
|
|
|
utility is different from BSD's C<route show>, from Windows' C<route print>, |
45
|
|
|
|
|
|
|
etc. Parsing all these different output styles in an (otherwise portable) |
46
|
|
|
|
|
|
|
script can quickly become inconvenient. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
L<Net::Route> abstracts the system specifics and provides a single, portable |
49
|
|
|
|
|
|
|
interface. |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head2 The Net::Route Class |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
L<Net::Route> objects represent single entries from a L<Net::Route::Table>. |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 INTERFACE |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
This documents L<Net::Route> as a class. To know how to use the module, refer |
59
|
|
|
|
|
|
|
to the L<synopsis|/SYNOPSIS> or L<Net::Route::Table> (the entry point from a |
60
|
|
|
|
|
|
|
user perspective). |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head2 Object Methods |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head3 destination() |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head3 gateway() |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head3 metric() |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head3 interface() |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head3 is_active() |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head3 is_dynamic() |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 INSTALLING DEPENDENCIES ON SUN SOLARIS SYSTEMS WITH GCC |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
The perl interpreter shipped with Solaris was compiled with Sun's proprietary C |
80
|
|
|
|
|
|
|
compiler, and therefore attempts to compile XS modules with the same tool and |
81
|
|
|
|
|
|
|
options. However, Solaris comes by default with the GNU C Compiler (C<gcc>) |
82
|
|
|
|
|
|
|
only, which has its own set of incompatible command-line arguments. Mixing |
83
|
|
|
|
|
|
|
these two to compile C<XS> Perl modules doesn't work. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Therefore, when you need to install CPAN modules (such as L<Net::Route>'s |
86
|
|
|
|
|
|
|
dependencies) which make use of C<XS> (C code) on a system without the Sun C |
87
|
|
|
|
|
|
|
Compiler, you have to use the wrapper script provided by Sun which will invoke |
88
|
|
|
|
|
|
|
C<gcc> correctly (replace C<Module> as needed): |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
/usr/perl5/bin/perlgcc -MCPAN -e 'install Module'. |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 STATUS AND ROADMAP |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
Please refer to the Changes file for a detailed history. |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head2 0.01 - First Public Release |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
L<Net::Route> meets our goals for a first public release: |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=over |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=item * |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
It can list all routes |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=item * |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
It can get the default route |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=item * |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
It can provide the most common characteristics of routes |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=item * |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
It is portable on Linux, Solaris and Windows |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=back |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
L<Net::Route> is used in other |
122
|
|
|
|
|
|
|
Straton IT (L<http://en.straton-it.fr/>) software, such as |
123
|
|
|
|
|
|
|
Cancerbero 0.7 (L<http://en.straton-it.fr/open-source/cancerbero-07>) and |
124
|
|
|
|
|
|
|
Confdump/Sys (L<http://confdump.sourceforge.net/>). |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head2 0.xx - Community Releases |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
These releases will include features and bugfixes suggested, reported and/or |
129
|
|
|
|
|
|
|
contributed by the community. For example: |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=over |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=item * |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
Differentiating between C<Net::Route>-as-a-class and C<Net::Route>-as-a-module |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=item * |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
Support for more operating systems |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=item * |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
Getting rid of CPAN dependencies that are troublesome to install on some |
144
|
|
|
|
|
|
|
platforms. |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=item * |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
Your idea (L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-Route>) here... |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=back |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
The API might change somewhat, if necessary. |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=head2 1.0 - API Freeze |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
When appropriate (according to the user reports), we will freeze the interface |
157
|
|
|
|
|
|
|
and release version 1.0. |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=head1 BUGS |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
Please report any bugs or feature requests to C<bug-net-route at rt.cpan.org>, |
163
|
|
|
|
|
|
|
or through the web interface at |
164
|
|
|
|
|
|
|
L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-Route>. I will be |
165
|
|
|
|
|
|
|
notified, and then you'll automatically be notified of progress on your bug as |
166
|
|
|
|
|
|
|
I make changes. |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=head1 SUPPORT |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
perldoc Net::Route |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
You can also look for information at: |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=over 4 |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-Route> |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
L<http://annocpan.org/dist/Net-Route> |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=item * CPAN Ratings |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
L<http://cpanratings.perl.org/d/Net-Route> |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=item * Search CPAN |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
L<http://search.cpan.org/dist/Net-Route> |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=back |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
=head1 AUTHOR |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
Created by Alexandre Storoz, C<< <astoroz@straton-it.fr> >> |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
Maintained by Thomas Equeter, C<< <tequeter@straton-it.fr> >> |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
Copyright (C) 2009 Straton IT. |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
211
|
|
|
|
|
|
|
under the same terms as Perl itself. |
212
|
|
|
|
|
|
|
|