1IPv6Addr(3) User Contributed Perl Documentation IPv6Addr(3)
2
3
4
6 Net::IPv6Addr -- check validity of IPv6 addresses
7
9 use Net::IPv6Addr;
10
11 Net::IPv6Addr::ipv6_parse($addr);
12 $x = new Net::IPv6Addr("dead:beef:cafe:babe::f0ad");
13 print $x->to_string_preferred(), "\n";
14
16 "Net::IPv6Addr" checks strings for valid IPv6 addresses, as specified
17 in RFC1884. You throw possible addresses at it, it either accepts them
18 or throws an exception.
19
20 If "Math::Base85" is installed, then this module is able to process
21 addresses formatted in the style referenced by RFC1924.
22
23 The public interface of this module is rather small.
24
26 Parameters
27 A string to be interpreted as an IPv6 address.
28
29 Returns
30 A "Net::IPv6Addr" object if successful.
31
32 Notes
33 Throws an exception if the string isn't a valid address.
34
36 Parameters
37 A string containing an IPv6 address string. Optionally, it may also
38 include a "/" character, and a numeric prefix length, in that order.
39
40 -or-
41
42 An IPv6 address string. Optionally, a numeric prefix length.
43
44 Returns
45 What you gave it, more or less, if it does parse out correctly.
46
47 Notes
48 Throws an exception on malformed input. This is not an object method
49 or class method; it's just a subroutine.
50
52 Parameters
53 A string containing an IPv6 address string. Optionally, it may also
54 include a "/" character, and a numeric prefix length, in that order.
55
56 -or-
57
58 An IPv6 address string. Optionally, a numeric prefix length.
59
60 Returns
61 What you gave it, more or less, if it does parse out correctly,
62 otherwise returns undef. =head2 Notes
63
64 This is not an object method or class method; it is just a subroutine.
65
67 Parameters
68 An IPv6 address string.
69
70 Returns
71 Something true if it's a valid address; something false otherwise.
72
74 Parameters
75 If used as an object method, none; if used as a plain old subroutine,
76 an IPv6 address string in any format.
77
78 Returns
79 The IPv6 address, formatted in the "preferred" way (as detailed by
80 RFC1884).
81
82 Notes
83 Invalid input will generate an exception.
84
86 Parameters
87 If used as an object method, none; if used as a plain old subroutine,
88 an IPv6 address string in any format.
89
90 Returns
91 The IPv6 address in "compresed" format (as detailed by RFC1884).
92
93 Notes
94 Invalid input will generate an exception.
95
97 Parameters
98 If used as an object method, none; if used as a plain old subroutine,
99 an IPv6 address string in any format.
100
101 Returns
102 The IPv6 address in IPv4 format (as detailed by RFC1884).
103
104 Notes
105 Invalid input (such as an address that was not originally IPv4) will
106 generate an exception.
107
109 Parameters
110 If used as an object method, none; if used as a plain old subroutine,
111 an IPv6 address string in any format.
112
113 Returns
114 The IPv6 address in compressed IPv4 format (as detailed by RFC1884).
115
116 Notes
117 Invalid input (such as an address that was not originally IPv4) will
118 generate an exception.
119
121 Parameters
122 If used as an object method, none; if used as a plain old subroutine,
123 an IPv6 address string in any format.
124
125 Returns
126 The IPv6 address in the style detailed by RFC1924.
127
128 Notes
129 Invalid input will generate an exception.
130
132 Parameters
133 If used as an object method, none; if used as a plain old subroutine,
134 an IPv6 address string in any format.
135
136 Returns
137 The BigInt representation of IPv6 address.
138
139 Notes
140 Invalid input will generate an exception.
141
143 Parameters
144 If used as an object method, none; if used as a plain old subroutine,
145 an IPv6 address string in any format.
146
147 Returns
148 An array [0..7] of 16 bit hexadecimal numbers.
149
150 Notes
151 Invalid input will generate an exception.
152
154 Parameters
155 If used as an object method, none; if used as a plain old subroutine,
156 an IPv6 address string in any format.
157
158 Returns
159 An array [0..7] of decimal numbers.
160
161 Notes
162 Invalid input will generate an exception.
163
165 Parameters
166 If used as an object method, none; if used as a plain old subroutine,
167 an IPv6 address string in any format.
168
169 Returns
170 The reverse-address pointer as defined by RFC1886.
171
172 Notes
173 Invalid input will generate an exception.
174
176 Parameters
177 If used as an object method, network size in bits
178
179 If used as a plain old subroutine, an IPv6 address string in any format
180 and network size in bits. Network size may be given with / notation.
181
182 Returns
183 Network IPv6Addr of given size.
184
185 Notes
186 Invalid input will generate an exception.
187
189 Parameters
190 If used as an object method, network and its size in bits
191
192 If used as a plain old subroutine, an IPv6 address string in any format
193 network address string and size in bits. Network size may be given
194 with / notation.
195
196 Returns
197 Something true, if address is member of the network, false otherwise.
198
199 Notes
200 Invalid input will generate an exception.
201
203 probably exist in this module. Please report them.
204
206 Tony Monroe <tmonroe plus perl at nog dot net>.
207
208 The module's interface probably looks like it vaguely resembles
209 Net::IPv4Addr by Francis J. Lacoste <francis dot lacoste at iNsu dot
210 COM>.
211
212 Some fixes and subroutines from Jyrki Soini <jyrki dot soini at sonera
213 dot com>.
214
216 This was originally written to simplify the task of maintaining DNS
217 records after I set myself up with Freenet6. Interesting that there's
218 really only one DNS-related subroutine in here.
219
221 RFC1884, RFC1886, RFC1924, perl, Net::IPv4Addr, Math::Base85,
222 Math::BigInt
223
224
225
226perl v5.12.0 2002-08-06 IPv6Addr(3)