### ----------------------------------------------------
### -- IP::Addr
### -- Licenses: Artistic-2.0
### -- Authors: Vadim Belman <vrurg@cpan.org>
### -- File: docs/md/IP/Addr/v6.md
### ----------------------------------------------------
NAME
====

IP::Addr::v6

SYNOPSIS
========

    my $ip = IP::Addr.new( "2001::/120", :abbreviated, :compact );
    say $ip;                # 2001::/120

    my $ip = IP::Addr.new( "2001::/120", :abbreviated, :!compact );
    say $ip;                # 2001:0:0:0:0:0:0:0/120

    my $ip = IP::Addr.new( "2001::/120", :!abbreviated, :!compact );
    say $ip;                # 2001:0000:0000:0000:0000:0000:0000:0000/120

    my $ip = IP::Addr.new( "2001:0000:0000:0000:0000:0000:0000:0000/120" );
    say $ip;                # 2001:0000:0000:0000:0000:0000:0000:0000/120

    my $ip = IP::Addr.new( "2001::/120" );
    say $ip;                # 2001::/120

DESCRIPTION
===========

Class implements IPv6 handler.

When initialized from a string representation of a IPv6 address this handler tries to preserve the original formatting. E.g. it memorizes whether the source string had abbreviated hextets or was in compact form (contained *::*). The [SYNOPSIS](#SYNOPSIS) section demonstrates this behavior in the last two examples.

Attributes
----------

### `$.scope`

For a scoped IPv6 address this attribute contains its scope (i.e. – interface).

### `Bool $.abbreviated`

This attribute defines if hextets in string representation of IPv6 address would be in their full 4-digit form or abbreviated – i.e. leading zeroes dropped. If it is *False* then `$.compact` value is ignored when address is being stringified.

### `Bool $.compact`

If *True* then address string representation will have longest streak of zero hextets compacted into *::*.

### `Bool $.mapped`

This attribute is set by parser to *True* if source string represents a IPv4 mapped form of IPv6.

Methods
-------

### `to-hextets`

Alias for `to-n-tets` method.

EXAMPLES
========

    my $ip = IP::Addr.new( "2001::/120", :abbreviated, :!compact );
    say $ip;                # 2001:0:0:0:0:0:0:0/120
    $ip.abbreviated = False;
    say $ip;                # 2001:0000:0000:0000:0000:0000:0000:0000/120
    # Won't be in effect due to abbreviation being turned off
    $ip.compact = True;     
    say $ip;                # 2001:0000:0000:0000:0000:0000:0000:0000/120
    # Now both abbreviation and compactness will be activated
    $ip.abbreviated = True;
    say $ip;                # 2001::/120

AUTHOR
======

Vadim Belman <vrurg@cpan.org>

SEE ALSO
========

IP::Addr, IP::Addr::Handler



