README
1-----BEGIN PGP SIGNED MESSAGE-----
2Hash: SHA1
3
4
5Tie::NetAddr::IP
6================
7
8Provides a compact hash representation of a network hierarchy. See
9documentation for examples.
10
11INSTALLATION
12
13To install this module type the following:
14
15 perl Makefile.PL
16 make
17 make test
18 make install
19
20DEPENDENCIES
21
22This module requires these other modules and libraries:
23
24Test::More
25NetAddr::IP
26
27Please insure that all of them are properly installed and working
28before issuing bug reports. Test::More is required for testing.
29
30SECURITY CONSIDERATIONS
31
32I have no control on the machanisms involved in the storage or
33transport of this distribution. This means that I cannot guarantee
34that the distribution you have in your hands is indeed, the same
35distribution I packed and uploaded.
36
37Along the distribution file, you should have a file with the extension
38".asc". This contains a GPG "detached signature" that makes it
39impossible for anybody to alter this distribution. If security is of
40any concern to you, by all means verify the signature of this file and
41contact the author if any discrepancy is detected.
42
43You can find more information about this at the following URL
44
45 http://mipagina.cantv.net/lem/gpg/
46
47MODULE DOCUMENTATION
48
49NAME
50 Tie::NetAddr::IP - Implements a Hash where the key is a subnet
51
52SYNOPSIS
53 use Tie::NetAddr::IP;
54
55 my %WhereIs;
56
57 tie %WhereIs, Tie::NetAddr::IP;
58
59 $WhereIs{"10.0.10.0/24"} = "Lab, First Floor";
60 $WhereIs{"10.0.20.0/24"} = "Datacenter, Second Floor";
61 $WhereIs{"10.0.30.0/27"} = "Remote location";
62 $WhereIs{"0.0.0.0/0"} = "God knows where";
63
64 foreach $host ("10.0.10.1", "10.0.20.15", "10.0.32.17", "10.10.0.1") {
65 print "Host $host is in ", $WhereIs{$host}, "\n";
66 }
67
68 foreach $subnet (keys %WhereIs) {
69 print "Network ", $subnet, " is used in ",
70 $WhereIs{$subnet}, "\n";
71 }
72
73 untie %WhereIs;
74
75DESCRIPTION
76 This module overloads hashes so that the key can be a subnet as in
77 NetAddr::IP. When looking values up, an interpretation will be made to
78 find the given key within the subnets specified in the hash.
79
80 The code sample provided on the SYNOPSIS would print out the locations
81 of every machine in the `foreach' loop.
82
83 Care must be taken, as only strings that can be parsed as an IP address
84 by NetAddr::IP can be used as keys for this hash.
85
86 Iterators on the hash such as `foreach', `each', `keys' and `values'
87 will only see the actual subnets provided as keys to the hash. When
88 looking up a value such as in `$hash{$ipaddress}' this IP address will
89 be looked up among the subnets existing as keys within the hash. The
90 matching subnet with the longest mask (ie, the most specific subnet)
91 will win and its associated value will be returned.
92
93 This code can be distributed freely according to the terms set forth in
94 the PERL license provided that proper credit is maintained. Please send
95 bug reports and feedback to the author for further improvement.
96
97AUTHOR
98 Luis E. Munoz (lem@cantv.net)
99
100SEE ALSO
101 perl(1), NetAddr::IP(3).
102
103COPYRIGHT AND LICENSE
104
105This code comes with no warranty of any kind. The author cannot be
106held liable for anything arising of the use of this code under no
107circumstances.
108
109This code is released under the terms and conditions of the
110GPL. Please see the file LICENSE that accompains this distribution for
111more specific information.
112
113Copyright (C) 2001-2003 Luis E. Mu�oz <luismunoz@cpan.org>
114All rights reserved
115-----BEGIN PGP SIGNATURE-----
116Version: GnuPG v1.2.1 (Darwin)
117
118iD8DBQE+Ro9vQyDWGRI/hhARAgtdAKCbHc81UvwUe0/ku3Jfm6FMNtE3iQCgrPPm
11960e8I6EhvrLgDU2MdS9e9TM=
120=Xoiy
121-----END PGP SIGNATURE-----
122
123$Id: README,v 1.2 2003/02/09 18:47:17 lem Exp $
124