App-Twimap

 view release on metacpan or  search on metacpan

lib/App/Twimap/Tweet.pm  view on Meta::CPAN

        Date         => $date,
        'Message-Id' => "<$tid\@twitter>",
    );
    push @headers, 'In-Reply-To' => $in_reply_to if $in_reply_to;

    my @parts = (
        Email::MIME->create(
            attributes => {
                content_type => "text/plain",
                disposition  => "inline",
                charset      => "utf-8",

            },
            header_str => [ Date => $date ],
            body       => $body_text,
        ),
        Email::MIME->create(
            attributes => {
                content_type => "text/html",
                disposition  => "inline",
                charset      => "utf-8",

            },
            header_str => [ Date => $date ],
            body       => $body_html,
        ),
    );

    my $email = Email::MIME->create(
        attributes => {
            boundary     => '1317546824.2C8b2BC51.4794',
            content_type => "multipart/alternative",
            charset      => "utf-8",
        },
        header_str => \@headers,
        parts      => [@parts],
    );

    return $email;
}

sub expand_url {
    my ( $self, $url ) = @_;

t/email.t  view on Meta::CPAN

    }
);

eq_or_diff(
    $tweet->to_email->as_string,
    'From: "Simon Wistow" <deflatermouse@twitter> (deflatermouse)
Subject: Breakfast http://lockerz.com/s/135515455
Date: Sat, 3 Sep 2011 20:39:51 +0100
Message-Id: <110074547411238913@twitter>
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="1317546824.2C8b2BC51.4794"; charset="utf-8"


--1317546824.2C8b2BC51.4794
Date: Sat, 3 Sep 2011 20:39:51 +0100
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Disposition: inline

Breakfast http://lockerz.com/s/135515455

https://twitter.com/deflatermouse/status/110074547411238913
--1317546824.2C8b2BC51.4794
Date: Sat, 3 Sep 2011 20:39:51 +0100
MIME-Version: 1.0
Content-Type: text/html; charset="utf-8"
Content-Disposition: inline

Breakfast <a href="http://lockerz.com/s/135515455">http://lockerz.com/s/135515455</a>
<br/><br/>
<a href="http://c0013938.cdn1.cloudfiles.rackspacecloud.com/x2_813cd3f" title="x2_813cd3f"><img alt="x2_813cd3f" height="79" src="http://c0013942.cdn1.cloudfiles.rackspacecloud.com/x2_813cd3f" width="79" /></a><br/><br/>

<a href="https://twitter.com/deflatermouse/status/110074547411238913">https://twitter.com/deflatermouse/status/110074547411238913</a>
--1317546824.2C8b2BC51.4794--
'
);

t/email.t  view on Meta::CPAN

eq_or_diff(
    $tweet->to_email->as_string,
    'From: "Tim Bunce" <timbunce@twitter> (timbunce)
Subject: RT @siracusa: More on iCloud, Microsoft Azure, and Amazon AWS:
 http://www.
 theregister.co.uk/2011/09/02/icloud_runs_on_microsoft_azure_and_amazon/ ( via
 @tapbot_paul)
Date: Sat, 3 Sep 2011 23:13:06 +0100
Message-Id: <110113112895660033@twitter>
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="1317546824.2C8b2BC51.4794"; charset="utf-8"


--1317546824.2C8b2BC51.4794
Date: Sat, 3 Sep 2011 23:13:06 +0100
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Disposition: inline

RT @siracusa: More on iCloud, Microsoft Azure, and Amazon AWS:
http://www.theregister.co.uk/2011/09/02/icloud_runs_on_microsoft_azure_and_amazon/
(via @tapbot_paul)

https://twitter.com/timbunce/status/110113112895660033
--1317546824.2C8b2BC51.4794
Date: Sat, 3 Sep 2011 23:13:06 +0100
MIME-Version: 1.0
Content-Type: text/html; charset="utf-8"
Content-Disposition: inline

RT @siracusa: More on iCloud, Microsoft Azure, and Amazon AWS: <a href="http://www.theregister.co.uk/2011/09/02/icloud_runs_on_microsoft_azure_and_amazon/">http://www.theregister.co.uk/2011/09/02/icloud_runs_on_microsoft_azure_and_amazon/</a> (via @t...
<br/><br/>
<br/><br/>

<a href="https://twitter.com/timbunce/status/110113112895660033">https://twitter.com/timbunce/status/110113112895660033</a>
--1317546824.2C8b2BC51.4794--
'
);

t/email.t  view on Meta::CPAN

eq_or_diff(
    $tweet->to_email->as_string,
    "From: \"David E. Wheeler\" <theory\@twitter> (theory)
Subject:
 =?UTF-8?Q?=E2=80=9CCould=20You=20Afford=20t?==?UTF-8?Q?o=20be=20Poor?=?
 =?UTF-8?Q?=E2=80=9D=20http?=://ehrenreich.blogs.com/barbaras_blog/2006/07/
 could_you_affor.html
Date: Sun, 4 Sep 2011 08:28:58 +0100
Message-Id: <110253001725321216\@twitter>
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary=\"1317546824.2C8b2BC51.4794\"; charset=\"utf-8\"


--1317546824.2C8b2BC51.4794
Date: Sun, 4 Sep 2011 08:28:58 +0100
MIME-Version: 1.0
Content-Type: text/plain; charset=\"utf-8\"
Content-Disposition: inline

\x{201c}Could You Afford to be Poor?\x{201d}
http://ehrenreich.blogs.com/barbaras_blog/2006/07/could_you_affor.html

https://twitter.com/theory/status/110253001725321216
--1317546824.2C8b2BC51.4794
Date: Sun, 4 Sep 2011 08:28:58 +0100
MIME-Version: 1.0
Content-Type: text/html; charset=\"utf-8\"
Content-Disposition: inline

\x{201c}Could You Afford to be Poor?\x{201d} <a href=\"http://ehrenreich.blogs.com/barbaras_blog/2006/07/could_you_affor.html\">http://ehrenreich.blogs.com/barbaras_blog/2006/07/could_you_affor.html</a>
<br/><br/>
<br/><br/>

<a href=\"https://twitter.com/theory/status/110253001725321216\">https://twitter.com/theory/status/110253001725321216</a>
--1317546824.2C8b2BC51.4794--
"
);

