Sisimai::Address - Email address object
use Sisimai::Address; my $v = Sisimai::Address->new('neko@example.org'); print $v->user; # neko print $v->host; # example.org print $v->address; # neko@example.org
Sisimai::Address provide methods for dealing email address.
new(email address)
new() is a constructor of Sisimai::Address
new()
my $v = Sisimai::Address->new('neko@example.org');
find(String)
find() is a new parser for getting only email address from text including email addresses.
find()
my $r = 'Stray cat <cat@example.org>, nyaa@example.org (White Cat)', my $v = Sisimai::Address->find($r); warn Dumper $v; $VAR1 = [ { 'name' => 'Stray cat', 'address' => 'cat@example.org', 'comment' => '' }, { 'name' => '', 'address' => 'nyaa@example.jp', 'comment' => '(White Cat)' } ];
parse(Array-Ref)
parse() is a parser for getting only email address from text including email addresses.
parse()
my $r = [ 'Stray cat <cat@example.org>', 'nyaa@example.org (White Cat)', ]; my $v = Sisimai::Address->parse($r); warn Dumper $v; $VAR1 = ['cat@example.org', 'nyaa@example.org'];
s3s4(email address)
s3s4() works Ruleset 3, and 4 of sendmail.cf.
s3s4()
my $r = [ 'Stray cat <cat@example.org>', 'nyaa@example.org (White Cat)', ]; for my $e ( @$r ) { print Sisimai::Address->s3s4($e); # cat@example.org # nyaa@example.org }
expand_verp(email address)
expand_verp() gets the original email address from VERP
expand_verp()
my $r = 'nyaa+neko=example.org@example.org'; print Sisimai::Address->expand_verp($r); # neko@example.org
expand_alias(email address)
expand_alias() gets the original email address from alias
expand_alias()
my $r = 'nyaa+neko@example.org'; print Sisimai::Address->expand_alias($r); # nyaa@example.org
user()
user() returns a local part of the email address.
my $v = Sisimai::Address->new('neko@example.org'); print $v->user; # neko
host()
host() returns a domain part of the email address.
my $v = Sisimai::Address->new('neko@example.org'); print $v->host; # example.org
address()
address() returns an email address
my $v = Sisimai::Address->new('neko@example.org'); print $v->address; # neko@example.org
verp()
verp() returns a VERP email address
my $v = Sisimai::Address->new('neko+nyaan=example.org@example.org'); print $v->verp; # neko+nyaan=example.org@example.org print $v->address; # nyaan@example.org
alias()
alias() returns an email address (alias)
my $v = Sisimai::Address->new('neko+nyaan@example.org'); print $v->alias; # neko+nyaan@example.org print $v->address; # neko@example.org
name()
name() returns a dislay name
my $e = '"Neko, Nyaan" <neko@example.org>'; my $r = Sisimai::Address->find($e); my $v = Sisimai::Address->make($r->[0]); print $v->address; # neko@example.org print $v->name; # Neko, Nyaan
comment()
name() returns a comment
my $e = '"Neko, Nyaan" <neko(nyaan)@example.org>'; my $v = Sisimai::Address->make(shift @{ Sisimai::Address->find($e) }); print $v->address; # neko@example.org print $v->comment; # nyaan
azumakuniyuki
Copyright (C) 2014-2017 azumakuniyuki, All rights reserved.
This software is distributed under The BSD 2-Clause License.
To install Sisimai, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Sisimai
CPAN shell
perl -MCPAN -e shell install Sisimai
For more information on module installation, please visit the detailed CPAN module installation guide.