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
28 A string to be interpreted as an IPv6 address.
29
30 Returns
31
32 A "Net::IPv6Addr" object if successful.
33
34 Notes
35
36 Throws an exception if the string isn't a valid address.
37
39 Parameters
40
41 A string containing an IPv6 address string. Optionally, it may also
42 include a "/" character, and a numeric prefix length, in that order.
43
44 -or-
45
46 An IPv6 address string. Optionally, a numeric prefix length.
47
48 Returns
49
50 What you gave it, more or less, if it does parse out correctly.
51
52 Notes
53
54 Throws an exception on malformed input. This is not an object method
55 or class method; it's just a subroutine.
56
58 Parameters
59
60 A string containing an IPv6 address string. Optionally, it may also
61 include a "/" character, and a numeric prefix length, in that order.
62
63 -or-
64
65 An IPv6 address string. Optionally, a numeric prefix length.
66
67 Returns
68
69 What you gave it, more or less, if it does parse out correctly, other‐
70 wise returns undef. =head2 Notes
71
72 This is not an object method or class method; it is just a subroutine.
73
75 Parameters
76
77 An IPv6 address string.
78
79 Returns
80
81 Something true if it's a valid address; something false otherwise.
82
84 Parameters
85
86 If used as an object method, none; if used as a plain old subroutine,
87 an IPv6 address string in any format.
88
89 Returns
90
91 The IPv6 address, formatted in the "preferred" way (as detailed by
92 RFC1884).
93
94 Notes
95
96 Invalid input will generate an exception.
97
99 Parameters
100
101 If used as an object method, none; if used as a plain old subroutine,
102 an IPv6 address string in any format.
103
104 Returns
105
106 The IPv6 address in "compresed" format (as detailed by RFC1884).
107
108 Notes
109
110 Invalid input will generate an exception.
111
113 Parameters
114
115 If used as an object method, none; if used as a plain old subroutine,
116 an IPv6 address string in any format.
117
118 Returns
119
120 The IPv6 address in IPv4 format (as detailed by RFC1884).
121
122 Notes
123
124 Invalid input (such as an address that was not originally IPv4) will
125 generate an exception.
126
128 Parameters
129
130 If used as an object method, none; if used as a plain old subroutine,
131 an IPv6 address string in any format.
132
133 Returns
134
135 The IPv6 address in compressed IPv4 format (as detailed by RFC1884).
136
137 Notes
138
139 Invalid input (such as an address that was not originally IPv4) will
140 generate an exception.
141
143 Parameters
144
145 If used as an object method, none; if used as a plain old subroutine,
146 an IPv6 address string in any format.
147
148 Returns
149
150 The IPv6 address in the style detailed by RFC1924.
151
152 Notes
153
154 Invalid input will generate an exception.
155
157 Parameters
158
159 If used as an object method, none; if used as a plain old subroutine,
160 an IPv6 address string in any format.
161
162 Returns
163
164 The BigInt representation of IPv6 address.
165
166 Notes
167
168 Invalid input will generate an exception.
169
171 Parameters
172
173 If used as an object method, none; if used as a plain old subroutine,
174 an IPv6 address string in any format.
175
176 Returns
177
178 An array [0..7] of 16 bit hexadecimal numbers.
179
180 Notes
181
182 Invalid input will generate an exception.
183
185 Parameters
186
187 If used as an object method, none; if used as a plain old subroutine,
188 an IPv6 address string in any format.
189
190 Returns
191
192 An array [0..7] of decimal numbers.
193
194 Notes
195
196 Invalid input will generate an exception.
197
199 Parameters
200
201 If used as an object method, none; if used as a plain old subroutine,
202 an IPv6 address string in any format.
203
204 Returns
205
206 The reverse-address pointer as defined by RFC1886.
207
208 Notes
209
210 Invalid input will generate an exception.
211
213 Parameters
214
215 If used as an object method, network size in bits
216
217 If used as a plain old subroutine, an IPv6 address string in any format
218 and network size in bits. Network size may be given with / notation.
219
220 Returns
221
222 Network IPv6Addr of given size.
223
224 Notes
225
226 Invalid input will generate an exception.
227
229 Parameters
230
231 If used as an object method, network and its size in bits
232
233 If used as a plain old subroutine, an IPv6 address string in any format
234 network address string and size in bits. Network size may be given
235 with / notation.
236
237 Returns
238
239 Something true, if address is member of the network, false otherwise.
240
241 Notes
242
243 Invalid input will generate an exception.
244
246 probably exist in this module. Please report them.
247
249 Tony Monroe <tmonroe plus perl at nog dot net>.
250
251 The module's interface probably looks like it vaguely resembles
252 Net::IPv4Addr by Francis J. Lacoste <francis dot lacoste at iNsu dot
253 COM>.
254
255 Some fixes and subroutines from Jyrki Soini <jyrki dot soini at sonera
256 dot com>.
257
259 This was originally written to simplify the task of maintaining DNS
260 records after I set myself up with Freenet6. Interesting that there's
261 really only one DNS-related subroutine in here.
262
264 RFC1884, RFC1886, RFC1924, perl, Net::IPv4Addr, Math::Base85,
265 Math::BigInt
266
267
268
269perl v5.8.8 2002-08-06 IPv6Addr(3)