The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Sisimai::Address - Email address object

SYNOPSIS

    use Sisimai::Address;

    my $v = Sisimai::Address->new( 'neko@example.jp' );
    print $v->user;     # neko
    print $v->host;     # example.jp
    print $v->address;  # neko@example.jp

DESCRIPTION

Sisimai::Address provide methods for dealing email address.

CLASS METHODS

new( email address )

new() is a constructor of Sisimai::Address

    my $v = Sisimai::Address->new( 'neko@example.jp' );

parse( Array-Ref )

parse() is a parser for getting only email address from text including email addresses.

    my $r = [
        'Stray cat <cat@example.jp>',
        'nyaa@example.jp (White Cat)',
    ];
    my $v = Sisimai::Address->parse( $r );

    warn Dumper $v;
    $VAR1 = [
                'cat@example.jp',
                'nyaa@example.jp'
            ];

s3s4( email address )

s3s4() works Ruleset 3, and 4 of sendmail.cf.

    my $r = [
        'Stray cat <cat@example.jp>',
        'nyaa@example.jp (White Cat)',
    ];

    for my $e ( @$r ) {
        print Sisimai::Address->s3s4( $e );    # cat@example.jp
                                                # nyaa@example.jp
    }

expand_verp( email address )

expand_verp() gets the original email address from VERP

    my $r = 'nyaa+neko=example.jp@example.org';
    print Sisimai::Address->expand_verp( $r ); # neko@example.jp

expand_alias( email address )

expand_alias() gets the original email address from alias

    my $r = 'nyaa+neko@example.jp';
    print Sisimai::Address->expand_alias( $r ); # nyaa@example.jp

INSTANCE METHODS

user()

user() returns a local part of the email address.

    my $v = Sisimai::Address->new( 'neko@example.jp' );
    print $v->user;     # neko

host()

host() returns a domain part of the email address.

    my $v = Sisimai::Address->new( 'neko@example.jp' );
    print $v->host;     # example.jp

address()

address() returns the email address

    my $v = Sisimai::Address->new( 'neko@example.jp' );
    print $v->address;     # neko@example.jp

verp()

verp() returns the VERP email address

    my $v = Sisimai::Address->new( 'neko+nyaa=example.jp@example.org' );
    print $v->verp;     # neko+nyaa=example.jp@example.org
    print $v->address;  # nyaa@example.jp

alias()

alias() returns the email address (alias)

    my $v = Sisimai::Address->new( 'neko+nyaa@example.jp' );
    print $v->alias;    # neko+nyaa@example.jp
    print $v->address;  # neko@example.jp

AUTHOR

azumakuniyuki

COPYRIGHT

Copyright (C) 2014 azumakuniyuki <perl.org@azumakuniyuki.org>, All Rights Reserved.

LICENSE

This software is distributed under The BSD 2-Clause License.