<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Perl+Twitter : Getting @mentions from command line</title>
	<atom:link href="http://www.sakana.fr/blog/2010/01/24/perltwitter-getting-mentions-from-command-line/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sakana.fr/blog/2010/01/24/perltwitter-getting-mentions-from-command-line/</link>
	<description>On the fly saving of few useful (?) tech tips</description>
	<lastBuildDate>Sun, 05 Feb 2012 16:37:55 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
	<item>
		<title>By: Scripting Twitter with cURL&#160;-&#160;Tech@Sakana &#8211; A sysadmin&#8217;s blog</title>
		<link>http://www.sakana.fr/blog/2010/01/24/perltwitter-getting-mentions-from-command-line/comment-page-1/#comment-8372</link>
		<dc:creator>Scripting Twitter with cURL&#160;-&#160;Tech@Sakana &#8211; A sysadmin&#8217;s blog</dc:creator>
		<pubDate>Sat, 06 Mar 2010 10:31:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.sakana.fr/blog/?p=397#comment-8372</guid>
		<description>[...] Perl+Twitter : Getting @mentions from command line [...]</description>
		<content:encoded><![CDATA[<p>[...] Perl+Twitter : Getting @mentions from command line [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stephane Kattoor</title>
		<link>http://www.sakana.fr/blog/2010/01/24/perltwitter-getting-mentions-from-command-line/comment-page-1/#comment-8328</link>
		<dc:creator>Stephane Kattoor</dc:creator>
		<pubDate>Wed, 03 Feb 2010 20:20:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.sakana.fr/blog/?p=397#comment-8328</guid>
		<description>Hello Phil,

It&#039;s was more a question of balance between keeping the code small, and adding module dependencies. For what my code snippet does, I&#039;d say I wouldn&#039;t have gained much simplicity from using LWP::UserAgent (which I love, btw :) ).

Still, same as previous comment : if I&#039;d wanted to make something more robust and / or efficient, I&#039;d probably have been with Net::Twitter as it does everything.

Thanks for your comment !

Stephane</description>
		<content:encoded><![CDATA[<p>Hello Phil,</p>
<p>It&#8217;s was more a question of balance between keeping the code small, and adding module dependencies. For what my code snippet does, I&#8217;d say I wouldn&#8217;t have gained much simplicity from using LWP::UserAgent (which I love, btw <img src='http://www.sakana.fr/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  ).</p>
<p>Still, same as previous comment : if I&#8217;d wanted to make something more robust and / or efficient, I&#8217;d probably have been with Net::Twitter as it does everything.</p>
<p>Thanks for your comment !</p>
<p>Stephane</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Phil Hollenback</title>
		<link>http://www.sakana.fr/blog/2010/01/24/perltwitter-getting-mentions-from-command-line/comment-page-1/#comment-8326</link>
		<dc:creator>Phil Hollenback</dc:creator>
		<pubDate>Sun, 31 Jan 2010 20:13:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.sakana.fr/blog/?p=397#comment-8326</guid>
		<description>Another pretty simple way to go is just use LWP::UserAgent to query the twitter REST api instead of using curl for the download.  Of course as Dave points out then you might as well look at using Net::Twitter.  The advantage of combining your approach with LWP::UserAgent (or LWP::UserAgent with XML:LibXML) is that it&#039;s a great way to learn how the underlying protocols work.</description>
		<content:encoded><![CDATA[<p>Another pretty simple way to go is just use LWP::UserAgent to query the twitter REST api instead of using curl for the download.  Of course as Dave points out then you might as well look at using Net::Twitter.  The advantage of combining your approach with LWP::UserAgent (or LWP::UserAgent with XML:LibXML) is that it&#8217;s a great way to learn how the underlying protocols work.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stephane Kattoor</title>
		<link>http://www.sakana.fr/blog/2010/01/24/perltwitter-getting-mentions-from-command-line/comment-page-1/#comment-8315</link>
		<dc:creator>Stephane Kattoor</dc:creator>
		<pubDate>Sun, 24 Jan 2010 20:10:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.sakana.fr/blog/?p=397#comment-8315</guid>
		<description>@Dave : Thanks for your input ! I was aware of that Net::Twitter module, but I felt like re-inventing the wheel :) Of course if I was to do anything serious with twitter in Perl, I&#039;d use the module !</description>
		<content:encoded><![CDATA[<p>@Dave : Thanks for your input ! I was aware of that Net::Twitter module, but I felt like re-inventing the wheel <img src='http://www.sakana.fr/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Of course if I was to do anything serious with twitter in Perl, I&#8217;d use the module !</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave Sherohman</title>
		<link>http://www.sakana.fr/blog/2010/01/24/perltwitter-getting-mentions-from-command-line/comment-page-1/#comment-8314</link>
		<dc:creator>Dave Sherohman</dc:creator>
		<pubDate>Sun, 24 Jan 2010 15:51:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.sakana.fr/blog/?p=397#comment-8314</guid>
		<description>You could also dispense with curl entirely by using Net::Twitter (http://search.cpan.org/perldoc?Net::Twitter) to handle interaction with the Twitter API.  Going that route would also handle the JSON decoding automatically for you.

Something along the lines of this should do it (code untested, but very similar to code I&#039;ve used previously):

#! /usr/bin/perl
 
use strict;
use warnings;
 
use Net::Twitter;

my $twit = Net::Twitter-&gt;new( { username =&gt; &#039;MyUserName&#039;, password =&gt; &#039;MyPassword&#039; } );
 
my $mentions = $twit-&gt;mentions;
 
foreach my $mention (@$mentions) {
	my $screen_name = encode(&quot;UTF-8&quot;, $mention-&gt;{user}-&gt;{screen_name});
	my $text = encode(&quot;UTF-8&quot;, $mention-&gt;{text});
	format =
@&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;    ^&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;
$screen_name,      $text
                   ^&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;mentions to continue running indefinitely while periodically checking for new mentions.</description>
		<content:encoded><![CDATA[<p>You could also dispense with curl entirely by using Net::Twitter (<a href="http://search.cpan.org/perldoc?Net::Twitter" rel="nofollow">http://search.cpan.org/perldoc?Net::Twitter</a>) to handle interaction with the Twitter API.  Going that route would also handle the JSON decoding automatically for you.</p>
<p>Something along the lines of this should do it (code untested, but very similar to code I&#8217;ve used previously):</p>
<p>#! /usr/bin/perl</p>
<p>use strict;<br />
use warnings;</p>
<p>use Net::Twitter;</p>
<p>my $twit = Net::Twitter-&gt;new( { username =&gt; &#8216;MyUserName&#8217;, password =&gt; &#8216;MyPassword&#8217; } );</p>
<p>my $mentions = $twit-&gt;mentions;</p>
<p>foreach my $mention (@$mentions) {<br />
	my $screen_name = encode(&#8220;UTF-8&#8243;, $mention-&gt;{user}-&gt;{screen_name});<br />
	my $text = encode(&#8220;UTF-8&#8243;, $mention-&gt;{text});<br />
	format =<br />
@&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;    ^&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;<br />
$screen_name,      $text<br />
                   ^&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;mentions to continue running indefinitely while periodically checking for new mentions.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

