NAME Email::Address::JP::Mobile - Japanese carrier email class SYNOPSIS use Email::Address::JP::Mobile; my $carrier = Email::Address::JP::Mobile->new('docomo.taro.@docomo.ne.jp'); $carrier->is_mobile; # => true $carrier->name; # => "DoCoMo" $carrier->carrier_letter; # => "I" $body = $carrier->send_encoding->encode($body); $subject = $carrier->mime_encoding->encode($subject); or, via Email::Address object use Email::Address; use Email::Address::Loose -override; use Email::Address::JP::Mobile; my ($email) = Email::Address->parse('docomo.taro.@docomo.ne.jp'); my $carrier = $email->carrier; $carrier->is_mobile; # => true DESCRIPTION Email::Address::JP::Mobile is for Japanese web developers. ã“ã®ãƒ¢ã‚¸ãƒ¥ãƒ¼ãƒ«ã¯è¦ã™ã‚‹ã« HTTP::MobileAgent ã®ãƒ¡ãƒ¼ãƒ«ç‰ˆã§ã™ã€‚ メールアドレスã‹ã‚‰ã€ãã‚ŒãŒã©ã®ã‚ャリアã§ç™ºè¡Œã•ã‚ŒãŸãƒ¡ãƒ¼ãƒ«ã‚¢ãƒ‰ãƒ¬ã‚¹ã‹ã‚’判別ã—ã¾ã™ã€‚ åŒæ§˜ã®ã“ã¨ãŒã§ãるモジュール㫠Mail::Address::MobileJp ãŒã‚ã‚Šã¾ã™ã€‚ Email::Address::JP::Mobile 㯠Email::Address オブジェクトを拡張ã™ã‚‹ç‚¹ã‚„〠"is_mobile($email)" ã§ã¯ãªã "$carrier->is_mobile()" ã¨ã„ã†ã‚¤ãƒ³ã‚¿ãƒ¼ãƒ•ã‚§ãƒ¼ã‚¹ã§ã‚る点ãŒé•ã„ã¾ã™ã€‚ USAGE $carrier = Email::Address::JP::Mobile->new( $address ) メールアドレスã‹ã‚‰ã€Email::Address::JP::Mobile::* ã®å¯¾å¿œã—ãŸã‚¯ãƒ©ã‚¹ã‚’è¿”ã—ã¾ã™ã€‚ my $carrier = Email::Address::JP::Mobile->new('docomo.taro.@docomo.ne.jp'); # $carrier is a Email::Address::JP::Mobile::DoCoMo $carrier->is_mobile; # => true $carrier->name; # => "DoCoMo" $carrier->carrier_letter; # => "I" æºå¸¯ã®ãƒ¡ãƒ¼ãƒ«ã‚¢ãƒ‰ãƒ¬ã‚¹ã§ã¯ãªã„ã¨åˆ¤æ–ã—ãŸå ´åˆã¯ Email::Address::JP::Mobile::NonMobile クラスを返ã—ã¾ã™ã€‚ $carrier = $email->carrier() Email::Address::JP::Mobile 㯠Email::Address オブジェクトã«ã€å¯¾å¿œã—ãŸã‚¯ãƒ©ã‚¹ã‚’返㙠"carrier()" ã¨ã„ã†ãƒ¡ã‚½ãƒƒãƒ‰ã‚’æ‹¡å¼µã—ã¾ã™ã€‚ use Email::Address; use Email::Address::Loose -override; use Email::Address::JP::Mobile; my ($email) = Email::Address->parse('docomo.taro@docomo.ne.jp'); $email->carrier->carrier_letter; # "I" ã”å˜çŸ¥ã®ã‚ˆã†ã«æ—¥æœ¬ã®æºå¸¯ã¯å¤‰ãªã‚¢ãƒ‰ãƒ¬ã‚¹ãŒè¨±å¯ã•ã‚Œã¦ã„る期間ãŒé•·ã‹ã£ãŸã®ã§ã€ æºå¸¯ã‚¢ãƒ‰ãƒ¬ã‚¹ã‚’パースã™ã‚‹å¯èƒ½æ€§ãŒã‚ã‚‹ã®ã§ã‚れ㰠Email::Address::Loose ã‚’ 併用ã—ãŸæ–¹ãŒã‚ˆã„ã§ã™ã€‚ CARRIER CLASS METHODS $carrier->is_mobile() $carrier->name() $carrier->carrier_letter() å„メソッドãŒè¿”ã™å€¤ã¯ä»¥ä¸‹ã®ã¨ãŠã‚Šã§ã™ã€‚ is_mobile name carrier_letter ------------------------------------------------- DoCoMo true "DoCoMo" "I" au true "EZweb" "E" SoftBank true "SoftBank" "V" WILLCOM true "AirH" "H" NonMobile false "NonMobile" "N" "carrier_letter()" ãŒè¿”ã™å€¤ã¯ HTTP::MobileAgent ã® "carrier()" ãŒè¿”ã™å€¤ã¨åŒã˜ã§ã™ã€‚ãŸã ã—ã€ã“ã®ãƒ¢ã‚¸ãƒ¥ãƒ¼ãƒ«ãŒè¿”ã™ "name()" ã®å€¤ã¯ HTTP::MobileAgent ã® "carrier_longname()" ãŒè¿”ã™å€¤ã¨ã¯å°‘ã—ç•°ãªã‚Šã¾ã™ã®ã§æ³¨æ„ã—ã¦ãã ã•ã„。 $carrier->mime_encoding() $subject = $carrier->mime_encoding->encode($subject); $subject = $carrier->mime_encoding->decode($subject); ãã®ã‚ャリアå‘ã‘ã«ãƒ¡ãƒ¼ãƒ«ã‚’é€ä¿¡ã™ã‚‹éš›ã€çµµæ–‡å—ã‚’å«ã‚“ã Subject ã‚’ MIME encode ã™ã‚‹ãŸã‚ã®ã‚¨ãƒ³ã‚³ãƒ¼ãƒ‡ã‚£ãƒ³ã‚°ã‚’è¿”ã—ã¾ã™ã€‚何を返ã™ã‹ã¯ "ENCODINGS" ã‚’å‚ç…§ã—ã¦ãã ã•ã„。 æºå¸¯ã®å ´åˆã¯ã€ãã®ã‚ャリアã®ç«¯æœ«ã‹ã‚‰å—ä¿¡ã—ãŸãƒ¡ãƒ¼ãƒ«ã® Subject ã‚’ MIME decode ã™ã‚‹ãŸã‚ã«ã‚‚利用ã§ãã¾ã™ã€‚ãŸã ã— DoCoMo ã‚„ SoftBank ã‹ã‚‰ã®å ´åˆçµµæ–‡å—ã¯æœ€åˆã‹ã‚‰ã‚²ã‚¿ã«ãªã£ã¦ã„ã‚‹ãŸã‚å–ã‚Œãªã„ã§ã—ょã†ã€‚ NonMobile ã®å ´åˆã«ã¯ "MIME-Header-ISO_2022_JP" エンコーディングを返ã—ã¾ã™ãŒã€ã“ã‚Œã¯ç¾çŠ¶ decode ã«å¯¾å¿œã—ã¦ã„ã¾ã›ã‚“。代ã‚ã‚Šã« "MIME-Header" ã¨ã„ã†ã‚¨ãƒ³ã‚³ãƒ¼ãƒ‡ã‚£ãƒ³ã‚°ã§ decode ã™ã‚‹å¿…è¦ãŒã‚ã‚‹ã®ã§æ³¨æ„ã—ã¦ãã ã•ã„。 $carrier->send_encoding() $body = $carrier->send_encoding->encode($body); ãã®ã‚ャリアå‘ã‘ã«ãƒ¡ãƒ¼ãƒ«ã‚’é€ä¿¡ã™ã‚‹éš›ã€çµµæ–‡å—ã‚’å«ã‚“ã メール本文を encode ã™ã‚‹ãŸã‚ã®ã‚¨ãƒ³ã‚³ãƒ¼ãƒ‡ã‚£ãƒ³ã‚°ã‚’è¿”ã—ã¾ã™ã€‚何を返ã™ã‹ã¯ "ENCODINGS" ã‚’å‚ç…§ã—ã¦ãã ã•ã„。 $carrier->parse_encoding() $body = $carrier->parse_encoding->decode($body); ãã®ã‚ャリアã‹ã‚‰å—ä¿¡ã—ãŸãƒ¡ãƒ¼ãƒ«ã®çµµæ–‡å—ã‚’å«ã‚“ã メール本文を decode ã™ã‚‹ãŸã‚ã®ã‚¨ãƒ³ã‚³ãƒ¼ãƒ‡ã‚£ãƒ³ã‚°ã‚’è¿”ã—ã¾ã™ã€‚ãŒã€ã“ã‚Œã¯ãƒ¡ãƒ¼ãƒ«æœ¬æ–‡ã® "Content-Type" ã‚’ãƒã‚§ãƒƒã‚¯ã—ã¦ã„ã‚‹ã‚ã‘ã§ã¯ãªãã€ãã®ã‚ャリアã®å ´åˆã“ã®ã‚¨ãƒ³ã‚³ãƒ¼ãƒ‡ã‚£ãƒ³ã‚°ã§é€ã£ã¦ãã‚‹ã ã‚ã†ã¨ã„ã†ã‚‚ã®ã‚’è¿”ã—ã¦ã„ã‚‹ã ã‘ã§ã‚る点ã«ç•™æ„ã—ã¦ãã ã•ã„。ã¾ãŸã€DoCoMo ã‚„ SoftBank ã‹ã‚‰ã®å ´åˆçµµæ–‡å—ã¯æœ€åˆã‹ã‚‰ã‚²ã‚¿ã«ãªã‚Šå–ã‚Œãªã„ãŸã‚ã€"iso-2022-jp" ã‚’è¿”ã—ã¾ã™ã€‚ ãã®ãŸã‚ã€å—ä¿¡ã®å ´åˆã¯çµµæ–‡å—ã®ã“ã¨ã¯å¿˜ã‚Œã¦ Email::MIME ã® "header()" ã‚„ "body_str()" を使ã£ã¦ decode ã™ã‚‹ã¨è‰¯ã„ã§ã—ょã†ã€‚ ENCODINGS 上記ã®å„メソッドãŒè¿”ã™ã‚¨ãƒ³ã‚³ãƒ¼ãƒ‡ã‚£ãƒ³ã‚°ã¯ä»¥ä¸‹ã®ã¨ãŠã‚Šã§ã™ã€‚(返ã™ã®ã¯æ–‡å—列ã§ã¯ãªã Encode::Encoding ã§ã™ï¼‰ mime_encoding send_encoding parse_encoding ------------------------------------------------------------------------------------ DoCoMo MIME-Header-JP-Mobile-DoCoMo x-sjis-docomo iso-2022-jp au MIME-Header-JP-Mobile-KDDI x-sjis-kddi-auto x-iso-2022-jp-kddi-auto SoftBank MIME-Header-JP-Mobile-SoftBank x-utf8-softbank iso-2022-jp WILLCOM MIME-Header-JP-Mobile-AirH x-sjis-airh x-iso-2022-jp-airh NonMobile MIME-Header-ISO_2022_JP iso-2022-jp iso-2022-jp MIME-Header-JP-Mobile-* ã‚„ x-* ã®ã‚¨ãƒ³ã‚³ãƒ¼ãƒ‡ã‚£ãƒ³ã‚°ã¯ Encode::JP::Mobile ãŒæä¾›ã™ã‚‹ã‚¨ãƒ³ã‚³ãƒ¼ãƒ‡ã‚£ãƒ³ã‚°ã§ã™ã€‚ $Email::Address::JP::Mobile::NonMobile::Encoding local $Email::Address::JP::Mobile::NonMobile::Encoding = 'utf-8'; my $carrier = Email::Address::JP::Mobile->new('tomita@example.com'); $carrier->mime_encoding; # MIME-Header encoding $carrier->send_encoding; # utf-8 encoding $carrier->parse_encoding; # utf-8 encoding NonMobile ã®å ´åˆã®ãƒ‡ãƒ•ã‚©ãƒ«ãƒˆã‚¨ãƒ³ã‚³ãƒ¼ãƒ‡ã‚£ãƒ³ã‚°ã¯ "iso-2022-jp" ã§ã™ãŒã€ã“ã®å¤‰æ•°ã§ "utf-8" を指定ã™ã‚‹ã¨ä¸Šè¨˜ã®ã‚ˆã†ãªã‚¨ãƒ³ã‚³ãƒ¼ãƒ‡ã‚£ãƒ³ã‚°ã‚’è¿”ã—ã¾ã™ã€‚ SEE ALSO <http://coderepos.org/share/wiki/Mobile/Encoding> Email::Address::Loose, Encode::JP::Mobile Email::MIME::MobileJP - 具体的ãªåˆ©ç”¨ä¾‹ #mobilejp on irc.freenode.net (I've joined as "tomi-ru") AUTHOR Naoki Tomita <tomita@cpan.org> LICENSE This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.