<?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: How To: Growl and Twitter</title>
	<atom:link href="http://www.echo-technology.co.uk/2008/11/11/how-to-growl-and-twitter/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.echo-technology.co.uk/2008/11/11/how-to-growl-and-twitter/</link>
	<description>technology blogging for the moribund</description>
	<lastBuildDate>Thu, 18 Mar 2010 01:03:28 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Matt</title>
		<link>http://www.echo-technology.co.uk/2008/11/11/how-to-growl-and-twitter/comment-page-1/#comment-3180</link>
		<dc:creator>Matt</dc:creator>
		<pubDate>Thu, 18 Mar 2010 01:03:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.echo-technology.co.uk/?p=28#comment-3180</guid>
		<description>How many Deps are there for Net::Twitter... dang!</description>
		<content:encoded><![CDATA[<p>How many Deps are there for Net::Twitter&#8230; dang!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Copprhead</title>
		<link>http://www.echo-technology.co.uk/2008/11/11/how-to-growl-and-twitter/comment-page-1/#comment-3080</link>
		<dc:creator>Copprhead</dc:creator>
		<pubDate>Mon, 12 Oct 2009 11:26:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.echo-technology.co.uk/?p=28#comment-3080</guid>
		<description>If you get the &quot;-T is on the #! line...&quot;, either run it with &quot;perl -T ./growl_tweet.pl&quot; or make it executable with &quot;chmod +x growl_tweet.pl&quot; and then run it directly via &quot;./growl_tweet.pl&quot;.</description>
		<content:encoded><![CDATA[<p>If you get the &#8220;-T is on the #! line&#8230;&#8221;, either run it with &#8220;perl -T ./growl_tweet.pl&#8221; or make it executable with &#8220;chmod +x growl_tweet.pl&#8221; and then run it directly via &#8220;./growl_tweet.pl&#8221;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Altimor</title>
		<link>http://www.echo-technology.co.uk/2008/11/11/how-to-growl-and-twitter/comment-page-1/#comment-3079</link>
		<dc:creator>Altimor</dc:creator>
		<pubDate>Tue, 29 Sep 2009 17:13:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.echo-technology.co.uk/?p=28#comment-3079</guid>
		<description>I had the same error than Jeremy Sample...
I have the Apple Developper Tools, and installed all the scripts properly, but the last one just doesn&#039;t work.</description>
		<content:encoded><![CDATA[<p>I had the same error than Jeremy Sample&#8230;<br />
I have the Apple Developper Tools, and installed all the scripts properly, but the last one just doesn&#8217;t work.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeremy Sample</title>
		<link>http://www.echo-technology.co.uk/2008/11/11/how-to-growl-and-twitter/comment-page-1/#comment-3078</link>
		<dc:creator>Jeremy Sample</dc:creator>
		<pubDate>Thu, 24 Sep 2009 15:18:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.echo-technology.co.uk/?p=28#comment-3078</guid>
		<description>I was able to install the modules fine but when I try to run perl ./growl_tweet.pl I get the following error: 

&quot;-T&quot; is on the #! line, it must also be used on the command line at ./growl_tweet.pl line 1.</description>
		<content:encoded><![CDATA[<p>I was able to install the modules fine but when I try to run perl ./growl_tweet.pl I get the following error: </p>
<p>&#8220;-T&#8221; is on the #! line, it must also be used on the command line at ./growl_tweet.pl line 1.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SlaunchaMan</title>
		<link>http://www.echo-technology.co.uk/2008/11/11/how-to-growl-and-twitter/comment-page-1/#comment-2969</link>
		<dc:creator>SlaunchaMan</dc:creator>
		<pubDate>Wed, 28 Jan 2009 21:24:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.echo-technology.co.uk/?p=28#comment-2969</guid>
		<description>Looks like my XML got messed up.  Here&#039;s the plist again:

&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;!DOCTYPE plist PUBLIC &quot;-//Apple//DTD PLIST 1.0//EN&quot; &quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&quot;&gt;
&lt;plist version=&quot;1.0&quot;&gt;
&lt;dict&gt;
    &lt;key&gt;Label&lt;/key&gt;
    &lt;string&gt;uk.echo-technology.twitter+growl&lt;/string&gt;
    &lt;key&gt;OnDemand&lt;/key&gt;
    &lt;false/&gt;
    &lt;key&gt;KeepAlive&lt;/key&gt;
    &lt;true/&gt;
    &lt;key&gt;Program&lt;/key&gt;
    &lt;string&gt;/path/to/twitter+growl.pl&lt;/string&gt;
&lt;/dict&gt;
&lt;/plist&gt;</description>
		<content:encoded><![CDATA[<p>Looks like my XML got messed up.  Here&#8217;s the plist again:</p>
<p>&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;UTF-8&#8243;?&gt;<br />
&lt;!DOCTYPE plist PUBLIC &#8220;-//Apple//DTD PLIST 1.0//EN&#8221; &#8220;http://www.apple.com/DTDs/PropertyList-1.0.dtd&#8221;&gt;<br />
&lt;plist version=&#8221;1.0&#8243;&gt;<br />
&lt;dict&gt;<br />
    &lt;key&gt;Label&lt;/key&gt;<br />
    &lt;string&gt;uk.echo-technology.twitter+growl&lt;/string&gt;<br />
    &lt;key&gt;OnDemand&lt;/key&gt;<br />
    &lt;false/&gt;<br />
    &lt;key&gt;KeepAlive&lt;/key&gt;<br />
    &lt;true/&gt;<br />
    &lt;key&gt;Program&lt;/key&gt;<br />
    &lt;string&gt;/path/to/twitter+growl.pl&lt;/string&gt;<br />
&lt;/dict&gt;<br />
&lt;/plist&gt;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SlaunchaMan</title>
		<link>http://www.echo-technology.co.uk/2008/11/11/how-to-growl-and-twitter/comment-page-1/#comment-2968</link>
		<dc:creator>SlaunchaMan</dc:creator>
		<pubDate>Wed, 28 Jan 2009 21:23:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.echo-technology.co.uk/?p=28#comment-2968</guid>
		<description>Awesome!  I made a LaunchAgent to make this run in the background while I&#039;m logged in.  Save this as ~/Library/LaunchAgents/uk.echo-technology.twitter+growl.plist :





    Label
    uk.echo-technology.twitter+growl
    OnDemand
    
    KeepAlive
    
    Program
    /path/to/twitter+growl.pl



Be sure to change the path to reflect what it is on your system.  Enjoy!</description>
		<content:encoded><![CDATA[<p>Awesome!  I made a LaunchAgent to make this run in the background while I&#8217;m logged in.  Save this as ~/Library/LaunchAgents/uk.echo-technology.twitter+growl.plist :</p>
<p>    Label<br />
    uk.echo-technology.twitter+growl<br />
    OnDemand</p>
<p>    KeepAlive</p>
<p>    Program<br />
    /path/to/twitter+growl.pl</p>
<p>Be sure to change the path to reflect what it is on your system.  Enjoy!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bhima</title>
		<link>http://www.echo-technology.co.uk/2008/11/11/how-to-growl-and-twitter/comment-page-1/#comment-2964</link>
		<dc:creator>Bhima</dc:creator>
		<pubDate>Sun, 11 Jan 2009 11:42:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.echo-technology.co.uk/?p=28#comment-2964</guid>
		<description>Hi Richard,  I think this script is a great idea but I think so far, (perhaps ultimately?) it is a suboptimal solution.  My thinking is along these lines: 

1: As I recall, Perl comes with XCode.  So, if you don&#039;t already have Perl &amp; CPAN installed you are in for a long download just to get this little script working. I admit that I never cease to marvel at the ease of using CPAN and installing modules but not everyone has both Perl and CPAN installed on their Mac.  Maybe Perl comes with Leopard these days?  If that&#039;s true I suppose it&#039;s a little easier... but it isn&#039;t the magical easy of a user that already has CPAN up and running.  Applescript is already on all Macs, and the growl support for applescript is installed with growl.

2: Sticking the username and password in the code as constants is also suboptimal. Applescript allows for an elegant keychain scripting solution and there is a Perl module for keychain scripting (LWP::UserAgent::Keychain).  However I was unable to successfully install it.  I had thought of just using Applescript instead of Perl.  However there is no twitter scripting addition for Applescript to replace Net::Twitter in Perl... so the script would probably require an amount of manual XML parsing which I have no tolerance of (yet).  Alternately maybe it would be possible to port Net::Twitter to an OSAX but I have no idea how and it is &quot;outside of the scope&quot; of the O&#039;Reilly Applescript book I have.  (At this point I find this pretty intriguing and I am pursuing this further but have nothing to show for it)

3: You need to have terminal open to have it work (I have tinkered with versions of this script running from Geektool and have met with various levels of success).

4: While I have successfully fetched the URI for the avatar of the tweet originator, I can not entice Mac::Growl to use it.  I have tried a variety of utf8 encoding and escaping / un-escaping to no real avail.  I asked Pudge about this but he has not responded. Because I have not worked out the XML parsing in Applescript, I have not bothered to discover if growl icon method works with URIs in Applescript.  The only idea I have for this is to create a local cache of avatars and point growl to the local copy.  However I have not yet tried to implement this.

So, I look forward to your updated script and I hope you&#039;ve found elegant solutions to some of the problems that I have been unable to overcome :)

To answer some unanswered questions here:

For the people encountering errors which cause the script to exit: As it is this script assumes everything always works and twitter is always available, and everything arrives in the correct encoding (none of which is really true).  I think the most common error management design pattern in Perl is to wrap the potentially offending code block in an &quot;if then warn&quot; structure.   I&#039;ve used eval / warn like this: 

eval {@tt = $tweet-&gt;friends_timeline( {count =&gt; 200, since_id =&gt; $last_id})}; 
warn $@ if $@;

Mac:: Growl requires input be encoded with utf8. (this is the source of the “Cannot decode string with wide characters&quot; errors)  Which I solved by using the perl module Encode as described on the Mac::Growl page at CPAN.  I also tried using utf8 which is also described there but it did not work.

For the guy asking how to save a file in Terminal:  Don&#039;t bother with terminal, use XCode, the Script Editor, or even Text Edit.  Just open a new file, paste the posted code in it, change the quotes, and save with a .pl extension.  Or you can download the linked pl.txt file and remove the txt extension (this is what I did but I still wound up having to fix the quotes)</description>
		<content:encoded><![CDATA[<p>Hi Richard,  I think this script is a great idea but I think so far, (perhaps ultimately?) it is a suboptimal solution.  My thinking is along these lines: </p>
<p>1: As I recall, Perl comes with XCode.  So, if you don&#8217;t already have Perl &amp; CPAN installed you are in for a long download just to get this little script working. I admit that I never cease to marvel at the ease of using CPAN and installing modules but not everyone has both Perl and CPAN installed on their Mac.  Maybe Perl comes with Leopard these days?  If that&#8217;s true I suppose it&#8217;s a little easier&#8230; but it isn&#8217;t the magical easy of a user that already has CPAN up and running.  Applescript is already on all Macs, and the growl support for applescript is installed with growl.</p>
<p>2: Sticking the username and password in the code as constants is also suboptimal. Applescript allows for an elegant keychain scripting solution and there is a Perl module for keychain scripting (LWP::UserAgent::Keychain).  However I was unable to successfully install it.  I had thought of just using Applescript instead of Perl.  However there is no twitter scripting addition for Applescript to replace Net::Twitter in Perl&#8230; so the script would probably require an amount of manual XML parsing which I have no tolerance of (yet).  Alternately maybe it would be possible to port Net::Twitter to an OSAX but I have no idea how and it is &#8220;outside of the scope&#8221; of the O&#8217;Reilly Applescript book I have.  (At this point I find this pretty intriguing and I am pursuing this further but have nothing to show for it)</p>
<p>3: You need to have terminal open to have it work (I have tinkered with versions of this script running from Geektool and have met with various levels of success).</p>
<p>4: While I have successfully fetched the URI for the avatar of the tweet originator, I can not entice Mac::Growl to use it.  I have tried a variety of utf8 encoding and escaping / un-escaping to no real avail.  I asked Pudge about this but he has not responded. Because I have not worked out the XML parsing in Applescript, I have not bothered to discover if growl icon method works with URIs in Applescript.  The only idea I have for this is to create a local cache of avatars and point growl to the local copy.  However I have not yet tried to implement this.</p>
<p>So, I look forward to your updated script and I hope you&#8217;ve found elegant solutions to some of the problems that I have been unable to overcome <img src='http://www.echo-technology.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>To answer some unanswered questions here:</p>
<p>For the people encountering errors which cause the script to exit: As it is this script assumes everything always works and twitter is always available, and everything arrives in the correct encoding (none of which is really true).  I think the most common error management design pattern in Perl is to wrap the potentially offending code block in an &#8220;if then warn&#8221; structure.   I&#8217;ve used eval / warn like this: </p>
<p>eval {@tt = $tweet-&gt;friends_timeline( {count =&gt; 200, since_id =&gt; $last_id})};<br />
warn $@ if $@;</p>
<p>Mac:: Growl requires input be encoded with utf8. (this is the source of the “Cannot decode string with wide characters&#8221; errors)  Which I solved by using the perl module Encode as described on the Mac::Growl page at CPAN.  I also tried using utf8 which is also described there but it did not work.</p>
<p>For the guy asking how to save a file in Terminal:  Don&#8217;t bother with terminal, use XCode, the Script Editor, or even Text Edit.  Just open a new file, paste the posted code in it, change the quotes, and save with a .pl extension.  Or you can download the linked pl.txt file and remove the txt extension (this is what I did but I still wound up having to fix the quotes)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Richard Stelling</title>
		<link>http://www.echo-technology.co.uk/2008/11/11/how-to-growl-and-twitter/comment-page-1/#comment-2963</link>
		<dc:creator>Richard Stelling</dc:creator>
		<pubDate>Fri, 09 Jan 2009 17:20:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.echo-technology.co.uk/?p=28#comment-2963</guid>
		<description>Mads, yes - I have a version that has loads more features in the final days of beta testing.</description>
		<content:encoded><![CDATA[<p>Mads, yes &#8211; I have a version that has loads more features in the final days of beta testing.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Moriarty</title>
		<link>http://www.echo-technology.co.uk/2008/11/11/how-to-growl-and-twitter/comment-page-1/#comment-2961</link>
		<dc:creator>Moriarty</dc:creator>
		<pubDate>Tue, 06 Jan 2009 12:48:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.echo-technology.co.uk/?p=28#comment-2961</guid>
		<description>Hey,

This indeed is incredibly useful. I tried to work with the ruby scripts out there, but none of them worked.

Since I couldn&#039;t install Mac::Growl, I change this script to use growlnotify:
Erase the RegisterNotifications and replace PostNotification with:

      my $message = &quot;$t-&gt;{text}&quot;;
      my $cmd = &quot;/usr/local/bin/growlnotify -n Twitter -m \&quot;$message\&quot; -t \&quot;$t-&gt;{user}{screen_name}\&quot;&quot;;
      system $cmd; 


However, I have this problem. After several hours of running I get:

malformed JSON string, neither array, object, number, string or atom, at character offset 0 [&quot;&lt;!DOCTYPE html PUBLI...&quot;] at /opt/local/lib/perl5/site_perl/5.8.8/JSON/Any.pm line 483

And the script quits. Any workarounds for it?

Cheers,
M.</description>
		<content:encoded><![CDATA[<p>Hey,</p>
<p>This indeed is incredibly useful. I tried to work with the ruby scripts out there, but none of them worked.</p>
<p>Since I couldn&#8217;t install Mac::Growl, I change this script to use growlnotify:<br />
Erase the RegisterNotifications and replace PostNotification with:</p>
<p>      my $message = &#8220;$t-&gt;{text}&#8221;;<br />
      my $cmd = &#8220;/usr/local/bin/growlnotify -n Twitter -m \&#8221;$message\&#8221; -t \&#8221;$t-&gt;{user}{screen_name}\&#8221;";<br />
      system $cmd; </p>
<p>However, I have this problem. After several hours of running I get:</p>
<p>malformed JSON string, neither array, object, number, string or atom, at character offset 0 ["&lt;!DOCTYPE html PUBLI..."] at /opt/local/lib/perl5/site_perl/5.8.8/JSON/Any.pm line 483</p>
<p>And the script quits. Any workarounds for it?</p>
<p>Cheers,<br />
M.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mads Hartmann</title>
		<link>http://www.echo-technology.co.uk/2008/11/11/how-to-growl-and-twitter/comment-page-1/#comment-2960</link>
		<dc:creator>Mads Hartmann</dc:creator>
		<pubDate>Tue, 06 Jan 2009 11:27:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.echo-technology.co.uk/?p=28#comment-2960</guid>
		<description>Uh, one question:

Does Terminal have to be open for the script to notify Growl? 

Mads</description>
		<content:encoded><![CDATA[<p>Uh, one question:</p>
<p>Does Terminal have to be open for the script to notify Growl? </p>
<p>Mads</p>
]]></content:encoded>
	</item>
</channel>
</rss>