t/email.t  view on Meta::CPAN

eq_or_diff(
    $tweet->to_email->as_string,
    'From: "Schwern" <schwern@twitter> (schwern)
Subject: The difference between a good programmer
 (http://spacechem.net/solution/ no-ordinary-headache/22106) and a GREAT
 programmer (http://spacechem.net/ solution/no-ordinary-headache/1717)
 #SpaceChem
Date: Sun, 4 Sep 2011 07:28:25 +0100
Message-Id: <110237761818210305@twitter>
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="1317546824.2C8b2BC51.4794"; charset="utf-8"


--1317546824.2C8b2BC51.4794
Date: Sun, 4 Sep 2011 07:28:25 +0100
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Disposition: inline

The difference between a good programmer
(http://spacechem.net/solution/no-ordinary-headache/22106) and a GREAT
programmer (http://spacechem.net/solution/no-ordinary-headache/1717)
#SpaceChem

https://twitter.com/schwern/status/110237761818210305
--1317546824.2C8b2BC51.4794
Date: Sun, 4 Sep 2011 07:28:25 +0100
MIME-Version: 1.0
Content-Type: text/html; charset="utf-8"
Content-Disposition: inline

The difference between a good programmer (<a href="http://spacechem.net/solution/no-ordinary-headache/22106">http://spacechem.net/solution/no-ordinary-headache/22106</a>) and a GREAT programmer (<a href="http://spacechem.net/solution/no-ordinary-head...
<br/><br/>
<br/><br/>

<a href="https://twitter.com/schwern/status/110237761818210305">https://twitter.com/schwern/status/110237761818210305</a>
--1317546824.2C8b2BC51.4794--
'
);

t/email.t  view on Meta::CPAN

 =?UTF-8?Q?=20reply=E3=81=82=E3=82=8A=E3=81=8C=E3=81=A8=E3=81=86?=
 =?UTF-8?Q?=E3=81=94=E3=81=96=E3=81=84=E3=81=BE=E3=81=99=E3=80=82=E6=97=A9?=
 =?UTF-8?Q?=E9=80=9F=E8=B3=BC=E5=85=A5=E3=81=97=E3=81=BE=E3=81=97=E3=81=9F?=
 =?UTF-8?Q?=E3=80=82=E3=80=8C=E6=96=B0=E6=9B=B8=E3=81=8C=E3=83=99=E3=82=B9?=
 =?UTF-8?Q?=E3=83=88=E3=80=8D=E3=82=82=E5=A5=BD=E3=81=8D=E3=81=A7=E3=82=88?=
 =?UTF-8?Q?=E3=81=8F=E8=AA=AD=E3=82=93=E3=81=A7=E3=81=84=E3=81=BE=E3=81=99?=
 <\@dankogai: http://blog.livedoor.jp/dankogai/archives/51529999.html
Date: Tue, 13 Sep 2011 17:27:16 +0100
Message-Id: <113649960246980608\@twitter>
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary=\"1317546824.2C8b2BC51.4794\"; charset=\"utf-8\"


--1317546824.2C8b2BC51.4794
Date: Tue, 13 Sep 2011 17:27:16 +0100
MIME-Version: 1.0
Content-Type: text/plain; charset=\"utf-8\"
Content-Disposition: inline

\x{6539}\x{3081}\x{3066}\x{5fa1}\x{793c}\x{306a}\x{3046}m(__)m&lt; \@lunashingo:
reply\x{3042}\x{308a}\x{304c}\x{3068}\x{3046}\x{3054}\x{3056}\x{3044}\x{307e}\x{3059}\x{3002}\x{65e9}\x{901f}\x{8cfc}\x{5165}\x{3057}\x{307e}\x{3057}\x{305f}\x{3002}\x{300c}\x{65b0}\x{66f8}\x{304c}\x{30d9}\x{30b9}\x{30c8}\x{300d}\x{3082}\x{597d}\x{30...
http://blog.livedoor.jp/dankogai/archives/51529999.html

https://twitter.com/dankogai/status/113649960246980608
--1317546824.2C8b2BC51.4794
Date: Tue, 13 Sep 2011 17:27:16 +0100
MIME-Version: 1.0
Content-Type: text/html; charset=\"utf-8\"
Content-Disposition: inline

\x{6539}\x{3081}\x{3066}\x{5fa1}\x{793c}\x{306a}\x{3046}m(__)m&lt; \@lunashingo: reply\x{3042}\x{308a}\x{304c}\x{3068}\x{3046}\x{3054}\x{3056}\x{3044}\x{307e}\x{3059}\x{3002}\x{65e9}\x{901f}\x{8cfc}\x{5165}\x{3057}\x{307e}\x{3057}\x{305f}\x{3002}\x{3...
<br/><br/>
<br/><br/>

<a href=\"https://twitter.com/dankogai/status/113649960246980608\">https://twitter.com/dankogai/status/113649960246980608</a>
--1317546824.2C8b2BC51.4794--
"
);



( run in 0.268 second using v1.01-cache-2.11-cpan-4d50c553e7e )