<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;CEcMSX45eCp7ImA9WxNUFko.&quot;"><id>tag:blogger.com,1999:blog-5699142825044889235</id><updated>2009-11-08T10:21:28.020+01:00</updated><title>Damien Learns Perl</title><subtitle type="html">There is more than one way to break the camel's back</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://damienlearnsperl.blogspot.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://damienlearnsperl.blogspot.com/" /><link rel="hub" href="http://pubsubhubbub.appspot.com/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/5699142825044889235/posts/default?start-index=26&amp;max-results=25&amp;redirect=false&amp;v=2" /><author><name>Damien</name><uri>http://www.blogger.com/profile/07183471087108492840</uri><email>damienlearnsperl@gmx.com</email></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>50</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><link rel="self" href="http://feeds.feedburner.com/DamienLearnsPerl" type="application/atom+xml" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><entry gd:etag="W/&quot;DUEGSH06cCp7ImA9WxNRGUg.&quot;"><id>tag:blogger.com,1999:blog-5699142825044889235.post-7130115404041946390</id><published>2009-09-14T21:33:00.002+02:00</published><updated>2009-09-14T21:47:09.318+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-09-14T21:47:09.318+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Perl" /><category scheme="http://www.blogger.com/atom/ns#" term="Windows" /><category scheme="http://www.blogger.com/atom/ns#" term="Padre" /><title>Installing Padre on Windows Vista</title><content type="html">Last week, I (re-)installed &lt;a href="http://padre.perlide.org/"&gt;Padre &lt;/a&gt;on my Windows Vista machine. &lt;a href="http://padre.perlide.org/"&gt;Padre&lt;/a&gt; is a development environment geared towards Perl programmers, with a focus on Perl beginners.&lt;br /&gt;I use the &lt;a href="http://strawberryperl.com/"&gt;Strawberry Perl&lt;/a&gt; distribution (5.10.0.6) and read that it was a breeze to install Padre.&lt;br /&gt;Well, it almost is.&lt;br /&gt;I opened the cpan shell (typing &lt;span style="font-family:courier new;"&gt;cpan&lt;/span&gt; in a DOS shell is all it takes if C:\strawberry\perl\bin is in your PATH).&lt;br /&gt;The regular install (&lt;span style="font-family:courier new;"&gt;install Padre&lt;/span&gt;) failed because of a dependency on Wx::Perl::ProcessStream not building. Just force install that module (&lt;span style="font-family:courier new;"&gt;force install Wx::Perl::ProcessStream&lt;/span&gt;) then install Padre (a ticket has already been written for the issue).&lt;br /&gt;It works like a charm, no need to force install Padre anymore!&lt;br /&gt;So if you are a Perl beginner and want to use an editor written in Perl + suited for Perl tasks, you have no excuse anymore.&lt;br /&gt;&lt;br /&gt;If you already have Padre and want to update it to &lt;a href="http://blog.ryan52.info/?p=3"&gt;version 0.46&lt;/a&gt; released today (September 14th 2009), type &lt;span style="font-family:courier new;"&gt;upgrade Padre&lt;/span&gt; in your cpan shell. Better yet, you can update directly from the Padre Plugins menu: Plugins&gt;Module Tools&gt;Install CPAN Module and type Padre.&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5699142825044889235-7130115404041946390?l=damienlearnsperl.blogspot.com'/&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/OZr1JmH8D5qZGZN015gPMxNaT3c/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/OZr1JmH8D5qZGZN015gPMxNaT3c/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/OZr1JmH8D5qZGZN015gPMxNaT3c/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/OZr1JmH8D5qZGZN015gPMxNaT3c/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=CmIjmfBCAkk:MW1m9VNpqss:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?i=CmIjmfBCAkk:MW1m9VNpqss:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=CmIjmfBCAkk:MW1m9VNpqss:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?i=CmIjmfBCAkk:MW1m9VNpqss:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=CmIjmfBCAkk:MW1m9VNpqss:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=CmIjmfBCAkk:MW1m9VNpqss:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DamienLearnsPerl/~4/CmIjmfBCAkk" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://damienlearnsperl.blogspot.com/feeds/7130115404041946390/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://damienlearnsperl.blogspot.com/2009/09/installing-padre-on-windows-vista.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5699142825044889235/posts/default/7130115404041946390?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5699142825044889235/posts/default/7130115404041946390?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/DamienLearnsPerl/~3/CmIjmfBCAkk/installing-padre-on-windows-vista.html" title="Installing Padre on Windows Vista" /><author><name>Damien</name><uri>http://www.blogger.com/profile/07183471087108492840</uri><email>damienlearnsperl@gmx.com</email><gd:extendedProperty name="OpenSocialUserId" value="13321007406475916362" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://damienlearnsperl.blogspot.com/2009/09/installing-padre-on-windows-vista.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEMBRHs-eip7ImA9WxNREU4.&quot;"><id>tag:blogger.com,1999:blog-5699142825044889235.post-7437389679891894260</id><published>2009-09-05T09:26:00.005+02:00</published><updated>2009-09-05T09:40:55.552+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-09-05T09:40:55.552+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="brian d foy" /><category scheme="http://www.blogger.com/atom/ns#" term="Perl documentation" /><title>Learning Perl for cheap!</title><content type="html">Brian d foy announced on his blog &lt;a href="http://use.perl.org/articles/09/08/24/2012226.shtml"&gt;a price drop on O'Reilly Perl books&lt;/a&gt;, including his own &lt;a href="http://oreilly.com/catalog/9780596520106/"&gt;"Learning Perl" book&lt;/a&gt; that he co-wrote with Randal Schwartz and Tom Phoenix.&lt;br /&gt;With the discount code found in the comment section, the grand total is... $6.49 for a must have in every programmer's library!&lt;br /&gt;Credits to RAT for &lt;a href="http://yesistilluseperl.blogspot.com/2009/09/cheap-books.html"&gt;announcing the news&lt;/a&gt; first.&lt;br&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5699142825044889235-7437389679891894260?l=damienlearnsperl.blogspot.com'/&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/rK10eD1J-nK0WK6NHofLST02DOc/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/rK10eD1J-nK0WK6NHofLST02DOc/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/rK10eD1J-nK0WK6NHofLST02DOc/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/rK10eD1J-nK0WK6NHofLST02DOc/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=gWwRA9yvMZM:y1oxiLytq_A:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?i=gWwRA9yvMZM:y1oxiLytq_A:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=gWwRA9yvMZM:y1oxiLytq_A:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?i=gWwRA9yvMZM:y1oxiLytq_A:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=gWwRA9yvMZM:y1oxiLytq_A:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=gWwRA9yvMZM:y1oxiLytq_A:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DamienLearnsPerl/~4/gWwRA9yvMZM" height="1" width="1"/&gt;</content><link rel="related" href="http://use.perl.org/articles/09/08/24/2012226.shtml" title="Learning Perl for cheap!" /><link rel="replies" type="application/atom+xml" href="http://damienlearnsperl.blogspot.com/feeds/7437389679891894260/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://damienlearnsperl.blogspot.com/2009/09/learning-perl-for-cheap.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5699142825044889235/posts/default/7437389679891894260?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5699142825044889235/posts/default/7437389679891894260?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/DamienLearnsPerl/~3/gWwRA9yvMZM/learning-perl-for-cheap.html" title="Learning Perl for cheap!" /><author><name>Damien</name><uri>http://www.blogger.com/profile/07183471087108492840</uri><email>damienlearnsperl@gmx.com</email><gd:extendedProperty name="OpenSocialUserId" value="13321007406475916362" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://damienlearnsperl.blogspot.com/2009/09/learning-perl-for-cheap.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkAGRXg8fyp7ImA9WxJUFk0.&quot;"><id>tag:blogger.com,1999:blog-5699142825044889235.post-4162311571780559533</id><published>2009-07-14T21:36:00.000+02:00</published><updated>2009-07-14T21:45:24.677+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-07-14T21:45:24.677+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Magic" /><category scheme="http://www.blogger.com/atom/ns#" term="Perl" /><category scheme="http://www.blogger.com/atom/ns#" term="CPAN" /><category scheme="http://www.blogger.com/atom/ns#" term="MMORPG" /><title>Perl modules of online MMORPG</title><content type="html">&lt;span style="font-weight: bold;"&gt;What happened to MTG_Studio?&lt;br /&gt;&lt;/span&gt;&lt;span&gt;I &lt;/span&gt;&lt;span&gt;was distraught&lt;/span&gt;&lt;span style="font-weight: bold;"&gt; &lt;/span&gt;&lt;span&gt;to see that my favorite tool&lt;/span&gt;&lt;span style="font-weight: bold;"&gt; &lt;/span&gt;to manage a Magic: The Gathering&lt;span style="font-weight: bold;"&gt; &lt;/span&gt;card collection has been suspended (probably by Wizard of the Coast). Hopefully it is sadly temporary (that's what &lt;a href="http://en.wikipedia.org/wiki/Beaker_%28Muppet%29"&gt;Beaker&lt;/a&gt; keeps telling me anyway) but I will not bet much on that. If anyone has news, please let me know.&lt;br /&gt;&lt;br /&gt;That event prompted me to wonder if there was any module on CPAN dealing with MTG.&lt;br /&gt;I was surprised not to find any, so I may just have to do something about that.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;MMORPG love from Perl?&lt;/span&gt;&lt;br /&gt;On the other hand, I found a few modules related to massively multi player role playing games.&lt;ul style="font-style: italic;"&gt;&lt;li&gt;World Of Warcraft&lt;/li&gt;&lt;/ul&gt;- &lt;a href="http://search.cpan.org/%7Efranckc/Games-WoW-Armory-0.0.7/lib/Games/WoW/Armory.pm"&gt;Games::WoW::Armory&lt;/a&gt; - Access to the WoW Armory&lt;br /&gt;- &lt;a href="http://search.cpan.org/%7Efranckc/Bot-BasicBot-Pluggable-Module-WoWPVP-0.02/lib/Bot/BasicBot/Pluggable/Module/WoWPVP.pm"&gt;Bot::BasicBot::Pluggable::Module::WoWPVP&lt;/a&gt; - Fetch information about pvp grades for World Of Warcraft&lt;br /&gt;- &lt;a href="http://search.cpan.org/%7Esock/WWW-Wow-RealmStatus-0.5/lib/WWW/Wow/RealmStatus.pm"&gt;WWW::Wow::RealmStatus&lt;/a&gt; - The great new WWW::Wow::RealmStatus!&lt;br /&gt;- &lt;a href="http://search.cpan.org/%7Esscotto/WoW-Wiki-0.01/lib/WoW/Wiki.pm"&gt;WoW::Wiki&lt;/a&gt; - Perl extension to parse WoW wikki markup&lt;ul style="font-style: italic;"&gt;&lt;li&gt;Lord of the Rings Online&lt;/li&gt;&lt;/ul&gt;- There is no Perl module yet but &lt;a href="http://my.lotro.com/bracket/datalotrocom-usage-guide/"&gt;a LOTRO Web API exists&lt;/a&gt;!&lt;br /&gt;&lt;ul style="font-style: italic;"&gt;&lt;li&gt;EverQuest&lt;/li&gt;&lt;/ul&gt;- &lt;a href="http://search.cpan.org/%7Epjf/Games-EverQuest-LogLineParser-0.09/lib/Games/EverQuest/LogLineParser.pm"&gt;Games::EverQuest::LogLineParser&lt;/a&gt; - Perl extension for parsing lines from the EverQuest log file.&lt;br /&gt;- &lt;a href="http://search.cpan.org/search?query=everquest&amp;amp;mode=all"&gt;Other Perl scripts&lt;/a&gt; exist to complement the LogLineParser module&lt;br /&gt;&lt;ul style="font-style: italic;"&gt;&lt;li&gt;Eve Online&lt;/li&gt;&lt;/ul&gt;- &lt;a href="http://search.cpan.org/%7Ebluefeet/Games-EveOnline-API-0.02/lib/Games/EveOnline/API.pm"&gt;Games::EveOnline::API&lt;/a&gt; - A simple Perl wrapper around the EveOnline XML API.&lt;br /&gt;- &lt;a href="http://search.cpan.org/%7Echrisc/WebService-EveOnline-0.62/lib/WebService/EveOnline.pm"&gt;WebService::EveOnline&lt;/a&gt; -- a wrapper intended to (eventually) provide a useful interface to the MMORPG game, "Eve Online"&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;Neverwinter Nights&lt;/span&gt; (not really an MMORPG)&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;- &lt;a href="http://search.cpan.org/%7Esscotto/Games-NeverwinterNights-Query-1.0/Query.pm"&gt;Games::NeverwinterNights::Query&lt;/a&gt; - Query Perl class to query a Neverwint Nights Server&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;F.E.A.R.&lt;/span&gt; (not really an MMORPG)&lt;/li&gt;&lt;/ul&gt;- &lt;a href="http://search.cpan.org/%7Eevank/Games-FEAR-Log-0.02/lib/Games/FEAR/Log.pm"&gt;Games::FEAR::Log&lt;/a&gt; - Log analysis tool for F.E.A.R. dedicated servers&lt;br /&gt;&lt;br /&gt;Does anyone out there have written or used an online PC game-related module?&lt;br&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5699142825044889235-4162311571780559533?l=damienlearnsperl.blogspot.com'/&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/8Ah0-LWuEwBz62B1GKyJ0vWcXEY/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/8Ah0-LWuEwBz62B1GKyJ0vWcXEY/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/8Ah0-LWuEwBz62B1GKyJ0vWcXEY/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/8Ah0-LWuEwBz62B1GKyJ0vWcXEY/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=H_EpLvzSxo4:I8lX7UKNPWc:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?i=H_EpLvzSxo4:I8lX7UKNPWc:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=H_EpLvzSxo4:I8lX7UKNPWc:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?i=H_EpLvzSxo4:I8lX7UKNPWc:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=H_EpLvzSxo4:I8lX7UKNPWc:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=H_EpLvzSxo4:I8lX7UKNPWc:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DamienLearnsPerl/~4/H_EpLvzSxo4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://damienlearnsperl.blogspot.com/feeds/4162311571780559533/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://damienlearnsperl.blogspot.com/2009/07/perl-modules-of-online-mmorpg.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5699142825044889235/posts/default/4162311571780559533?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5699142825044889235/posts/default/4162311571780559533?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/DamienLearnsPerl/~3/H_EpLvzSxo4/perl-modules-of-online-mmorpg.html" title="Perl modules of online MMORPG" /><author><name>Damien</name><uri>http://www.blogger.com/profile/07183471087108492840</uri><email>damienlearnsperl@gmx.com</email><gd:extendedProperty name="OpenSocialUserId" value="13321007406475916362" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total><feedburner:origLink>http://damienlearnsperl.blogspot.com/2009/07/perl-modules-of-online-mmorpg.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkEMRXw6fCp7ImA9WxJXFks.&quot;"><id>tag:blogger.com,1999:blog-5699142825044889235.post-8288823859099323160</id><published>2009-06-10T23:15:00.001+02:00</published><updated>2009-06-10T23:18:04.214+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-06-10T23:18:04.214+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Perl" /><category scheme="http://www.blogger.com/atom/ns#" term="Twitter" /><category scheme="http://www.blogger.com/atom/ns#" term="wxPerl" /><title>Adding a menu bar to the twitter GUI: part 5</title><content type="html">&lt;span style="font-weight: bold;"&gt;Updating to the new Net::Twitter::Lite API&lt;/span&gt;&lt;br /&gt;Marc Mims updated the API of his twitter's interface module for Perl.&lt;br /&gt;There are two versions:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://search.cpan.org/~mmims/Net-Twitter-3.01000/lib/Net/Twitter.pod"&gt;Net::Twitter v3.01&lt;/a&gt; - Major update, object oriented, based on Moose.&lt;/li&gt;&lt;li&gt;&lt;a href="http://search.cpan.org/%7Emmims/Net-Twitter-Lite-0.02000/lib/Net/Twitter/Lite.pm"&gt;Net::twitter::Lite v0.02&lt;/a&gt; - Not so complete but requiring less dependencies.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt; In order to use the Lite version (largely sufficient for my modest needs), only trivial changes are needed in the twit_GUI.pl script:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;replace &lt;span style="font-family:courier new;"&gt;use Net::Twitter&lt;/span&gt; by &lt;span style="font-family:courier new;"&gt;use Net::Twitter::Lite&lt;/span&gt; (duh!)&lt;/li&gt;&lt;li&gt;replace calls to &lt;span style="font-family:courier new;"&gt;Net::Twitter-&gt;new()&lt;/span&gt; by calls to &lt;span style="font-family:courier new;"&gt;Net::Twitter::Lite-&gt;new()&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;This ensures that I am now using a module that is actively supported.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Adding a menu bar&lt;/span&gt;&lt;br /&gt;A menu bar can only be added to a Frame. According to the wxPerl docs,&lt;br /&gt;&lt;span style="font-family:Arial,Lucida,Helvetica;"&gt;&lt;/span&gt;&lt;blockquote&gt;&lt;span style="font-family:Arial,Lucida,Helvetica;"&gt;A frame is a window whose size and position can (usually) be changed by the user. It usually has thick borders and a title bar, and can optionally contain a menu bar, toolbar and status bar. A frame can contain any window that is not a frame or dialog.&lt;/span&gt;&lt;/blockquote&gt;So, let's replace the Dialog occurences with Frame in the script.&lt;br /&gt;The MyApp modules becomes:&lt;br /&gt;&lt;pre name="code" class="perl:firstline[30]"&gt;##############################################################################&lt;br /&gt;#&lt;br /&gt;package MyApp;&lt;br /&gt;#&lt;br /&gt;##############################################################################&lt;br /&gt;use vars qw(@ISA);&lt;br /&gt;@ISA=qw(Wx::App);   # this tells Perl to look for unknown methods in the Wx::App module&lt;br /&gt;&lt;br /&gt;use Wx qw(wxDefaultSize wxDefaultPosition);&lt;br /&gt;&lt;br /&gt;sub OnInit {&lt;br /&gt;    my($this) = @_;&lt;br /&gt;    my $frame = MyFrame-&gt;new('Twit', wxDefaultPosition);&lt;br /&gt;    # set it as top window (so the app will automatically close when &lt;br /&gt;    # the last top window is closed)&lt;br /&gt;    $this-&gt;SetTopWindow($frame);&lt;br /&gt;    $frame-&gt;Show(1);&lt;br /&gt;    1;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;package MyDialog becomes package MyFrame:&lt;br /&gt;&lt;pre name="code" class="perl:firstline[48]"&gt;##############################################################################&lt;br /&gt;#&lt;br /&gt;package MyFrame;&lt;br /&gt;#&lt;br /&gt;##############################################################################&lt;br /&gt;use vars qw(@ISA);&lt;br /&gt;&lt;br /&gt;@ISA=qw(Wx::Frame);&lt;br /&gt;&lt;br /&gt;use Wx::Event qw(EVT_BUTTON EVT_CLOSE EVT_TEXT EVT_TEXT_MAXLEN);&lt;br /&gt;use Wx qw(:sizer&lt;br /&gt;          :statictext&lt;br /&gt;          wxDefaultPosition&lt;br /&gt;          wxDefaultSize&lt;br /&gt;          wxDefaultValidator&lt;br /&gt;          wxDEFAULT_DIALOG_STYLE&lt;br /&gt;          wxID_OK&lt;br /&gt;          wxOK&lt;br /&gt;          wxRESIZE_BORDER&lt;br /&gt;          wxTE_MULTILINE&lt;br /&gt;          );&lt;br /&gt;&lt;br /&gt;use constant MAX_POST_LENGTH =&gt; 140;&lt;br /&gt;&lt;br /&gt;sub new {&lt;br /&gt;    my $class = shift;&lt;br /&gt;    my $password_file;&lt;br /&gt;&lt;br /&gt;    # Main window&lt;br /&gt;    my $form_width  = 480;&lt;br /&gt;    my $form_height = 195;&lt;br /&gt;    # Array of line numbers used on the dialog window&lt;br /&gt;    my @ylines = (0, 10, 20, 40, 80, 100);&lt;br /&gt;&lt;br /&gt;    my $this = $class-&gt;SUPER::new(&lt;br /&gt;                            undef,  # parent&lt;br /&gt;                            -1,     # id&lt;br /&gt;                            $_[0],  # title&lt;br /&gt;                            $_[1],  # position [x, y]&lt;br /&gt;                           [$form_width, $form_height] # size [width, height]&lt;br /&gt;                           );&lt;br /&gt;&lt;br /&gt;    # Display the Wx icon on the application window&lt;br /&gt;    $this-&gt;SetIcon(Wx::GetWxPerlIcon());&lt;br /&gt;&lt;br /&gt;    #--------------------------------------------------------------------------&lt;br /&gt;    # Menu Bar&lt;br /&gt;    #--------------------------------------------------------------------------     &lt;br /&gt;    my $file_menu = Wx::Menu-&gt;new('');&lt;br /&gt;    my $menu_bar = Wx::MenuBar-&gt;new();&lt;br /&gt;    $menu_bar-&gt;Append($file_menu, '&amp;amp;File');&lt;br /&gt;    $this-&gt;SetMenuBar($menu_bar);&lt;br /&gt;    ...&lt;/pre&gt;Increase the form height by 10 pixels (up to 195) to make room for the menu bar.&lt;br /&gt;And... voilà!&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_-EghEXBgxV4/Si7HDQ07AmI/AAAAAAAAAEQ/5BnN4G8q3N8/s1600-h/FrameBroken.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 162px;" src="http://1.bp.blogspot.com/_-EghEXBgxV4/Si7HDQ07AmI/AAAAAAAAAEQ/5BnN4G8q3N8/s400/FrameBroken.jpg" alt="" id="BLOGGER_PHOTO_ID_5345428666605830754" border="0" /&gt;&lt;/a&gt;Er... not too pretty, let's go back to the doc. Oh wait, what is that about panels?&lt;br /&gt;&lt;blockquote&gt;A panel is a window on which controls are placed. It is usually placed within a frame. It contains minimal extra functionality over and above its parent class wxWindow; its main purpose is to be similar in appearance and functionality to a dialog, but with the flexibility of having any window as a parent.&lt;/blockquote&gt;Ah ah! The trick is to place a wxPanel object inside the frame and then relate every existing GUI element to this panel as the parent window. Previously, all the elements (button, text dialog, etc.) had the wxFrame as a parent window, hence the dark grey background. Just add this line before the Menu Bar code:&lt;br /&gt;&lt;pre name="code" class="perl:firstline[48]"&gt;    # Create a panel where to place GUI elements&lt;br /&gt;    my $panel = Wx::Panel-&gt;new($this, -1);&lt;/pre&gt;and replace the $this argument by $panel everywhere you need to set the parent ID.&lt;br /&gt;&lt;br /&gt;Now we've got a menu bar element. You can fill it by appending menu elements to it as is shown in the code below. Each menu element can be appended in turn with menu options. The wxFrame::SetMenuBar() method displays a given menu bar.&lt;br /&gt;&lt;pre name="code" class="perl:firstline[98]"&gt;    #--------------------------------------------------------------------------&lt;br /&gt;    # Menu Bar&lt;br /&gt;    #-------------------------------------------------------------------------- &lt;br /&gt;    my $menu_bar = Wx::MenuBar-&gt;new();&lt;br /&gt;&lt;br /&gt;    my $file_menu = Wx::Menu-&gt;new(); &lt;br /&gt;    $file_menu-&gt;Append(11, 'E&amp;amp;xit');&lt;br /&gt;    $menu_bar-&gt;Append($file_menu, '&amp;amp;File');&lt;br /&gt; &lt;br /&gt;    my $help_menu = Wx::Menu-&gt;new();&lt;br /&gt;    $help_menu-&gt;Append(21, '&amp;amp;About');&lt;br /&gt;    $menu_bar-&gt;Append($help_menu, '&amp;amp;Help');&lt;br /&gt;&lt;br /&gt;    # wxFrame method to show a given menu bar&lt;br /&gt;    $this-&gt;SetMenuBar($menu_bar);&lt;/pre&gt;The &amp;amp; in the string (eg: 'E&amp;amp;xit') shows what shortcut will be used in combination with the Alt key (eg: Alt + x for 'E&amp;amp;xit').&lt;br /&gt;To link an event with a menu selection, use the EVT_MENU event:&lt;br /&gt;&lt;pre name="code" class="perl:firstline[114]"&gt;    EVT_MENU($this, 11, \&amp;amp;OnQuit);&lt;br /&gt;    EVT_MENU($this, 21, \&amp;amp;OnAbout);&lt;/pre&gt;The callback methods can be implemented as such:&lt;pre name="code" class="perl:firstline[381]"&gt;sub OnQuit {&lt;br /&gt;    my $this = shift;&lt;br /&gt;    $this-&gt;Close( 1 );&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;sub OnAbout {&lt;br /&gt;    my $this = shift;&lt;br /&gt;    use Wx qw(wxOK wxCENTRE);&lt;br /&gt;    Wx::MessageBox("twit_GUI $VERSION\n$version_date\n(c)DamienLearnsPerl",  # text&lt;br /&gt;                   "About",                   # title bar&lt;br /&gt;                   wxOK|wxCENTRE,             # buttons to display on form&lt;br /&gt;                   $this                      # parent&lt;br /&gt;                   );          &lt;br /&gt;}&lt;/pre&gt;End result under Vista? Tadaaa!&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_-EghEXBgxV4/SjAeMZRFQWI/AAAAAAAAAEY/QRTOxUN5tu8/s1600-h/Menu1.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 163px;" src="http://1.bp.blogspot.com/_-EghEXBgxV4/SjAeMZRFQWI/AAAAAAAAAEY/QRTOxUN5tu8/s400/Menu1.jpg" alt="" id="BLOGGER_PHOTO_ID_5345805955978576226" border="0" /&gt;&lt;/a&gt;Next step:&lt;br /&gt;- Load/save password files&lt;br /&gt;&lt;br /&gt;Find the whole new source code &lt;a href="http://sites.google.com/site/damienlearnsperl/DLP-scripts"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5699142825044889235-8288823859099323160?l=damienlearnsperl.blogspot.com'/&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/4NXrayT71ywyqYl2rYKpS9OpwZw/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/4NXrayT71ywyqYl2rYKpS9OpwZw/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/4NXrayT71ywyqYl2rYKpS9OpwZw/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/4NXrayT71ywyqYl2rYKpS9OpwZw/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=eqsTfBtiS-o:5h_1wngYeD8:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?i=eqsTfBtiS-o:5h_1wngYeD8:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=eqsTfBtiS-o:5h_1wngYeD8:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?i=eqsTfBtiS-o:5h_1wngYeD8:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=eqsTfBtiS-o:5h_1wngYeD8:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=eqsTfBtiS-o:5h_1wngYeD8:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DamienLearnsPerl/~4/eqsTfBtiS-o" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://damienlearnsperl.blogspot.com/feeds/8288823859099323160/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://damienlearnsperl.blogspot.com/2009/06/adding-menu-bar-to-twitter-gui-part-5.html#comment-form" title="4 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5699142825044889235/posts/default/8288823859099323160?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5699142825044889235/posts/default/8288823859099323160?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/DamienLearnsPerl/~3/eqsTfBtiS-o/adding-menu-bar-to-twitter-gui-part-5.html" title="Adding a menu bar to the twitter GUI: part 5" /><author><name>Damien</name><uri>http://www.blogger.com/profile/07183471087108492840</uri><email>damienlearnsperl@gmx.com</email><gd:extendedProperty name="OpenSocialUserId" value="13321007406475916362" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_-EghEXBgxV4/Si7HDQ07AmI/AAAAAAAAAEQ/5BnN4G8q3N8/s72-c/FrameBroken.jpg" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">4</thr:total><feedburner:origLink>http://damienlearnsperl.blogspot.com/2009/06/adding-menu-bar-to-twitter-gui-part-5.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkADRn0zcSp7ImA9WxJQGEU.&quot;"><id>tag:blogger.com,1999:blog-5699142825044889235.post-3901243131033694011</id><published>2009-06-01T22:30:00.003+02:00</published><updated>2009-06-01T22:39:37.389+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-06-01T22:39:37.389+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="blogging" /><category scheme="http://www.blogger.com/atom/ns#" term="Perl Iron Man" /><title>Perl Iron Man</title><content type="html">Ok, I've failed in the Perl Iron Man contest: it has been more than 10 days since last post :(&lt;br /&gt;But after the first thrills due to the project's novelty, there are not a lot of incentives coming from the Perl Iron Man organization (unless I've somehow missed it?):&lt;br /&gt;I was expecting leaderboards, post of the month, constructive critiques of blogs by writing professional, cheering pom pom girls, etc.&lt;br /&gt;I'm feeling a little bit let down right now... &lt;br&gt;&lt;/br&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5699142825044889235-3901243131033694011?l=damienlearnsperl.blogspot.com'/&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/sJHQK0UoWRJpC5qXbAx2RDy-6Kw/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/sJHQK0UoWRJpC5qXbAx2RDy-6Kw/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/sJHQK0UoWRJpC5qXbAx2RDy-6Kw/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/sJHQK0UoWRJpC5qXbAx2RDy-6Kw/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=hDVyeePA10c:Q8Na8Guk0iQ:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?i=hDVyeePA10c:Q8Na8Guk0iQ:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=hDVyeePA10c:Q8Na8Guk0iQ:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?i=hDVyeePA10c:Q8Na8Guk0iQ:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=hDVyeePA10c:Q8Na8Guk0iQ:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=hDVyeePA10c:Q8Na8Guk0iQ:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DamienLearnsPerl/~4/hDVyeePA10c" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://damienlearnsperl.blogspot.com/feeds/3901243131033694011/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://damienlearnsperl.blogspot.com/2009/06/perl-iron-man.html#comment-form" title="11 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5699142825044889235/posts/default/3901243131033694011?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5699142825044889235/posts/default/3901243131033694011?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/DamienLearnsPerl/~3/hDVyeePA10c/perl-iron-man.html" title="Perl Iron Man" /><author><name>Damien</name><uri>http://www.blogger.com/profile/07183471087108492840</uri><email>damienlearnsperl@gmx.com</email><gd:extendedProperty name="OpenSocialUserId" value="13321007406475916362" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">11</thr:total><feedburner:origLink>http://damienlearnsperl.blogspot.com/2009/06/perl-iron-man.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkIEQnY7cCp7ImA9WxJRFkU.&quot;"><id>tag:blogger.com,1999:blog-5699142825044889235.post-7443902226653077138</id><published>2009-05-17T21:35:00.008+02:00</published><updated>2009-05-18T23:01:43.808+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-05-18T23:01:43.808+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Perl" /><category scheme="http://www.blogger.com/atom/ns#" term="Twitter" /><category scheme="http://www.blogger.com/atom/ns#" term="wxPerl" /><title>Adding a wxPerl GUI to the twitter script: part 4 - Putting it all together</title><content type="html">Note: this article is part of a &lt;a href="http://damienlearnsperl.blogspot.com/search?q=wxPerl+GUI+twitter"&gt;series&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Today I've finished version 1.0.0 of twit_GUI.pl. Nothing fancy, I just added the Net:Twitter part from the &lt;a href="http://damienlearnsperl.blogspot.com/2009/02/improving-twit-perl-script.html"&gt;console version of twit.pl&lt;/a&gt; to the existing User Interface. I can now post to twitter.com or identi.ca from a graphical interface Perl program. That's how cool I am.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;New since version 0.0.2&lt;/span&gt;&lt;br /&gt;I removed the event handling on EVT_TEXT_MAXLEN because I realized that I didn't need to display a message when I reached 140 characters. The fact that you cannot type anything after the limit is enough. Keeping the message would have been annoying in fact...&lt;br /&gt;&lt;br /&gt;A "gentle" analysis from &lt;a href="http://perlcritic.com/"&gt;Perl::Critic&lt;/a&gt; made me change the way I was calling the &lt;span style="font-family:courier new;"&gt;open &lt;/span&gt;function.&lt;br /&gt;Before:&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;open(LOGINFILE, $password_file)&lt;/span&gt;&lt;br /&gt;After:&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;open(my $logfile_handle, '&lt;', $password_file)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Explanation:&lt;br /&gt;- The LOGINFILE file handle is &lt;span style="text-decoration: underline;"&gt;&lt;/span&gt;&lt;a href="http://perlcritic.com/pod/Perl/Critic/Policy/InputOutput/ProhibitBarewordFileHandles.html"&gt;dangerous&lt;/a&gt; because as such, LOGINFILE is declared as a global. It could already be used as another file's handle.&lt;br /&gt;- The '&lt;' second argument indicates that the file is open in read-only mode. It is easier to see that than in the previous writing and it avoids bugs for file names starting with '&lt;' or '&gt;' (see the &lt;a href="http://perlcritic.com/pod/Perl/Critic/Policy/InputOutput/ProhibitTwoArgOpen.html"&gt;full explanation&lt;/a&gt;).&lt;br /&gt;&lt;br /&gt;I also replaced the double quotes (") by single quotes (') everywhere variable interpolation was not needed.&lt;br /&gt;Speaking about quotes, I removed those surrounding the identifiers of the hash elements.&lt;br /&gt;Speaking about hashes, I really enjoy how flexible they can be used for structuring your data. Take for example the &lt;span style="font-family:courier new;"&gt;%login&lt;/span&gt; hash in &lt;span style="font-family:courier new;"&gt;$this-&gt;{login}&lt;/span&gt;. It lets me organize data as such:&lt;br /&gt;&lt;pre name="code" class="perl:nogutter"&gt;&lt;br /&gt;%login = {&lt;br /&gt;      user_name =&gt; { twitter =&gt; "Twitter.com user name",&lt;br /&gt;                     identica =&gt; "Identica user name"&lt;br /&gt;                   },&lt;br /&gt;      password =&gt;  { twitter =&gt; "Twitter.com password",&lt;br /&gt;                     identica =&gt; "Identica password"&lt;br /&gt;                   }&lt;br /&gt;}&lt;/pre&gt;And I can add to the hash construct as I need it. Of course, if not documented, I can see that hashes contructed in this manner could get pretty tough to maintain.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;What's next?&lt;/span&gt;&lt;br /&gt;There are improvements to be made to the twit_GUI script, especially concerning the password handling. Today I have a hard-coded path inside the script which is very ugly. I am not proud of myself but the Perl Iron Man's deadline is arriving soon and I want to stay in the contest ;)&lt;br /&gt;I will apply the finishing touch in a next post.&lt;br /&gt;&lt;br /&gt;I am not sure if I should keep the POD comments. I was thinking about throwing it all inside an "About" menu item. Maybe I can display the POD info directly in a MessageBox, in a reentrant fashion.&lt;br /&gt;&lt;br /&gt;I will not plaster the walls of this blog with yet another listing but as always you can find all script versions on the &lt;a href="http://sites.google.com/site/damienlearnsperl/DLP-scripts"&gt;DamienLearnsPerl's companion site&lt;/a&gt;.&lt;br /&gt;&lt;br&gt;&lt;/br&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5699142825044889235-7443902226653077138?l=damienlearnsperl.blogspot.com'/&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/t3WjTe8SlzI_vapTzXUgeQv55JE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/t3WjTe8SlzI_vapTzXUgeQv55JE/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/t3WjTe8SlzI_vapTzXUgeQv55JE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/t3WjTe8SlzI_vapTzXUgeQv55JE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=63w0LukfqsA:EN0WrxjAi10:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?i=63w0LukfqsA:EN0WrxjAi10:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=63w0LukfqsA:EN0WrxjAi10:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?i=63w0LukfqsA:EN0WrxjAi10:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=63w0LukfqsA:EN0WrxjAi10:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=63w0LukfqsA:EN0WrxjAi10:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DamienLearnsPerl/~4/63w0LukfqsA" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://damienlearnsperl.blogspot.com/feeds/7443902226653077138/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://damienlearnsperl.blogspot.com/2009/05/adding-wxperl-gui-to-twitter-script_17.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5699142825044889235/posts/default/7443902226653077138?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5699142825044889235/posts/default/7443902226653077138?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/DamienLearnsPerl/~3/63w0LukfqsA/adding-wxperl-gui-to-twitter-script_17.html" title="Adding a wxPerl GUI to the twitter script: part 4 - Putting it all together" /><author><name>Damien</name><uri>http://www.blogger.com/profile/07183471087108492840</uri><email>damienlearnsperl@gmx.com</email><gd:extendedProperty name="OpenSocialUserId" value="13321007406475916362" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">2</thr:total><feedburner:origLink>http://damienlearnsperl.blogspot.com/2009/05/adding-wxperl-gui-to-twitter-script_17.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEQERH4_eyp7ImA9WxJSGEo.&quot;"><id>tag:blogger.com,1999:blog-5699142825044889235.post-1784476166740411017</id><published>2009-05-09T12:28:00.006+02:00</published><updated>2009-05-09T15:38:25.043+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-05-09T15:38:25.043+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Perl" /><category scheme="http://www.blogger.com/atom/ns#" term="Twitter" /><category scheme="http://www.blogger.com/atom/ns#" term="wxPerl" /><title>Adding a wxPerl GUI to the twitter script: part 3 - Polishing up the UI</title><content type="html">&lt;a href="http://damienlearnsperl.blogspot.com/2009/04/adding-wxperl-gui-to-twitter-script.html"&gt;Last time I wrote about the WxPerl twitter GUI&lt;/a&gt;, I made a nice little drawing about what I wanted to achieve.&lt;br /&gt;The first try wasn't too far off but a few functionalities are still missing. One of them is the real-time updating of the remaining text characters (from a limit of 140). Obviously, what I need is an event on a key stroke to update the number of characters.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;WxEvents documentation&lt;/span&gt;&lt;br /&gt;Command events can be handled by macros listed in the WxWidget/WxPerl's manual under the &lt;a href="http://docs.wxwidgets.org/2.8.4/wx_wxcommandevent.html#wxcommandevent"&gt;wxCommandEvent page.&lt;/a&gt;&lt;br /&gt;Of interest to the twitter GUI script are:&lt;br /&gt;&lt;br /&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td valign="top" width="277"&gt;&lt;b&gt;EVT_TEXT(id, func)&lt;/b&gt; &lt;/td&gt;  &lt;td valign="top"&gt; Process a wxEVT_COMMAND_TEXT_UPDATED command, which is generated by a wxTextCtrl control. &lt;/td&gt;&lt;/tr&gt;      &lt;tr&gt;&lt;td valign="top" width="277"&gt; &lt;b&gt;EVT_TEXT_MAXLEN(id, func)&lt;/b&gt; &lt;/td&gt;  &lt;td valign="top"&gt; Process a wxEVT_COMMAND_TEXT_MAXLEN command, which is generated by a wxTextCtrl control when the user tries to enter more characters into it than the limit previously set with  &lt;a href="http://docs.wxwidgets.org/2.8.4/wx_wxtextctrl.html#wxtextctrlsetmaxlength"&gt;SetMaxLength&lt;/a&gt;. &lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;The first macro (EVT_TEXT) can be linked to the TextControl box where the message is being typed. Whenever a character is added or removed to the update message, the event handler will compute and display the remaining characters left before hitting the 140 limit.&lt;br /&gt;The EVT_TEXT_MAXLEN macro will link the update message's TextControl to a subroutine that will be called when 140 characters have been inputted.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Code&lt;/span&gt;&lt;br /&gt;When using WxPerl constants, the first thing to remember is to declare them at the beginning of the package.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;use Wx::Event qw(EVT_BUTTON EVT_CLOSE EVT_TEXT EVT_TEXT_MAXLEN);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;To find out the complete list of symbols, you can check the Wx source code in the lib/Wx/Wx_Exp.pm file located in your Perl directory. In this file, you will also be able to see all existing tags created to group related constants. For example, &lt;span style="font-family:courier new;"&gt;'statictext'&lt;/span&gt; is defined as:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;$EXPORT_TAGS{'statictext'} = [ qw(wxALIGN_LEFT&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;wxALIGN_CENTRE&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;wxALIGN_CENTER&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;wxALIGN_RIGHT&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;wxST_NO_AUTORESIZE&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;wxST_ELLIPSIZE_START&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;wxST_ELLIPSIZE_MIDDLE&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;wxST_ELLIPSIZE_END&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;wxST_MARKUP) ];&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Writing the following line in your program:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;use Wx qw(:statictext);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;will import all nine constants listed above.&lt;br /&gt;&lt;br /&gt;Coming back to our problem at hand, if we create a TextControl and StaticText objects like this&lt;br /&gt;&lt;pre name="code" class="perl:firstline[111]"&gt;&lt;br /&gt;    #&lt;br /&gt;    # Text control to enter message to twit&lt;br /&gt;    #&lt;br /&gt;    $this-&gt;{update_text} = Wx::TextCtrl-&gt;new(&lt;br /&gt;            $this,                      # parent window&lt;br /&gt;            -1,                         # control identifier&lt;br /&gt;            "Type your message here",   # default text value&lt;br /&gt;            [20, $ylines[3]],           # text control position [x, y]&lt;br /&gt;            [435, 35],                  # text control size [width, height]&lt;br /&gt;            wxTE_MULTILINE              # style: wxTE_MULTILINE=The text control allows multiple lines&lt;br /&gt;    );&lt;br /&gt;&lt;br /&gt;    # A EVT_TEXT_MAXLEN event is generated when the number of characters in the update_text control&lt;br /&gt;    # reaches the maximum passed value.&lt;br /&gt;    $this-&gt;{update_text}-&gt;SetMaxLength(MAX_POST_LENGTH);&lt;br /&gt;&lt;br /&gt;    #&lt;br /&gt;    # Static text placed at the top-right position of the text control&lt;br /&gt;    #&lt;br /&gt;    Wx::StaticText-&gt;new(&lt;br /&gt;            $this,              # parent&lt;br /&gt;            -1,                 # id&lt;br /&gt;            'characters left',  # label&lt;br /&gt;            [$form_width - 95, $ylines[2]]    # position [x, y]&lt;br /&gt;    );&lt;br /&gt;&lt;br /&gt;    #&lt;br /&gt;    # Static text displaying number of characters left before reaching the max amount&lt;br /&gt;    #&lt;br /&gt;    $this-&gt;{static_text}{'CharsLeft'} = Wx::StaticText-&gt;new(&lt;br /&gt;                                            $this,              # parent&lt;br /&gt;                                            -1,                 # id&lt;br /&gt;                                            MAX_POST_LENGTH - $this-&gt;{update_text}-&gt;GetLastPosition,  # label&lt;br /&gt;                                            [$form_width - 115, $ylines[2]],    # position [x, y]&lt;br /&gt;                                            wxDefaultSize,      # size&lt;br /&gt;                                            Wx::wxALIGN_RIGHT   # style. Not implemented yet?&lt;br /&gt;                                        );&lt;/pre&gt;&lt;br /&gt;then calling the following event handlers&lt;br /&gt;&lt;pre name="code" class="perl:firstline[204]"&gt;&lt;br /&gt;    # Events associated to the update_text Control&lt;br /&gt;    # EVT_TEXT_MAXLEN is generated when the length of the Text control&lt;br /&gt;    # becomes larger than the value set by SetMaxLength&lt;br /&gt;    EVT_TEXT_MAXLEN($this, $this-&gt;{update_text}, \&amp;MaxTextReached);&lt;br /&gt;&lt;br /&gt;    # EVT_TEXT is generated when a character is typed inside the Text control&lt;br /&gt;    # We use it to update the display of characters left for message&lt;br /&gt;    EVT_TEXT($this, $this-&gt;{update_text}, \&amp;CountCharsLeft);&lt;/pre&gt;&lt;br /&gt;with the subroutines definition being:&lt;br /&gt;&lt;pre name="code" class="perl:firstline[218]"&gt;&lt;br /&gt;sub CountCharsLeft {&lt;br /&gt;    my($this, $event) = @_;&lt;br /&gt;&lt;br /&gt;    # Update number of remaining characters = MAX - current text size&lt;br /&gt;    my $chars_left = MAX_POST_LENGTH - $this-&gt;{update_text}-&gt;GetLastPosition;&lt;br /&gt;    $this-&gt;{static_text}{'CharsLeft'}-&gt;SetLabel($chars_left);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;sub MaxTextReached {&lt;br /&gt;    my($this, $event) = @_;&lt;br /&gt;&lt;br /&gt;    Wx::MessageBox(&lt;br /&gt;            "You have reached the maximum number of characters",      # text&lt;br /&gt;            "Update too big",   # title bar&lt;br /&gt;            wxOK,        # buttons to display on form&lt;br /&gt;            $this        # parent&lt;br /&gt;    );&lt;br /&gt;}&lt;/pre&gt;then every time &lt;span style="font-family:monospace;"&gt;&lt;/span&gt;that &lt;span style="font-family:courier new;"&gt;{update_text}&lt;/span&gt; is edited, &lt;span style="font-family:courier new;"&gt;CountCharsLeft()&lt;/span&gt; will be called and will reset the label for &lt;span style="font-family:courier new;"&gt;{static_text}{'CharsLeft'}&lt;/span&gt; with the new value computed from &lt;span style="font-family:courier new;"&gt;{update_text}-&gt;GetLastPosition&lt;/span&gt;.&lt;br /&gt;I couldn't achieve right-aligning the number of characters. From reading the Wx::Perl::Dialog source, I do not think that the style argument is supported yet.&lt;br /&gt;&lt;br /&gt;The result?&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_-EghEXBgxV4/SgWB8xYOfpI/AAAAAAAAAEI/DN6Is95sCBE/s1600-h/GUI2.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 159px;" src="http://1.bp.blogspot.com/_-EghEXBgxV4/SgWB8xYOfpI/AAAAAAAAAEI/DN6Is95sCBE/s400/GUI2.jpg" alt="" id="BLOGGER_PHOTO_ID_5333812214737305234" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Now one step further to accomplish my goal of being able to understand Padre's code once I put my nose in it...&lt;br /&gt;&lt;br&gt;&lt;/br&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5699142825044889235-1784476166740411017?l=damienlearnsperl.blogspot.com'/&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/y4fbk_VvQgkrkGkKS93I0lmwxNM/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/y4fbk_VvQgkrkGkKS93I0lmwxNM/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/y4fbk_VvQgkrkGkKS93I0lmwxNM/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/y4fbk_VvQgkrkGkKS93I0lmwxNM/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=RcSNIEO1R8g:oVJxmASfHJU:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?i=RcSNIEO1R8g:oVJxmASfHJU:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=RcSNIEO1R8g:oVJxmASfHJU:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?i=RcSNIEO1R8g:oVJxmASfHJU:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=RcSNIEO1R8g:oVJxmASfHJU:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=RcSNIEO1R8g:oVJxmASfHJU:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DamienLearnsPerl/~4/RcSNIEO1R8g" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://damienlearnsperl.blogspot.com/feeds/1784476166740411017/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://damienlearnsperl.blogspot.com/2009/05/adding-wxperl-gui-to-twitter-script.html#comment-form" title="4 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5699142825044889235/posts/default/1784476166740411017?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5699142825044889235/posts/default/1784476166740411017?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/DamienLearnsPerl/~3/RcSNIEO1R8g/adding-wxperl-gui-to-twitter-script.html" title="Adding a wxPerl GUI to the twitter script: part 3 - Polishing up the UI" /><author><name>Damien</name><uri>http://www.blogger.com/profile/07183471087108492840</uri><email>damienlearnsperl@gmx.com</email><gd:extendedProperty name="OpenSocialUserId" value="13321007406475916362" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_-EghEXBgxV4/SgWB8xYOfpI/AAAAAAAAAEI/DN6Is95sCBE/s72-c/GUI2.jpg" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">4</thr:total><feedburner:origLink>http://damienlearnsperl.blogspot.com/2009/05/adding-wxperl-gui-to-twitter-script.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUQGSXo7eSp7ImA9WxJSE04.&quot;"><id>tag:blogger.com,1999:blog-5699142825044889235.post-6300211673300013569</id><published>2009-05-03T09:32:00.002+02:00</published><updated>2009-05-03T09:55:28.401+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-05-03T09:55:28.401+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Perl news" /><category scheme="http://www.blogger.com/atom/ns#" term="Strawberry Perl" /><category scheme="http://www.blogger.com/atom/ns#" term="Padre" /><category scheme="http://www.blogger.com/atom/ns#" term="blogging" /><title>AdSense integration to Google analytics and other news</title><content type="html">&lt;span style="font-weight: bold;"&gt;AdSense&lt;/span&gt;&lt;br /&gt;If you are a blogger with AdSense revenues, you can now integrate the AdSense stats to your Google Analytics account.&lt;br /&gt;To do so, just follow &lt;a href="http://adsense.blogspot.com/2009/04/analytics-integration-for-all.html"&gt;those very simple instructions&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;DamienLearnsPerl's April Analytics stats&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Thanks to the &lt;a href="http://damienlearnsperl.blogspot.com/2009/03/write-better-perl-with-perlcritic.html"&gt;Perl::Critic post&lt;/a&gt; appearing on &lt;a href="http://news.ycombinator.com/"&gt;Hacker News&lt;/a&gt;, there was a peak at 661 visits on the 28th of April!&lt;/li&gt;&lt;li&gt;The United States (728), France (98) and the UK (93) are the leading trio of visiting countries in April.&lt;/li&gt;&lt;li&gt;2/3 of visitors use Firefox, IE (8.8%) is in third place behind Safari (10%)&lt;/li&gt;&lt;li&gt;56% of visits originate from Windows, 21.5% from Linux and 20% from a Mac&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold;"&gt;Strawberry Perl&lt;br /&gt;&lt;/span&gt;&lt;span&gt;&lt;a href="http://strawberryperl.com/"&gt;New versions&lt;/a&gt; are freshly available for both Perl 5.8.9 and 5.10.0.&lt;br /&gt;Check out &lt;a href="http://use.perl.org/%7EAlias/journal/38900"&gt;what's new&lt;/a&gt;!&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;The Perl Review&lt;/span&gt;&lt;br /&gt;The last issue is already 2-week old. Get it &lt;a href="http://www.theperlreview.com/"&gt;there&lt;/a&gt;!&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Perl IronMan&lt;/span&gt;&lt;br /&gt;I entered the &lt;a href="http://www.enlightenedperl.org/ironman.html"&gt;IronMan challenge&lt;/a&gt;, the brainchild of &lt;a href="http://www.shadowcat.co.uk/blog/matt-s-trout/iron-man/"&gt;Matt Trout&lt;/a&gt; from Enlightened Perl. Check out all participating blogs in &lt;a href="http://ironman.enlightenedperl.org/"&gt;Planet Perl Iron Man&lt;/a&gt;!&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Padre v0.34&lt;/span&gt;&lt;br /&gt;&lt;a href="http://szabgab.com/blog/2009/04/1240924550.html"&gt;Version 0.34 has been released&lt;/a&gt;. See the changelog &lt;a href="http://svn.perlide.org/padre/trunk/Padre/Changes"&gt;here&lt;/a&gt;.&lt;br&gt;&lt;br&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5699142825044889235-6300211673300013569?l=damienlearnsperl.blogspot.com'/&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/5m6xZonSVqX1v1TI0MTtbueeoO4/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/5m6xZonSVqX1v1TI0MTtbueeoO4/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/5m6xZonSVqX1v1TI0MTtbueeoO4/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/5m6xZonSVqX1v1TI0MTtbueeoO4/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=8m0xJXCalGM:4ULHgKwC_cQ:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?i=8m0xJXCalGM:4ULHgKwC_cQ:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=8m0xJXCalGM:4ULHgKwC_cQ:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?i=8m0xJXCalGM:4ULHgKwC_cQ:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=8m0xJXCalGM:4ULHgKwC_cQ:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=8m0xJXCalGM:4ULHgKwC_cQ:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DamienLearnsPerl/~4/8m0xJXCalGM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://damienlearnsperl.blogspot.com/feeds/6300211673300013569/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://damienlearnsperl.blogspot.com/2009/05/adsense-integration-to-google-analytics.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5699142825044889235/posts/default/6300211673300013569?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5699142825044889235/posts/default/6300211673300013569?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/DamienLearnsPerl/~3/8m0xJXCalGM/adsense-integration-to-google-analytics.html" title="AdSense integration to Google analytics and other news" /><author><name>Damien</name><uri>http://www.blogger.com/profile/07183471087108492840</uri><email>damienlearnsperl@gmx.com</email><gd:extendedProperty name="OpenSocialUserId" value="13321007406475916362" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://damienlearnsperl.blogspot.com/2009/05/adsense-integration-to-google-analytics.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkQDQXwzeip7ImA9WxJSEEk.&quot;"><id>tag:blogger.com,1999:blog-5699142825044889235.post-1580962711410878626</id><published>2009-04-29T22:42:00.000+02:00</published><updated>2009-04-29T23:26:10.282+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-04-29T23:26:10.282+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Perl" /><category scheme="http://www.blogger.com/atom/ns#" term="Larry Wall" /><category scheme="http://www.blogger.com/atom/ns#" term="Twitter" /><category scheme="http://www.blogger.com/atom/ns#" term="wxPerl" /><title>Adding a wxPerl GUI to the twitter script: part 2 - Drawing the controls</title><content type="html">Part 2 of this series will describe how to draw the GUI elements thanks to some wxPerl magic.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;wxPerl Documentation&lt;/span&gt;&lt;br /&gt;The documentation on wxPerl is rather sparse.&lt;br /&gt;The best starting points are:&lt;ul&gt;&lt;li&gt;An excellent tutorial from &lt;a href="http://www.perl.com/pub/a/2001/09/12/wxtutorial1.html"&gt;Jouke Visser over at Perl.com&lt;/a&gt; where you learn that wx stands for Windows - X to show off the portability of the library.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Another series of &lt;a href="http://www.perlmonks.org/index.pl?node_id=112297"&gt;tutorials from boo_radley at perlmonks.org&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Those tutorial and a few more are already listed on the &lt;a href="http://wxperl.sourceforge.net/documentation.html"&gt;wxPerl site&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;By clicking on &lt;a href="http://prdownloads.sourceforge.net/wxperl/wxPerl-0.26-samples.zip"&gt;this link&lt;/a&gt;, you will start downloading example files from the wxPerl sourceforge repository. This is a very useful resource for the first-hand demo of a lot of controls.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;The Wx module for Perl is of course &lt;a href="http://search.cpan.org/%7Embarbon/Wx-0.89/Wx.pm"&gt;downloadable from CPAN&lt;/a&gt;&lt;/li&gt;&lt;li&gt;When looking at the wxWidget doc, you can transpose to the wxPerl world by knowing that "in wxPerl all classes are named Wx::Something, so wxFrame is really Wx::Frame.   Static methods are called Wx::ClassName::Method(). Global function named   wxFunction() are accessible as Wx::Function()." [from the &lt;a href="http://wxperl.sourceforge.net/manual/manual4.html"&gt;wxPerl manual&lt;/a&gt;]&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold;"&gt;Oooh the pretty drawings...&lt;/span&gt;&lt;br /&gt;The code listing that I present here doesn't do anything useful. It just initializes some controls and places them on an application window.&lt;br /&gt;However, I'll try to explain how to find the information so we can use any control supported by wxPerl.&lt;br /&gt;If you go back to &lt;a href="http://damienlearnsperl.blogspot.com/2009/03/wxperl-adding-gui-to-twitter-script_6211.html"&gt;my previous post&lt;/a&gt; on the subject, you'll be reminded that the goal is to have a window that looks like that:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_-EghEXBgxV4/SfjAvybfPpI/AAAAAAAAAD4/cA0I_wM6qU8/s1600-h/GUI1.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 214px;" src="http://1.bp.blogspot.com/_-EghEXBgxV4/SfjAvybfPpI/AAAAAAAAAD4/cA0I_wM6qU8/s400/GUI1.jpg" alt="" id="BLOGGER_PHOTO_ID_5330222086216433298" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;The first step is to actually get the main window displayed.&lt;br /&gt;This is not straightforward, here's one way to do it.&lt;br /&gt;&lt;pre name="code" class="perl"&gt;&lt;br /&gt;#!/usr/bin/perl&lt;br /&gt;use Modern::Perl;&lt;br /&gt;use Wx;&lt;/pre&gt;&lt;br /&gt;...&lt;br /&gt;&lt;pre name="code" class="perl:firstline[34]"&gt;&lt;br /&gt;##############################################################################&lt;br /&gt;#&lt;br /&gt;package MyApp;&lt;br /&gt;#&lt;br /&gt;##############################################################################&lt;br /&gt;use vars qw(@ISA);&lt;br /&gt;@ISA=qw(Wx::App);   # this tells Perl to look for inkown methods in the Wx::App module&lt;br /&gt;&lt;br /&gt;use Wx qw(wxDefaultSize wxDefaultPosition);&lt;br /&gt;&lt;br /&gt;sub OnInit {&lt;br /&gt;    my($this) = @_;&lt;br /&gt;    my $dialog = MyDialog-&gt;new("Twit", wxDefaultPosition);&lt;br /&gt;    $this-&gt;SetTopWindow($dialog);&lt;br /&gt;    $dialog-&gt;Show(1);&lt;br /&gt;    1;&lt;br /&gt;}&lt;/pre&gt;...&lt;pre name="code" class="perl:firstline[216]"&gt;&lt;br /&gt;##############################################################################&lt;br /&gt;#&lt;br /&gt;package main;&lt;br /&gt;#&lt;br /&gt;##############################################################################&lt;br /&gt;&lt;br /&gt;my($app) = MyApp-&gt;new();&lt;br /&gt;$app-&gt;MainLoop();&lt;/pre&gt;There's obviously a lot of code missing but I will talk a bit about packages as it is the first time that I am confronted to them (remember, I am learning Perl). There is a &lt;a href="http://perldoc.perl.org/perlmod.html#Packages"&gt;perldoc page on packages&lt;/a&gt;. To summarize greatly, the package keyword defines the beginning of a namespace (when used as &lt;span style="font-family:courier new;"&gt;package NAMESPACE)&lt;span style="font-family:verdana;"&gt;.&lt;/span&gt;&lt;/span&gt; &lt;span style="font-family:courier new;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;By the way, I didn't invent the code construct above. I found it in the wxPerl demo from the "wxPerl-0.26-samples.zip" file that you can download from the &lt;a href="http://wxperl.sourceforge.net/download.html"&gt;document section of the official wxPerl's download page&lt;/a&gt;.&lt;br /&gt;In the same section, you will find a link to download the html version of the wxWidget documentation.&lt;br /&gt;&lt;br /&gt;Line 222, we create an instance of MyApp and enter the hot loop. We will exit the loop when the MyApp object is destroyed (as a result of a click on the exit button for example).&lt;br /&gt;&lt;br /&gt;In Package MyApp starting at line 36, the &lt;span style="font-family:courier new;"&gt;@ISA=qw(Wx::App);&lt;/span&gt; line tells Perl to look for unknown methods in the Wx::App module.&lt;br /&gt;The Wx::App::OnInit() routine is called at the creation of a Wx::App object. It will create the application's main window.&lt;br /&gt;In this function, we call the new() method of the MyDialog package/namespace that is given below:&lt;br /&gt;&lt;pre name="code" class="perl:firstline[53]"&gt;##############################################################################&lt;br /&gt;#&lt;br /&gt;package MyDialog;&lt;br /&gt;#&lt;br /&gt;##############################################################################&lt;br /&gt;&lt;br /&gt;use vars qw(@ISA);&lt;br /&gt;&lt;br /&gt;@ISA=qw(Wx::Dialog);&lt;br /&gt;&lt;br /&gt;use Wx::Event qw(EVT_BUTTON EVT_CLOSE);&lt;br /&gt;use Wx qw(:sizer&lt;br /&gt;          wxDefaultPosition&lt;br /&gt;          wxDefaultSize&lt;br /&gt;          wxDefaultValidator&lt;br /&gt;          wxDEFAULT_DIALOG_STYLE&lt;br /&gt;          wxID_OK&lt;br /&gt;          wxOK&lt;br /&gt;          wxRESIZE_BORDER&lt;br /&gt;          wxTE_MULTILINE&lt;br /&gt;          );&lt;br /&gt;&lt;br /&gt;use constant MAX_POST_LENGTH =&gt; 140;&lt;br /&gt;&lt;br /&gt;sub new {&lt;br /&gt;    my $class = shift;&lt;br /&gt;&lt;br /&gt;    # Main window&lt;br /&gt;    my $form_width  = 480;&lt;br /&gt;    my $form_height = 175;&lt;br /&gt;    my $yline1      = 10;&lt;br /&gt;    my $yline2      = 30;&lt;br /&gt;    my $yline3      = 70;&lt;br /&gt;    my $yline4      = 90;&lt;br /&gt;&lt;br /&gt;    my $this = $class-&gt;SUPER::new(&lt;br /&gt;                            undef,  # parent&lt;br /&gt;                            -1,     # id&lt;br /&gt;                            $_[0],  # title&lt;br /&gt;                            $_[1],  # position [x, y]&lt;br /&gt;                            [$form_width, $form_height] # size [width, height]&lt;br /&gt;                       );&lt;br /&gt;&lt;br /&gt;    # Display the Wx icon on the application window&lt;br /&gt;    $this-&gt;SetIcon(Wx::GetWxPerlIcon());&lt;br /&gt;&lt;br /&gt;    #--------------------------------------------------------------------------&lt;br /&gt;    # Static box to contain message text box + twitter and identica checkboxes&lt;br /&gt;    #--------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;    # A static box is a rectangle drawn around other panel items to denote a logical grouping of items.&lt;br /&gt;    Wx::StaticBox-&gt;new(&lt;br /&gt;            $this,                  # parent window&lt;br /&gt;            -1,                     # window identifier (-1: default)&lt;br /&gt;            'Status',               # text to be displayed in the static box&lt;br /&gt;            [10, $yline1],          # window position [x, y]&lt;br /&gt;            [$form_width-25, 120]   # checkbox size [width, height]&lt;br /&gt;    );&lt;br /&gt;&lt;br /&gt;    # Text control to enter message to twit&lt;br /&gt;    $this-&gt;{text} = Wx::TextCtrl-&gt;new(&lt;br /&gt;            $this,                      # parent window&lt;br /&gt;            -1,                         # control identifier&lt;br /&gt;            "Type your message here",   # default text value&lt;br /&gt;            [20, $yline2],              # text control position [x, y]&lt;br /&gt;            [435, 35],                  # text control size [width, height]&lt;br /&gt;            wxTE_MULTILINE              # style: wxTE_MULTILINE=The text control allows multiple lines&lt;br /&gt;    );&lt;br /&gt;&lt;br /&gt;    # A wxEVT_COMMAND_TEXT_MAXLEN event is generated when the number of characters in the text control&lt;br /&gt;    # reaches the maximum passed value.&lt;br /&gt;    $this-&gt;{text}-&gt;SetMaxLength(MAX_POST_LENGTH);&lt;br /&gt;&lt;br /&gt;    # Static text placed in front of the twitter and identica check boxes&lt;br /&gt;    Wx::StaticText-&gt;new(&lt;br /&gt;            $this,              # parent&lt;br /&gt;            -1,                 # id&lt;br /&gt;            'Send to:',         # label&lt;br /&gt;            [20, $yline3]       # position [x, y]&lt;br /&gt;    );&lt;br /&gt;    # twitter check box: enabled by default&lt;br /&gt;    $this-&gt;{checkbox}{"twitter"} =  Wx::CheckBox-&gt;new(&lt;br /&gt;                                            $this,          # parent&lt;br /&gt;                                            -1,             # id&lt;br /&gt;                                            'Twitter.com',  # label&lt;br /&gt;                                            [80, $yline3]   # position [x, y]&lt;br /&gt;                                    );&lt;br /&gt;    # Checked by default&lt;br /&gt;    $this-&gt;{checkbox}{"twitter"}-&gt;SetValue(1);&lt;br /&gt;&lt;br /&gt;    # identica check box: enabled by default&lt;br /&gt;    $this-&gt;{checkbox}{"identica"} = Wx::CheckBox-&gt;new(&lt;br /&gt;                                            $this,          # parent&lt;br /&gt;                                            -1,             # id&lt;br /&gt;                                            'Identi.ca',    # label&lt;br /&gt;                                            [200, $yline3]  # position [x, y]&lt;br /&gt;                                    );&lt;br /&gt;    # Checked by default&lt;br /&gt;    $this-&gt;{checkbox}{"identica"}-&gt;SetValue(1);&lt;br /&gt;&lt;br /&gt;    #--------------------------------------------------------------------------&lt;br /&gt;    # End of static box&lt;br /&gt;    #--------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;    # "Send" button&lt;br /&gt;    $this-&gt;{button}{"Send"} = Wx::Button-&gt;new(&lt;br /&gt;                                    $this,                  # parent&lt;br /&gt;                                     -1,                    # id&lt;br /&gt;                                     'S E N D   U P D A T E',   # label&lt;br /&gt;                                     [20, $yline4],         # position [x,y]&lt;br /&gt;                                     [$form_width-45, 30]   # size [w, h]&lt;br /&gt;                              );&lt;br /&gt;&lt;br /&gt;    # Event associated to "Send" button&lt;br /&gt;    EVT_BUTTON(&lt;br /&gt;        $this,&lt;br /&gt;        $this-&gt;{button}{"Send"},&lt;br /&gt;        \&amp;SendMsg&lt;br /&gt;    );&lt;br /&gt;&lt;br /&gt;    EVT_CLOSE(&lt;br /&gt;        $this,&lt;br /&gt;        \&amp;OnClose&lt;br /&gt;    );&lt;br /&gt;&lt;br /&gt;    $this;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;sub SendMsg {&lt;br /&gt;    my($this, $event) = @_;&lt;br /&gt;    my $twitter, my $identica;&lt;br /&gt;&lt;br /&gt;    if ($this-&gt;{checkbox}{"twitter"}-&gt;GetValue()) {&lt;br /&gt;        $twitter = 1;&lt;br /&gt;    }&lt;br /&gt;    else {&lt;br /&gt;        $twitter = 0;&lt;br /&gt;    }&lt;br /&gt;    &lt;br /&gt;    if ($this-&gt;{checkbox}{"identica"}-&gt;GetValue()) {&lt;br /&gt;        $identica = 1;&lt;br /&gt;    }&lt;br /&gt;    else {&lt;br /&gt;        $identica = 0;&lt;br /&gt;    }    &lt;br /&gt;&lt;br /&gt;    # For now, just display a MessageBox to test event on button press&lt;br /&gt;&lt;br /&gt;    Wx::MessageBox(&lt;br /&gt;            "Test:\ntwitter is set to $twitter\nidentica is set to $identica",      # text&lt;br /&gt;            "Caption",   # title bar&lt;br /&gt;            wxOK,        # buttons to display on form&lt;br /&gt;            $this        # parent&lt;br /&gt;    );&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;sub OnClose {&lt;br /&gt;    my($this, $event) = @_;&lt;br /&gt;&lt;br /&gt;    $this-&gt;Destroy();&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Lots of code here but with the WxWidgets doc and my strategically placed comments, it should be easy to understand.&lt;br /&gt;One thing to remember is to define each WxWidget symbol that you want to use beforehand. This is what is done on lines 63-73.&lt;br /&gt;If you want to include all symbols, type&lt;br /&gt;&lt;pre class="programlisting"&gt;use Wx qw(:everything);&lt;/pre&gt;Other tags are described in &lt;a href="http://wxperl.sourceforge.net/manual/manual3.html"&gt;this WxPerl manual's page&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Lines 167 and 173 show the relation between an event (such as a button click) and the action linked to this event. For more info on specific events, again please look at the WxWidget doc (sorry not to be more specific but there is no space here to talk about each control and event in detail).&lt;br /&gt;&lt;br /&gt;The SendMessage() routine that is presented starting from line 181 is just there for the example. It doesn't do anything useful yet. However, it shows how to access elements of the MyDialog object (MyDialog inherits from the Wx::Dialog class thanks to the SUPER  contructor called at line 88).&lt;br /&gt;&lt;br /&gt;The end result looks like the screenshot below. Like the knick-knacks that grace Auntie Beth's shelves, it serves no purpose but it sure looks shiny:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_-EghEXBgxV4/Sfi7fs3wmFI/AAAAAAAAADw/JTI1sDrSpZ0/s1600-h/GUI_twit.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 151px;" src="http://1.bp.blogspot.com/_-EghEXBgxV4/Sfi7fs3wmFI/AAAAAAAAADw/JTI1sDrSpZ0/s400/GUI_twit.jpg" alt="" id="BLOGGER_PHOTO_ID_5330216312288352338" border="0" /&gt;&lt;/a&gt;The full twit_GUI.pl code can be found &lt;a href="http://sites.google.com/site/damienlearnsperl/DLP-scripts"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Larry Wall &lt;a href="http://en.wikiquote.org/wiki/Larry_Wall"&gt;quote of the day&lt;/a&gt;:&lt;br /&gt;"If you remove stricture from a large Perl program currently, you're just installing delayed bugs, whereas with this feature, you're installing an instant bug that's easily fixed. Whoopee."&lt;br&gt;&lt;br&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5699142825044889235-1580962711410878626?l=damienlearnsperl.blogspot.com'/&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/daNtrTqVhLNhpXBBG3Z8hYZGvdA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/daNtrTqVhLNhpXBBG3Z8hYZGvdA/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/daNtrTqVhLNhpXBBG3Z8hYZGvdA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/daNtrTqVhLNhpXBBG3Z8hYZGvdA/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=McqMjngkvFI:IETAHsxWAqQ:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?i=McqMjngkvFI:IETAHsxWAqQ:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=McqMjngkvFI:IETAHsxWAqQ:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?i=McqMjngkvFI:IETAHsxWAqQ:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=McqMjngkvFI:IETAHsxWAqQ:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=McqMjngkvFI:IETAHsxWAqQ:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DamienLearnsPerl/~4/McqMjngkvFI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://damienlearnsperl.blogspot.com/feeds/1580962711410878626/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://damienlearnsperl.blogspot.com/2009/04/adding-wxperl-gui-to-twitter-script.html#comment-form" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5699142825044889235/posts/default/1580962711410878626?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5699142825044889235/posts/default/1580962711410878626?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/DamienLearnsPerl/~3/McqMjngkvFI/adding-wxperl-gui-to-twitter-script.html" title="Adding a wxPerl GUI to the twitter script: part 2 - Drawing the controls" /><author><name>Damien</name><uri>http://www.blogger.com/profile/07183471087108492840</uri><email>damienlearnsperl@gmx.com</email><gd:extendedProperty name="OpenSocialUserId" value="13321007406475916362" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_-EghEXBgxV4/SfjAvybfPpI/AAAAAAAAAD4/cA0I_wM6qU8/s72-c/GUI1.jpg" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">3</thr:total><feedburner:origLink>http://damienlearnsperl.blogspot.com/2009/04/adding-wxperl-gui-to-twitter-script.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUMDRnw-eip7ImA9WxJTE04.&quot;"><id>tag:blogger.com,1999:blog-5699142825044889235.post-4160350883017604055</id><published>2009-04-20T21:52:00.005+02:00</published><updated>2009-04-21T19:04:37.252+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-04-21T19:04:37.252+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Perl" /><category scheme="http://www.blogger.com/atom/ns#" term="Padre" /><category scheme="http://www.blogger.com/atom/ns#" term="Notepad++" /><title>How to set up Notepad++ to follow the perlstyle guidelines</title><content type="html">I discussed the &lt;a href="http://perldoc.perl.org/perlstyle.html"&gt;perlstyle guide&lt;/a&gt; in a previous post.&lt;br /&gt;Today I will show how what I did to set up Notepad++ and Padre (v0.29) to automatically follow the recommended format.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;4-column indent&lt;/span&gt;&lt;br /&gt;In Notepad++, Settings&gt;Preferences. Select the "Edit Components" tab. There is a box with Tab setting. Set tab size as 4 and check "Replace by spaces"&lt;br /&gt;&lt;br /&gt;In Padre, go to Edit&gt;Preferences. There is a checkbox called "use tabs" but I have not noticed any difference whether it is selected or not. I left it checked. In "TAB display size", put 4.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Trim trailing spaces&lt;/span&gt;&lt;br /&gt;This is a personal addition of mine. It makes it easier to perform file comparison when you are not distracted by pollution from extra space characters.&lt;br /&gt;&lt;br /&gt;In Notepad++, use the "Trim Trailing Spaces" option from the Edit menu (shortcut: CTRL+T).&lt;br /&gt;&lt;br /&gt;Do you have any more settings you'd like to share?&lt;br /&gt;&lt;br&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5699142825044889235-4160350883017604055?l=damienlearnsperl.blogspot.com'/&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/a5bm6q-yEXhnoTsUO2Mz01wqwFE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/a5bm6q-yEXhnoTsUO2Mz01wqwFE/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/a5bm6q-yEXhnoTsUO2Mz01wqwFE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/a5bm6q-yEXhnoTsUO2Mz01wqwFE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=ZakbeEi3pY4:sPhOZi0NJbs:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?i=ZakbeEi3pY4:sPhOZi0NJbs:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=ZakbeEi3pY4:sPhOZi0NJbs:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?i=ZakbeEi3pY4:sPhOZi0NJbs:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=ZakbeEi3pY4:sPhOZi0NJbs:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=ZakbeEi3pY4:sPhOZi0NJbs:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DamienLearnsPerl/~4/ZakbeEi3pY4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://damienlearnsperl.blogspot.com/feeds/4160350883017604055/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://damienlearnsperl.blogspot.com/2009/04/how-to-set-up-notepad-to-follow.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5699142825044889235/posts/default/4160350883017604055?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5699142825044889235/posts/default/4160350883017604055?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/DamienLearnsPerl/~3/ZakbeEi3pY4/how-to-set-up-notepad-to-follow.html" title="How to set up Notepad++ to follow the perlstyle guidelines" /><author><name>Damien</name><uri>http://www.blogger.com/profile/07183471087108492840</uri><email>damienlearnsperl@gmx.com</email><gd:extendedProperty name="OpenSocialUserId" value="13321007406475916362" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://damienlearnsperl.blogspot.com/2009/04/how-to-set-up-notepad-to-follow.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C08CSXc7eSp7ImA9WxVbFE4.&quot;"><id>tag:blogger.com,1999:blog-5699142825044889235.post-8224570575213297437</id><published>2009-03-30T18:50:00.000+02:00</published><updated>2009-03-30T18:51:08.901+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-03-30T18:51:08.901+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Testing" /><category scheme="http://www.blogger.com/atom/ns#" term="Larry Wall" /><category scheme="http://www.blogger.com/atom/ns#" term="programming" /><category scheme="http://www.blogger.com/atom/ns#" term="Twitter" /><category scheme="http://www.blogger.com/atom/ns#" term="wxPerl" /><title>wxPerl: adding a GUI to the twitter script (part 1)</title><content type="html">So far, I've only dabbled with Perl console applications. There is nothing wrong about them, and if you come from the Linux world you are probably quite familiar with running a program from the command line.&lt;br /&gt;The standard Windows users however may not be as comfortable around CLI (Command Line interface) apps as they are around Graphical User Interface (GUI) programs.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;I. Describing the need&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;The first need is to provide a simple GUI interface. I am tired of opening a shell, going to the script directory and typing something like:&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;perl twit.pl -s "I am so lazy" -a&lt;/span&gt;&lt;br /&gt;every time I want to update my Twitter and Identica messages. I just want to type my text and click on a "Send" button.&lt;/li&gt;&lt;li&gt;Monitor the number of characters being typed so that it doesn't go over the 140-character limit.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Provide a standalone application that my mom would find easy to use.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;I would also like to have the possibility of removing the last post for both Twitter and Identica, in case of a spelling mistake detected after sending the update for example.&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold;"&gt;II. Technical choices&lt;/span&gt;&lt;br /&gt;From using Padre, &lt;a href="http://wxperl.sourceforge.net/"&gt;wxPerl&lt;/a&gt; is already installed on my system in the form of the Wx module. I'll hence be using it (and it will help me understand the innards of Padre as a bonus).&lt;br /&gt;Other options for GUI librairies would be &lt;a href="http://search.cpan.org/%7Esrezic/Tk-804.028/"&gt;Tk&lt;/a&gt; and &lt;a href="http://perl-win32-gui.sourceforge.net/cgi-bin/index.cgi"&gt;Win32::GUI&lt;/a&gt; (the last one for Windows only obviously).&lt;br /&gt;&lt;br /&gt;To build the standalone application, I have &lt;a href="http://www.indigostar.com/perl2exe.htm"&gt;Perl2Exe&lt;/a&gt; in mind. However, I have not done much research on the subject yet. If you want to tell about your favorite choice in the comments section, I'll select from the list (or I might open a poll). Documention for the Wx module also mentions PAR and Perl2App.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;II. Design the UI&lt;/span&gt;&lt;br /&gt;Here's the list of needed elements:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Text box to enter up to 140 characters (2 lines of 70?)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;2 check boxes for twitter&lt;/li&gt;&lt;li&gt;2 check boxes for identica&lt;/li&gt;&lt;li&gt;1 "Send" button&lt;/li&gt;&lt;li&gt;1 "Delete Last" button&lt;/li&gt;&lt;li&gt;1 menu item to create/open login file&lt;/li&gt;&lt;/ul&gt;Let's try to lay it out in Paint first:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_-EghEXBgxV4/SdDzMddvTBI/AAAAAAAAADg/EkhuO17b3Jw/s1600-h/GUI1.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 214px;" src="http://3.bp.blogspot.com/_-EghEXBgxV4/SdDzMddvTBI/AAAAAAAAADg/EkhuO17b3Jw/s400/GUI1.jpg" alt="" id="BLOGGER_PHOTO_ID_5319018555317898258" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Errors will be displayed through message boxes.&lt;/li&gt;&lt;li&gt;In the Login menu, choices will be:&lt;br /&gt;- "Select Login File": window opens asking for file location. Default location used at start up.&lt;br /&gt;Parses selected file and displays error message if format not recognized.&lt;br /&gt;Stores login + password for whatever social website is recognized&lt;br /&gt;Back in the main form, Twitter and/or Identica boxes are greyed out if no login is found.&lt;br /&gt;No login/password encryption planned for the moment&lt;br /&gt;- "Edit Login File"   : window first pops up asking for login file location.&lt;br /&gt;Allows the login file to be edited from the application.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;The Twitter and Identi.ca boxes of the "Status" area will both be checked by default (if logins are provided)&lt;/li&gt;&lt;li&gt;Not sure how I'm going to implement the "Delete Last" functionality yet. There is a destroy_status() method in the Net::Twitter module. I'll have to read the doc.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;Reviewing the design, I am wondering about the double Twitter and Identica checkboxes. Wouldn't one set be enough? Unless each set is updated in parallel: setting the top (resp. bottom) Twitter box would also set the bottom (resp. top) Twitter box. What's your take on this?&lt;br /&gt;&lt;br /&gt;I'd like to use &lt;a href="http://en.wikipedia.org/wiki/Test_driven_development"&gt;Test Driven Development&lt;/a&gt; for this little project but I have no experience in either TDD or writing tests for Perl applications.&lt;br /&gt;&lt;br /&gt;For TDD, I know that you must first write a test, check that it fails, code so that the test succeeds then write the next test. Once some tests are written and pass, you can improve the program's code knowing that you have a test suite ready to check that all the features still work. That's about the extent of my knowledge on this subject but it sounds like fun :)&lt;br /&gt;&lt;br /&gt;Concerning the tests themselves, I've read through &lt;a href="http://www.modernperlbooks.com/mt/2009/03/organizing-test-suites-with-testclass.html"&gt;Modern Perl Book's recent posts on testing&lt;/a&gt; but it hasn't sunk in with me yet. I guess I'll have to start by looking into this.&lt;br /&gt;&lt;br /&gt;Larry Wall's quote of the day:&lt;br /&gt;"The whole intent of Perl 5's module system was to encourage the growth of Perl culture rather than the Perl core."&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;/br&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5699142825044889235-8224570575213297437?l=damienlearnsperl.blogspot.com'/&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Ils-N_JWwIVxAX5ROKxKGdaLDVQ/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Ils-N_JWwIVxAX5ROKxKGdaLDVQ/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Ils-N_JWwIVxAX5ROKxKGdaLDVQ/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Ils-N_JWwIVxAX5ROKxKGdaLDVQ/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=mGXZwGjR81o:Ysm-oS0bsbk:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?i=mGXZwGjR81o:Ysm-oS0bsbk:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=mGXZwGjR81o:Ysm-oS0bsbk:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?i=mGXZwGjR81o:Ysm-oS0bsbk:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=mGXZwGjR81o:Ysm-oS0bsbk:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=mGXZwGjR81o:Ysm-oS0bsbk:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DamienLearnsPerl/~4/mGXZwGjR81o" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://damienlearnsperl.blogspot.com/feeds/8224570575213297437/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://damienlearnsperl.blogspot.com/2009/03/wxperl-adding-gui-to-twitter-script_6211.html#comment-form" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5699142825044889235/posts/default/8224570575213297437?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5699142825044889235/posts/default/8224570575213297437?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/DamienLearnsPerl/~3/mGXZwGjR81o/wxperl-adding-gui-to-twitter-script_6211.html" title="wxPerl: adding a GUI to the twitter script (part 1)" /><author><name>Damien</name><uri>http://www.blogger.com/profile/07183471087108492840</uri><email>damienlearnsperl@gmx.com</email><gd:extendedProperty name="OpenSocialUserId" value="13321007406475916362" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/_-EghEXBgxV4/SdDzMddvTBI/AAAAAAAAADg/EkhuO17b3Jw/s72-c/GUI1.jpg" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">3</thr:total><feedburner:origLink>http://damienlearnsperl.blogspot.com/2009/03/wxperl-adding-gui-to-twitter-script_6211.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkEFQXY-cCp7ImA9WxJSFU0.&quot;"><id>tag:blogger.com,1999:blog-5699142825044889235.post-4443927458530484689</id><published>2009-03-23T22:01:00.011+01:00</published><updated>2009-05-05T07:16:50.858+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-05-05T07:16:50.858+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Larry Wall" /><category scheme="http://www.blogger.com/atom/ns#" term="CPAN" /><category scheme="http://www.blogger.com/atom/ns#" term="Damien Conway" /><category scheme="http://www.blogger.com/atom/ns#" term="Perl tools" /><title>Write better Perl with Perl::Critic</title><content type="html">I have recently discovered a simple-to-use &lt;a href="http://en.wikipedia.org/wiki/Static_code_analysis"&gt;static code analysis&lt;/a&gt; tool for Perl.&lt;br /&gt;It will examine your source file and list a series of warnings when it notices contructs that are different from the recommended practices.&lt;br /&gt;&lt;br /&gt;Let me present you the &lt;a href="http://search.cpan.org/%7Eelliotjs/Perl-Critic-1.098/lib/Perl/Critic.pm"&gt;Perl::Critic module&lt;/a&gt;, which allows the creation of a very simple script as described in the documentation.&lt;br /&gt;&lt;pre name="code" class="perl"&gt;use Modern::Perl;&lt;br /&gt;use Perl::Critic;&lt;br /&gt;&lt;br /&gt;die "No file name as argument\n" if (@ARGV == 0);&lt;br /&gt;my $file = $ARGV[0];&lt;br /&gt;&lt;br /&gt;my $critic = Perl::Critic-&gt;new();&lt;br /&gt;my @violations = $critic-&gt;critique($file);&lt;br /&gt;print @violations;&lt;/pre&gt;With this bit of code, you can check any Perl file for Policy violations within the program itself.&lt;br /&gt;&lt;br /&gt;If you name the above script critic.pl, you can also analyze external programs by typing "&lt;span style="font-family:courier new;"&gt;perl critic.pl AnyPerlFile.pl&lt;/span&gt;".&lt;br /&gt;However, as Chris pointed out in the comments section (thanks!), there is a simpler way: use the &lt;a href="http://search.cpan.org/%7Eelliotjs/Perl-Critic-1.098/bin/perlcritic"&gt;&lt;span style="font-family:courier new;"&gt;perlcritic &lt;/span&gt;command line interface&lt;/a&gt; provided with the Perl::Critic module.&lt;br /&gt;There are many available options to customize your analysis.&lt;br /&gt;&lt;br /&gt;You can apply any policy that you would like. The default is the one described in &lt;a href="http://oreilly.com/catalog/9780596001735/"&gt;Damian Conway's "Perl Best Practices"&lt;/a&gt; (PBP) book. A summary of all available policies on CPAN can be found &lt;a href="http://search.cpan.org/%7Eelliotjs/Perl-Critic-1.082/lib/Perl/Critic/PolicySummary.pod"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;There is actually an even better way to use the Perl::Critic tool than the command line: the &lt;a href="http://perlcritic.com/"&gt;perlcritic website&lt;/a&gt; where you can jump directly to the offending lines in your code. You are also able to click on links taking you to the PBP's page related to the warning being displayed!&lt;br /&gt;&lt;br /&gt;I find it a great way to learn good Perl programming tips with very little effort, as all the information is only one click away!&lt;br /&gt;&lt;br /&gt;[Edit] For more in-depth information about Perl::Critic, take a look at &lt;a href="http://perltraining.com.au/tips/2009-02-05.html"&gt;this article from Perl Training Australia&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Larry Wall quote of the day:&lt;br /&gt;"If someone stinks, view it as a reason to help them, not a reason to avoid them."&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5699142825044889235-4443927458530484689?l=damienlearnsperl.blogspot.com'/&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/_5Ef2smW8UZck7EQkA7k-wTSCDI/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/_5Ef2smW8UZck7EQkA7k-wTSCDI/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/_5Ef2smW8UZck7EQkA7k-wTSCDI/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/_5Ef2smW8UZck7EQkA7k-wTSCDI/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=Po2d9pP_ukI:q3xmElINNOM:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?i=Po2d9pP_ukI:q3xmElINNOM:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=Po2d9pP_ukI:q3xmElINNOM:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?i=Po2d9pP_ukI:q3xmElINNOM:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=Po2d9pP_ukI:q3xmElINNOM:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=Po2d9pP_ukI:q3xmElINNOM:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DamienLearnsPerl/~4/Po2d9pP_ukI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://damienlearnsperl.blogspot.com/feeds/4443927458530484689/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://damienlearnsperl.blogspot.com/2009/03/write-better-perl-with-perlcritic.html#comment-form" title="4 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5699142825044889235/posts/default/4443927458530484689?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5699142825044889235/posts/default/4443927458530484689?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/DamienLearnsPerl/~3/Po2d9pP_ukI/write-better-perl-with-perlcritic.html" title="Write better Perl with Perl::Critic" /><author><name>Damien</name><uri>http://www.blogger.com/profile/07183471087108492840</uri><email>damienlearnsperl@gmx.com</email><gd:extendedProperty name="OpenSocialUserId" value="13321007406475916362" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">4</thr:total><feedburner:origLink>http://damienlearnsperl.blogspot.com/2009/03/write-better-perl-with-perlcritic.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DU8FRHw-fyp7ImA9WxVUEk4.&quot;"><id>tag:blogger.com,1999:blog-5699142825044889235.post-1137077046143693412</id><published>2009-03-16T21:55:00.005+01:00</published><updated>2009-03-16T22:10:15.257+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-03-16T22:10:15.257+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Perl" /><category scheme="http://www.blogger.com/atom/ns#" term="Perl documentation" /><title>Plain Old Documentation (POD)</title><content type="html">Perl allows documentation to be integrated into your programs easily thanks to the &lt;a href="http://perldoc.perl.org/perlpod.html"&gt;Plain Old Documentation (POD) system&lt;/a&gt;.&lt;br /&gt;Most modules from CPAN can be parsed for comments and documentation using the &lt;span style="font-family:courier new;"&gt;perldoc &lt;span style="font-style: italic;"&gt;&lt;modulename&gt;&lt;/modulename&gt;&lt;/span&gt;&lt;/span&gt; command from the shell.&lt;br /&gt;For example, typing &lt;span style="font-family:courier new;"&gt;"perldoc Net::Twitter&lt;/span&gt;" will display information on the Twitter module (if installed). Perl will ignore Pod statements when parsing through the code.&lt;br /&gt;This is a convenient way to always find documentation related to a given program, as the program contains the user manual within itself.&lt;br /&gt;&lt;br /&gt;There are a few keywords to know, as well as basic principles.&lt;br /&gt;Here are the two most basic statements:&lt;br /&gt;&lt;pre name="code" class="perl:nogutter"&gt;=head1 TITLE&lt;br /&gt;&lt;br /&gt;Super duper comment here&lt;br /&gt;&lt;br /&gt;=cut&lt;/pre&gt;The Pod parser will behave differently if you write the text at the start of the line or if you type space or tab characters before.&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Ordinary paragraphs will reformat your text (such as wrapping, justifying, etc.). Start writing on the first column, like in the example above.&lt;/li&gt;&lt;li&gt;Verbatim paragraphs will not be reformated. The first character of the text should be a space or a tab.&lt;/li&gt;&lt;/ul&gt;I'll let you read more details on the &lt;a href="http://perldoc.perl.org/perlpod.html"&gt;perldoc page&lt;/a&gt;.&lt;br /&gt;Also, don't forget to add an empty line before and after each Pod command. Some parsers might get confused if you don't.&lt;br /&gt;Use C&amp;lt;text&amp;gt; when writing an example of code, F&amp;lt;text&amp;gt; for file names and B&amp;lt;text&amp;gt; for shell command names.&lt;br /&gt;&lt;br /&gt;The real cool thing about Pod is that you can sprinkle bits of comments all over the code.&lt;br /&gt;I have rewritten twit.pl to version 0.2.1 to follow &lt;a href="http://perldoc.perl.org/perlstyle.html"&gt;perlstyle rules&lt;/a&gt; (mainly renaming variables and functions) and to add Pod comments.&lt;br /&gt;&lt;br /&gt;The script can be found &lt;a href="http://sites.google.com/site/damienlearnsperl/DLP-scripts"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;As you will see, I have kept each part of the doc as close as possible to the relevant part of the code, such as in the first lines below:&lt;br /&gt;&lt;pre name="code" class="perl"&gt;&lt;br /&gt;#!/usr/bin/perl&lt;br /&gt;use Modern::Perl;&lt;br /&gt;&lt;br /&gt;=head1 NAME&lt;br /&gt;&lt;br /&gt;twit.pl - Script to update your status on twitter.com and/or identica&lt;br /&gt;&lt;br /&gt;=cut&lt;br /&gt;&lt;br /&gt;my $PROG_NAME = "twit.pl";&lt;br /&gt;&lt;br /&gt;=head1 VERSION&lt;br /&gt;&lt;br /&gt;This is version 0.2.1&lt;br /&gt;&lt;br /&gt;=cut&lt;br /&gt;&lt;br /&gt;my $VERSION   = "v0.2.1";&lt;br /&gt;my $version_date = "March 7th 2009";&lt;br /&gt;&lt;br /&gt;=head1 DEPENDENCIES&lt;br /&gt;&lt;br /&gt;Getopt::Long&lt;br /&gt;Net::Twitter&lt;br /&gt;&lt;br /&gt;=cut&lt;br /&gt;&lt;br /&gt;use Getopt::Long;   # To parse the command line&lt;br /&gt;use Net::Twitter;   # API to twitter.com and identi.ca&lt;/pre&gt;This makes it easy to update the doc when the code changes.&lt;br /&gt;Also, the &lt;span style="font-family:courier new;"&gt;get_help&lt;/span&gt; subroutine (the function formerly known as Help) has been rewritten to call the twit.pl script in a reentrant sort of way with the system command:&lt;pre name="code" class="perl:firstline[37]"&gt;sub get_help {&lt;br /&gt;system("perldoc $0"); # $0 contains the name of the file containing the Perl script being executed&lt;br /&gt;exit;&lt;br /&gt;} # End of get_help&lt;/pre&gt;Larry Wall quote of the day:&lt;br /&gt;"You have to admit that it's difficult to misplace the Perl sources.  :-) "&lt;br /&gt;&lt;text&gt;&lt;br /&gt;When using Pod, you can also include documentation in Larry's statement.&lt;br /&gt;&lt;br /&gt;&lt;/text&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5699142825044889235-1137077046143693412?l=damienlearnsperl.blogspot.com'/&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/TWN7059S6lllGEpVPQHRqhidvkA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/TWN7059S6lllGEpVPQHRqhidvkA/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/TWN7059S6lllGEpVPQHRqhidvkA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/TWN7059S6lllGEpVPQHRqhidvkA/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=3sMnwbFknIo:slm2TeixpTY:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?i=3sMnwbFknIo:slm2TeixpTY:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=3sMnwbFknIo:slm2TeixpTY:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?i=3sMnwbFknIo:slm2TeixpTY:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=3sMnwbFknIo:slm2TeixpTY:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=3sMnwbFknIo:slm2TeixpTY:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DamienLearnsPerl/~4/3sMnwbFknIo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://damienlearnsperl.blogspot.com/feeds/1137077046143693412/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://damienlearnsperl.blogspot.com/2009/03/plain-old-documentation-pod.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5699142825044889235/posts/default/1137077046143693412?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5699142825044889235/posts/default/1137077046143693412?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/DamienLearnsPerl/~3/3sMnwbFknIo/plain-old-documentation-pod.html" title="Plain Old Documentation (POD)" /><author><name>Damien</name><uri>http://www.blogger.com/profile/07183471087108492840</uri><email>damienlearnsperl@gmx.com</email><gd:extendedProperty name="OpenSocialUserId" value="13321007406475916362" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://damienlearnsperl.blogspot.com/2009/03/plain-old-documentation-pod.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkQARHYzeSp7ImA9WxVVF08.&quot;"><id>tag:blogger.com,1999:blog-5699142825044889235.post-6320607660659584504</id><published>2009-03-10T20:58:00.006+01:00</published><updated>2009-03-10T22:25:45.881+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-03-10T22:25:45.881+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Perl" /><category scheme="http://www.blogger.com/atom/ns#" term="Damien Conway" /><title>Perl naming convention for subroutine names</title><content type="html">&lt;span style="font-weight: bold;"&gt;Disclaimer&lt;/span&gt;&lt;br /&gt;Welcome to all readers of Perlsphere. Mine is a blog of little pretention where I narrate my personal experience with learning Perl. As such, the code that can be found in DamienLearnsPerl's pages should be taken with a grain of salt as it might be inaccurate (oops). I am calling upon the understanding and experience of more proficient Perl users to point out those mistakes or suggest better and more "perlish" ways to program.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Perl Naming Conventions&lt;/span&gt;&lt;br /&gt;For example, &lt;a href="http://damienlearnsperl.blogspot.com/2009/02/improving-twit-perl-script.html"&gt;my last post about the twitter script&lt;/a&gt; triggered an interesting comment today.&lt;br /&gt;&lt;dl id="comments-block"&gt;&lt;blockquote&gt;&lt;dt class="comment-author anon-comment-icon" id="c775845515498105372"&gt;Anonymous said... &lt;/dt&gt;&lt;dd class="comment-body"&gt; &lt;p&gt;Some new Perl culture for you to learn: subroutine names that are AllSquishedTogether() are frowned upon. The convention is names_like_this() - lowercase, with underscores separating words.&lt;/p&gt;&lt;/dd&gt;&lt;/blockquote&gt;&lt;/dl&gt;My first reaction was: "As long as I am using a way to name variables and methods that is coherent throughout the program, why couldn't I CapitalizeAndSquish as I please?"&lt;br /&gt;Then I got to think: "Well, I guess that would be alright if I was the only person maintaining the script. But what would happen on projects where several developers contribute to the code? There would need to exist a common naming convention, so that the code doesn't look like a patchwork of different tabulation and personal formatting standards..."&lt;br /&gt;&lt;br /&gt;So, tickled by Anonymous' remark, I embarked upon a Google trip to uncover documented Perl naming conventions...&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;The first tip I found was from &lt;a href="http://www.webreference.com/programming/perl/subroutines/"&gt;webreference.com&lt;/a&gt;:&lt;br /&gt;&lt;blockquote&gt;When selecting names for your general subroutines, it's recommended that you use all lower case names; since, by convention, subroutine names with all capital letters indicate actions that are triggered automatically as needed by Perl; such as &lt;code&gt;AUTOLOAD&lt;/code&gt; or &lt;code&gt;DESTROY&lt;/code&gt;, and mixed case names are often utilized as package names. [...] keep your user-defined subroutine names to all lower case and you'll avoid this ambiguity in the future.&lt;/blockquote&gt;There is more or less the same description from &lt;span style="font-family:courier new;"&gt;perldoc perlsub&lt;/span&gt;:&lt;br /&gt;&lt;blockquote&gt;Subroutines whose names are in all upper case are reserved to the Perl core, as are modules whose names are in all lower case. A subroutine in all capitals is a loosely-held convention meaning it will be called indirectly by the run-time system itself, usually due to a triggered event. Subroutines that do special, pre-defined things include "AUTOLOAD", "CLONE", "DESTROY" plus all functions mentioned in perltie and PerlIO::via.&lt;/blockquote&gt;The Camel book also adds that all upper case subs could be used for constants.&lt;br /&gt;&lt;br /&gt;However, I also found this tutorials:&lt;br /&gt;- &lt;a href="http://www.ebb.org/PickingUpPerl/pickingUpPerl_8.html#SEC80"&gt;Picking Up Perl&lt;/a&gt; (granted, it's from 2001), where they show an example of a subroutine called HowdyEveryone{}&lt;br /&gt;&lt;br /&gt;I continued my journey and stumbled upon the &lt;a href="http://search.cpan.org/%7Eelliotjs/Perl-Critic-1.097_002/lib/Perl/Critic/Policy/NamingConventions/Capitalization.pm"&gt;Perl::Critic::Policy::NamingConventions::Capitalization&lt;/a&gt; and &lt;a href="http://search.cpan.org/%7Ethaljef/Perl-Critic-1.092/lib/Perl/Critic/Policy/NamingConventions/ProhibitMixedCaseSubs.pm"&gt;Perl::Critic::Policy::NamingConventions::ProhibitMixedCaseSubs&lt;/a&gt;    modules on CPAN. They are both based upon recommendations from Damian Conway's book &lt;b&gt;Perl Best Practices &lt;/b&gt;and enforce the all-lower-case-naming policy for subroutines.&lt;br /&gt;&lt;br /&gt;But the piece of information I found most useful was definitely &lt;a href="http://search.cpan.org/%7Enwclark/perl-5.8.9/pod/perlstyle.pod"&gt;perlstyle&lt;/a&gt;, the Perl style guide. There can be found a list of recommendations to make your Perl program easier to maintain and understand. Abstract:&lt;br /&gt;&lt;ul&gt;&lt;blockquote&gt;&lt;li&gt;While short identifiers like &lt;code&gt;$gotit&lt;/code&gt; are probably ok, use underscores to separate words in longer identifiers. It is generally easier to read &lt;code&gt;$var_names_like_this&lt;/code&gt; than &lt;code&gt;$VarNamesLikeThis&lt;/code&gt;, especially for non-native speakers of English. It's also a simple rule that works consistently with &lt;code&gt;VAR_NAMES_LIKE_THIS&lt;/code&gt;.&lt;/li&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;li&gt;Function and method names seem to work best as all lowercase. E.g., &lt;code&gt;$obj-&gt;as_string()&lt;/code&gt;.  &lt;p&gt;You can use a leading underscore to indicate that a variable or function should not be used outside the package that defined it.&lt;/p&gt;&lt;/li&gt;&lt;/blockquote&gt;&lt;/ul&gt;I will therefore try to follow the following guidelines:&lt;br /&gt;- ALL CAPS: automatically triggered subroutines and constants&lt;br /&gt;- Mixed Case: package names&lt;br /&gt;- lower case with words separated by underscores: variables and user-defined subroutines&lt;br /&gt;- lower case starting with a "_": internal function/variable&lt;br /&gt;&lt;br /&gt;What about you? What do you take as reference for naming conventions? Do you use different standards than those described in perltype?&lt;br /&gt;&lt;br&gt;&lt;br&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5699142825044889235-6320607660659584504?l=damienlearnsperl.blogspot.com'/&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/pHUA9IWUxhnbM5qMSohBOjx5Tx4/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/pHUA9IWUxhnbM5qMSohBOjx5Tx4/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/pHUA9IWUxhnbM5qMSohBOjx5Tx4/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/pHUA9IWUxhnbM5qMSohBOjx5Tx4/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=S2UaFuOZdIU:-EmdyEeNwEI:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?i=S2UaFuOZdIU:-EmdyEeNwEI:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=S2UaFuOZdIU:-EmdyEeNwEI:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?i=S2UaFuOZdIU:-EmdyEeNwEI:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=S2UaFuOZdIU:-EmdyEeNwEI:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=S2UaFuOZdIU:-EmdyEeNwEI:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DamienLearnsPerl/~4/S2UaFuOZdIU" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://damienlearnsperl.blogspot.com/feeds/6320607660659584504/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://damienlearnsperl.blogspot.com/2009/03/perl-naming-convention-for-subroutine.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5699142825044889235/posts/default/6320607660659584504?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5699142825044889235/posts/default/6320607660659584504?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/DamienLearnsPerl/~3/S2UaFuOZdIU/perl-naming-convention-for-subroutine.html" title="Perl naming convention for subroutine names" /><author><name>Damien</name><uri>http://www.blogger.com/profile/07183471087108492840</uri><email>damienlearnsperl@gmx.com</email><gd:extendedProperty name="OpenSocialUserId" value="13321007406475916362" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total><feedburner:origLink>http://damienlearnsperl.blogspot.com/2009/03/perl-naming-convention-for-subroutine.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUcCRXY9eyp7ImA9WxVVFE4.&quot;"><id>tag:blogger.com,1999:blog-5699142825044889235.post-2280729201736925273</id><published>2009-03-07T10:22:00.012+01:00</published><updated>2009-03-07T15:44:24.863+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-03-07T15:44:24.863+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Larry Wall" /><category scheme="http://www.blogger.com/atom/ns#" term="CPAN" /><category scheme="http://www.blogger.com/atom/ns#" term="Padre" /><category scheme="http://www.blogger.com/atom/ns#" term="Twitter" /><title>CPAN module updates</title><content type="html">&lt;span style="font-weight: bold;"&gt;CPAN goodness&lt;/span&gt;&lt;br /&gt;In the &lt;a href="http://damienlearnsperl.blogspot.com/2009/02/how-to-post-in-both-twitter-and.html"&gt;CPAN shell&lt;/a&gt;, if you type '&lt;span style="font-family:courier new;"&gt;h&lt;/span&gt;' you will get a compact help menu.&lt;br /&gt;I was wondering if it was possible to list all the modules on your system that have an update available on CPAN. After a few Google searches, it turned out that the answer was already in the help menu:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;Upgrade r        WORDs or /REGEXP/ or NONE    report updates for some/matching/all modules&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I initially did type "&lt;span style="font-family:courier new;"&gt;cpan&gt; &lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-family:courier new;"&gt;r&lt;/span&gt;"&lt;/span&gt; but nothing visible was happening and I interrupted the command. It actually takes more than a few seconds to list them all, I guess it depends on the number of installed modules on your system. An indicator showing that the process is alive would be nice to have. More patience would be nice to have also (on my side). Here's what the report gave on my system (click to enlarge):&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_-EghEXBgxV4/SbJAVLLpeLI/AAAAAAAAADI/HykZ--tliRQ/s1600-h/cpan1.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 360px; height: 400px;" src="http://2.bp.blogspot.com/_-EghEXBgxV4/SbJAVLLpeLI/AAAAAAAAADI/HykZ--tliRQ/s400/cpan1.jpg" alt="" id="BLOGGER_PHOTO_ID_5310377643146311858" border="0" /&gt;&lt;/a&gt;This is how I noticed that the &lt;a href="http://search.cpan.org/dist/Net-Twitter/lib/Net/Twitter.pm"&gt;Net::Twitter&lt;/a&gt; module had been bumped to version 2.10 from 2.06.&lt;br /&gt;The change log can be found &lt;a href="http://github.com/ct/net-twitter/blob/35f1e051b331aa037e90686c9e4bdd993e97f5d2/Changes"&gt;here&lt;/a&gt;.&lt;br /&gt;I typed "&lt;span style="font-family:courier new;"&gt;upgrade Net::Twitter&lt;/span&gt;" in the cpan shell and I was set.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Padre v0.28&lt;/span&gt;&lt;br /&gt;Trying to upgrade Padre (&lt;a href="http://padre.perlide.org/browser/tags/Padre-0.28/Changes?rev=3176"&gt;change log for Padre version 0.28&lt;/a&gt;) using "&lt;span style="font-family:courier new;"&gt;upgrade Padre&lt;/span&gt;" was a failure.&lt;br /&gt;I had to pull out the "&lt;span style="font-family:courier new;"&gt;force install Padre&lt;/span&gt;" command. I'll have to investigate if the problem still happens for next release. Maybe there's something wrong with my setup.&lt;br /&gt;&lt;br /&gt;Larry Wall quote of the day:&lt;span style="font-style: italic;"&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;"&lt;/span&gt;What is the sound of Perl? Is it not the sound of a wall that people have stopped banging their heads against?"&lt;/span&gt;&lt;br /&gt;&lt;br&gt;&lt;br&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5699142825044889235-2280729201736925273?l=damienlearnsperl.blogspot.com'/&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/b3o9ncv0CM31FyGSS9qvVgFJimQ/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/b3o9ncv0CM31FyGSS9qvVgFJimQ/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/b3o9ncv0CM31FyGSS9qvVgFJimQ/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/b3o9ncv0CM31FyGSS9qvVgFJimQ/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=LbNaDR65A0s:bWQdYLuAYko:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?i=LbNaDR65A0s:bWQdYLuAYko:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=LbNaDR65A0s:bWQdYLuAYko:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?i=LbNaDR65A0s:bWQdYLuAYko:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=LbNaDR65A0s:bWQdYLuAYko:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=LbNaDR65A0s:bWQdYLuAYko:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DamienLearnsPerl/~4/LbNaDR65A0s" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://damienlearnsperl.blogspot.com/feeds/2280729201736925273/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://damienlearnsperl.blogspot.com/2009/03/cpan-module-updates.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5699142825044889235/posts/default/2280729201736925273?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5699142825044889235/posts/default/2280729201736925273?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/DamienLearnsPerl/~3/LbNaDR65A0s/cpan-module-updates.html" title="CPAN module updates" /><author><name>Damien</name><uri>http://www.blogger.com/profile/07183471087108492840</uri><email>damienlearnsperl@gmx.com</email><gd:extendedProperty name="OpenSocialUserId" value="13321007406475916362" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/_-EghEXBgxV4/SbJAVLLpeLI/AAAAAAAAADI/HykZ--tliRQ/s72-c/cpan1.jpg" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total><feedburner:origLink>http://damienlearnsperl.blogspot.com/2009/03/cpan-module-updates.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0MGRnY7cCp7ImA9WxVVEkU.&quot;"><id>tag:blogger.com,1999:blog-5699142825044889235.post-6736674365552034931</id><published>2009-03-04T18:05:00.004+01:00</published><updated>2009-03-05T21:37:07.808+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-03-05T21:37:07.808+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Perl" /><category scheme="http://www.blogger.com/atom/ns#" term="Larry Wall" /><category scheme="http://www.blogger.com/atom/ns#" term="chromatic" /><category scheme="http://www.blogger.com/atom/ns#" term="Padre" /><category scheme="http://www.blogger.com/atom/ns#" term="Modern Perl" /><title>Using the Modern::Perl module</title><content type="html">I recently had a warning in the GUI version of twit.pl (work in progress):&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;v-string in use/require non-portable at C:\Perl\usr\Blog\twit_1_0_0.pl line 73&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The incriminated line 73 was:&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;use 5.10.0;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I googled the error string and &lt;a href="http://www.nntp.perl.org/group/perl.perl5.porters/2007/10/msg130062.html"&gt;Tom Wyant's ticket on Perl&lt;/a&gt; came up. It helped me understand the issue at hand and how to fix it.&lt;br /&gt;However, for more in-depth information, I pushed my way to &lt;a href="http://perldoc.perl.org/perldata.html#Scalar-value-constructors"&gt;perldoc.perl.org&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;v-string refers to a version string: be warned, the version strings have ben deprecated since Perl 5.8.1 and this is why you will get a warning.&lt;br /&gt;Version strings start with a "v" (example: v1.0). Strings that have 2 decimal points (eg. v1.0.0) are automatically considered as version strings.&lt;br /&gt;&lt;br /&gt;In Perl, you can use underscores in numeric values between digits to make them easier to read.&lt;br /&gt;For example, 1200.0053 can be represented as 1_200.00_53.&lt;br /&gt;&lt;br /&gt;To remove the v-string warning, I replaced the line&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;use 5.10.0;&lt;br /&gt;by&lt;br /&gt;&lt;/span&gt;    &lt;span style="font-family:courier new;"&gt;use 5.010_000;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;(&lt;span style="font-family:courier new;"&gt;use&lt;/span&gt; &lt;span style="font-family:courier new;"&gt;5.010&lt;/span&gt; also works but not &lt;span style="font-family:courier new;"&gt;use 5.10&lt;/span&gt;: the Perl compiler will look for version 5.100)&lt;br /&gt;&lt;br /&gt;Or you can also use the Modern::Perl module written by chromatic.&lt;br /&gt;Among other things, Modern::Perl will include the following pragmas:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;use 5.010_000;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;use strict;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;use warnings;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In order to install the module from Padre, all is required is that you go to:&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;Perl&gt;Install Module...&gt;Install CPAN Module&lt;/span&gt;&lt;br /&gt;You will see the window below:&lt;br /&gt;&lt;span style="text-decoration: underline;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_-EghEXBgxV4/Sapy18DY-SI/AAAAAAAAADA/LgY0reoTObY/s1600-h/ModernPerl1.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 346px; height: 158px;" src="http://4.bp.blogspot.com/_-EghEXBgxV4/Sapy18DY-SI/AAAAAAAAADA/LgY0reoTObY/s400/ModernPerl1.jpg" alt="" id="BLOGGER_PHOTO_ID_5308181381788530978" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Enter&lt;span style="color: rgb(102, 102, 102);"&gt; &lt;span style="color: rgb(255, 255, 204);"&gt;Modern::Perl&lt;/span&gt; &lt;/span&gt;and let CPAN work its magic!&lt;br /&gt;&lt;br /&gt;Larry Wall quote of the day:&lt;br /&gt;&lt;span class="body"&gt;"&lt;/span&gt;Perl itself is usually pretty good about telling you what you shouldn't do."&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Possible next posts:&lt;/span&gt;&lt;br /&gt;&lt;ul style="font-style: italic;"&gt;&lt;li&gt;Perl template - Part II: Adding Help and Version procedures&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Perl help resources&lt;/li&gt;&lt;li&gt;Improving on twit.pl: Graphical User interface&lt;br /&gt;&lt;/li&gt;&lt;li&gt;POD&lt;/li&gt;&lt;li&gt;Install Google Analytics on your Blogger blog and stats for DLP&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5699142825044889235-6736674365552034931?l=damienlearnsperl.blogspot.com'/&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/vgPfes_4mpFlzgUwfGdLdJwxqVQ/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/vgPfes_4mpFlzgUwfGdLdJwxqVQ/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/vgPfes_4mpFlzgUwfGdLdJwxqVQ/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/vgPfes_4mpFlzgUwfGdLdJwxqVQ/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=hDTS2IgvqaM:BS0NQ956DdQ:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?i=hDTS2IgvqaM:BS0NQ956DdQ:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=hDTS2IgvqaM:BS0NQ956DdQ:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?i=hDTS2IgvqaM:BS0NQ956DdQ:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=hDTS2IgvqaM:BS0NQ956DdQ:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=hDTS2IgvqaM:BS0NQ956DdQ:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DamienLearnsPerl/~4/hDTS2IgvqaM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://damienlearnsperl.blogspot.com/feeds/6736674365552034931/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://damienlearnsperl.blogspot.com/2009/03/using-modernperl-module.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5699142825044889235/posts/default/6736674365552034931?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5699142825044889235/posts/default/6736674365552034931?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/DamienLearnsPerl/~3/hDTS2IgvqaM/using-modernperl-module.html" title="Using the Modern::Perl module" /><author><name>Damien</name><uri>http://www.blogger.com/profile/07183471087108492840</uri><email>damienlearnsperl@gmx.com</email><gd:extendedProperty name="OpenSocialUserId" value="13321007406475916362" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_-EghEXBgxV4/Sapy18DY-SI/AAAAAAAAADA/LgY0reoTObY/s72-c/ModernPerl1.jpg" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://damienlearnsperl.blogspot.com/2009/03/using-modernperl-module.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0MBQ3Y7eyp7ImA9WxVVEUw.&quot;"><id>tag:blogger.com,1999:blog-5699142825044889235.post-8331671696706608375</id><published>2009-03-03T22:03:00.006+01:00</published><updated>2009-03-03T22:24:12.803+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-03-03T22:24:12.803+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="blogging" /><category scheme="http://www.blogger.com/atom/ns#" term="Google" /><category scheme="http://www.blogger.com/atom/ns#" term="general" /><title>New colors</title><content type="html">That white background was just frying my eye balls out, especially late at night!&lt;br /&gt;Let it not be said that I don't take care of my readers' health. It is not &lt;a href="http://www.blackle.com/"&gt;Blackle&lt;/a&gt; yet but it is an improvement for sensitive eyes (I think... except if my new choice of colors makes you sick...).&lt;br /&gt;&lt;BR&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5699142825044889235-8331671696706608375?l=damienlearnsperl.blogspot.com'/&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/FkshpJYxfrIrnnMEJF0nHLV6EyY/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/FkshpJYxfrIrnnMEJF0nHLV6EyY/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/FkshpJYxfrIrnnMEJF0nHLV6EyY/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/FkshpJYxfrIrnnMEJF0nHLV6EyY/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=1BAXvGCO5Us:Kpx5DdKrRmk:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?i=1BAXvGCO5Us:Kpx5DdKrRmk:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=1BAXvGCO5Us:Kpx5DdKrRmk:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?i=1BAXvGCO5Us:Kpx5DdKrRmk:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=1BAXvGCO5Us:Kpx5DdKrRmk:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=1BAXvGCO5Us:Kpx5DdKrRmk:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DamienLearnsPerl/~4/1BAXvGCO5Us" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://damienlearnsperl.blogspot.com/feeds/8331671696706608375/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://damienlearnsperl.blogspot.com/2009/03/new-layout-for-damien-learns-perl.html#comment-form" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5699142825044889235/posts/default/8331671696706608375?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5699142825044889235/posts/default/8331671696706608375?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/DamienLearnsPerl/~3/1BAXvGCO5Us/new-layout-for-damien-learns-perl.html" title="New colors" /><author><name>Damien</name><uri>http://www.blogger.com/profile/07183471087108492840</uri><email>damienlearnsperl@gmx.com</email><gd:extendedProperty name="OpenSocialUserId" value="13321007406475916362" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">3</thr:total><feedburner:origLink>http://damienlearnsperl.blogspot.com/2009/03/new-layout-for-damien-learns-perl.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DE4ER3o9cCp7ImA9WxVWGEw.&quot;"><id>tag:blogger.com,1999:blog-5699142825044889235.post-1301301358762630342</id><published>2009-02-28T09:59:00.003+01:00</published><updated>2009-02-28T11:28:26.468+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-02-28T11:28:26.468+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Perl" /><category scheme="http://www.blogger.com/atom/ns#" term="Larry Wall" /><category scheme="http://www.blogger.com/atom/ns#" term="programming" /><category scheme="http://www.blogger.com/atom/ns#" term="Twitter" /><title>Improving the twit perl script</title><content type="html">As I spent some time on twit.pl v0.2.0, I also tried to improve on the Perl template for new scripts.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;New Perl that I learned&lt;br /&gt;&lt;/span&gt;Today, I'll try to explain the new concepts first&lt;span style="font-weight: bold;"&gt; &lt;/span&gt;and then show the code&lt;span style="font-weight: bold;"&gt;.&lt;/span&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;"&lt;span style="font-family:courier new;"&gt;$0&lt;/span&gt;": This is dollar-zero. It is a special Perl variable to indicate the name of the file containing the perl script being executed&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:courier new;"&gt;&lt;/span&gt; The x operator repeats a string pattern.&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;print "*" x 10&lt;/span&gt;;&lt;span style="font-family:courier new;"&gt; &lt;/span&gt;and &lt;span style="font-family:courier new;"&gt;print "**********"&lt;/span&gt;;&lt;span style="font-family:courier new;"&gt; &lt;/span&gt;are equivalent&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:courier new;"&gt;defined &lt;/span&gt;will return false if a variable is undef and true if it has a value.&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:courier new;"&gt;@ARGV&lt;/span&gt; is a reserved Perl array that contains the list of arguments passed on the command line.&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;Help if (@ARGV == 0);&lt;/span&gt; will call the Help subroutine if the list of arguments is empty, i.e. if you just type "&lt;span style="font-family:courier new;"&gt;perl twit.pl&lt;/span&gt;" at the command line.&lt;br /&gt;Note that checking &lt;span style="font-family:courier new;"&gt;@ARGV&lt;/span&gt; must be performed before the call to GetOptions which will empty the argument list.&lt;/li&gt;&lt;li&gt;You can tell the GetOption procedure to directly call a subroutine when a specific argument is passed at the command line. See for example &lt;span style="font-family:courier new;"&gt;"version" =&gt; \&amp;amp;Version&lt;/span&gt;. When -v or --version is added after the script name, you will see the version number of the script and exit the program.&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold;"&gt;twit_0_2_0.pl&lt;/span&gt;&lt;br /&gt;&lt;span&gt;To use version&lt;/span&gt;&lt;span&gt; 0.2.0, you have to add -t (for twitter), -i (for identica) or -a (for both, also works if you choose -t -i)&lt;/span&gt;&lt;span&gt; to the command line.&lt;/span&gt;&lt;br /&gt;&lt;pre name="code" class="perl"&gt;&lt;br /&gt;#!/usr/bin/perl&lt;br /&gt;use 5.10.0;         # To be able to use "say" function&lt;br /&gt;use strict;         # Pragma to add restrictions to Perl rules&lt;br /&gt;use warnings;       # Pragma to add warnings at compile and run-time&lt;br /&gt;use Getopt::Long;   # To parse the command line&lt;br /&gt;use Net::Twitter;   # API to twitter.com and identi.ca&lt;br /&gt;&lt;br /&gt;my $PROG_NAME = $0; # $0 contains the name of the file containing the Perl script being executed&lt;br /&gt;my $VERSION   = "v0.2.0";&lt;br /&gt;my $VersionDate = "February 21st 2009";&lt;br /&gt;&lt;br /&gt;# ------------------------------------------------------------------------------&lt;br /&gt;# Name    : Help&lt;br /&gt;# Comment : displays list of available options&lt;br /&gt;# Input   : no argument to command line or "-h" or "--help"&lt;br /&gt;# Output  : help screen and exit program&lt;br /&gt;# ------------------------------------------------------------------------------&lt;br /&gt;sub Help {&lt;br /&gt;    print " &lt;br /&gt;    Usage:&lt;br /&gt;        perl $PROG_NAME [-options]        &lt;br /&gt;&lt;br /&gt;    Options:&lt;br /&gt;     -a, --all      : send message to all supported macroblogging sites&lt;br /&gt;     -f, --file     : file containing the login information for each site&lt;br /&gt;     -h, --help     : this help screen&lt;br /&gt;     -i, --identica : send message to identi.ca&lt;br /&gt;     -s, --status   : status (message) to send&lt;br /&gt;     -t, --twitter  : send message to twitter.com&lt;br /&gt;     -v, --version  : displays version information&lt;br /&gt;            &lt;br /&gt;    $PROG_NAME help&lt;br /&gt;    ";&lt;br /&gt;    print "-" x (length ($PROG_NAME) + 5);&lt;br /&gt;    print "&lt;br /&gt;    $PROG_NAME sends a status update to either twitter.com or identi.ca (or both) from the command line.&lt;br /&gt;    If -t is specified (for example), it will send the update to twitter.com.&lt;br /&gt;    If -a is passed, then your status on both twitter and identica will be updated.&lt;br /&gt;&lt;br /&gt;    Format of login files&lt;br /&gt;    ---------------------&lt;br /&gt;    $PROG_NAME will first try to find \"twit.txt\" located in the current directory.&lt;br /&gt;    You can also use the --file option to tell $PROG_NAME where to find your login information.&lt;br /&gt;     - Lines starting with '#' are comments and will be ignored by the script&lt;br /&gt;     - The last line starting with \"Twitter\" will be parsed for username and password. &lt;br /&gt;       Each of these fields must be separated by a semi-column ':'&lt;br /&gt;     - Same thing with \"Identica\"&lt;br /&gt;        &lt;br /&gt;    Examples:&lt;br /&gt;    ---------&lt;br /&gt;     - perl twit.pl -s \"Using Padre on Linux\" -f \"~/secretstuff/mytwitterpassword.txt\" -a&lt;br /&gt;        Updates both twitter and identica status with login info from specified file&lt;br /&gt;     - perl twit.pl -s \"This is Vistaaaaaa\" -i&lt;br /&gt;        Updates identica status only&lt;br /&gt;&lt;br /&gt;    $PROG_NAME uses the following modules:&lt;br /&gt;     - Getopt::Long&lt;br /&gt;     - Net::Twitter&lt;br /&gt;    ";&lt;br /&gt;    exit;&lt;br /&gt;} # End of Help&lt;br /&gt;&lt;br /&gt;# ------------------------------------------------------------------------------&lt;br /&gt;# Name    : version&lt;br /&gt;# Comment : displays script's version number&lt;br /&gt;# Input   : --&lt;br /&gt;# Output  : version number screen and exit program&lt;br /&gt;# ------------------------------------------------------------------------------&lt;br /&gt;sub Version {&lt;br /&gt;    print "&lt;br /&gt;    $PROG_NAME version: $VERSION&lt;br /&gt;    Date  : $VersionDate&lt;br /&gt;    Author: dlp&lt;br /&gt;        &lt;br /&gt;    Get the latest version from here:&lt;br /&gt;    http://sites.google.com/site/damienlearnsperl/DLP-scripts&lt;br /&gt;    ";&lt;br /&gt;    exit;&lt;br /&gt;} # end of Version&lt;br /&gt;&lt;br /&gt;# ------------------------------------------------------------------------------&lt;br /&gt;# Name    : CreateObject&lt;br /&gt;# Comment : Creates and returns an instance of the Net::Twitter class&lt;br /&gt;# Input   : - Input string with value&lt;br /&gt;#               "twitter" -&gt; twitter.com instance&lt;br /&gt;#               "identica" -&gt; identi.ca instance&lt;br /&gt;#               all other values return an error&lt;br /&gt;#           - Hash with "UserName" and "Password"&lt;br /&gt;# Output  : Object newly created or 0 if error&lt;br /&gt;# ------------------------------------------------------------------------------&lt;br /&gt;sub CreateObject {&lt;br /&gt;    my $SiteInstance = 0;&lt;br /&gt;    my $NameString = shift;&lt;br /&gt;    my %Login = @_;&lt;br /&gt;&lt;br /&gt;    $NameString =~ tr/A-Z/a-z/;&lt;br /&gt;    if ($NameString eq "twitter") {&lt;br /&gt;        $SiteInstance = Net::Twitter-&gt;new(username =&gt; $Login{"UserName"}, password =&gt; $Login{"Password"});&lt;br /&gt;    }&lt;br /&gt;    elsif ($NameString eq "identica") {&lt;br /&gt;        $SiteInstance = Net::Twitter-&gt;new(identica =&gt; 1, username =&gt; $Login{"UserName"}, password =&gt; $Login{"Password"});&lt;br /&gt;    }&lt;br /&gt;    return $SiteInstance;&lt;br /&gt;} # End of CreateObject&lt;br /&gt;&lt;br /&gt;# ------------------------------------------------------------------------------&lt;br /&gt;# Name    : SendUpdate&lt;br /&gt;# Comment : Sends update to Twitter object&lt;br /&gt;# Input   : - Net::Twitter object&lt;br /&gt;#           - message string&lt;br /&gt;# Output  : string "OK" if successful update, string "FAIL" otherwise&lt;br /&gt;# ------------------------------------------------------------------------------&lt;br /&gt;sub SendUpdate {&lt;br /&gt;    my $Site = shift;&lt;br /&gt;    my $Message = shift;&lt;br /&gt;    my $SiteName = ($Site-&gt;{identica})?"identi.ca":"twitter.com";&lt;br /&gt;&lt;br /&gt;    #There's a hard limit on the size of twits for both twitter and identica&lt;br /&gt;    if (!defined $Message) {&lt;br /&gt;        return "$SiteName update: FAILED (no message)";&lt;br /&gt;    }&lt;br /&gt;    if (length $Message &gt; 140) {&lt;br /&gt;        return "$SiteName update: FAILED (message over 140 characters)";&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    if ($Site-&gt;update($Message)) {&lt;br /&gt;        return "$SiteName update: OK";&lt;br /&gt;    }&lt;br /&gt;    else {&lt;br /&gt;        return "$SiteName update: FAIL";&lt;br /&gt;    }&lt;br /&gt;} #End of SendUpdate&lt;br /&gt;&lt;br /&gt;# ------------------------------------------------------------------------------&lt;br /&gt;# Name    : SendMessage&lt;br /&gt;# Comment : Sends message to chosen macroblogging site&lt;br /&gt;# Input   : $_[0] = Input string with value&lt;br /&gt;#               "twitter" -&gt; twitter.com instance&lt;br /&gt;#               "identica" -&gt; identi.ca instance&lt;br /&gt;#           $_[1] = Message string to be sent&lt;br /&gt;#           $_[2] = Hash with "UserName" and "Password" elements&lt;br /&gt;# Output  : Return string: "Error" if couldn't create object or string from SendUpdate&lt;br /&gt;# ------------------------------------------------------------------------------&lt;br /&gt;sub SendMessage {&lt;br /&gt;    my $ReturnString;&lt;br /&gt;    my $Instance;&lt;br /&gt;    my ($SiteName, $Message, %Login) = @_;&lt;br /&gt;&lt;br /&gt;    $Instance = CreateObject($SiteName, %Login);&lt;br /&gt;    if ($Instance) {&lt;br /&gt;        $ReturnString = SendUpdate($Instance, $Message);&lt;br /&gt;    }&lt;br /&gt;    else {&lt;br /&gt;        $ReturnString = "Error with $SiteName creation process";&lt;br /&gt;    }&lt;br /&gt;    return $ReturnString;&lt;br /&gt;} #End of SendMessage&lt;br /&gt;&lt;br /&gt;# ------------------------------------------------------------------------------&lt;br /&gt;# Main&lt;br /&gt;# ------------------------------------------------------------------------------&lt;br /&gt;my $Status;&lt;br /&gt;my $PasswordFile;&lt;br /&gt;my %TwitLogin;&lt;br /&gt;my %IdenticaLogin;&lt;br /&gt;my $TwitterUse;  # 1-&gt; send to twitter, 0 -&gt; do not send&lt;br /&gt;my $IdenticaUse; # 1-&gt; send to identica, 0 -&gt; do not send&lt;br /&gt;&lt;br /&gt;Help if (@ARGV == 0);&lt;br /&gt;&lt;br /&gt;#Parse command line arguments&lt;br /&gt;GetOptions ("all" =&gt; sub {$TwitterUse = 1; $IdenticaUse = 1},&lt;br /&gt;            "status=s" =&gt; \$Status,&lt;br /&gt;            "file=s" =&gt; \$PasswordFile,&lt;br /&gt;            "help" =&gt; \&amp;Help,&lt;br /&gt;            "identica" =&gt; \$IdenticaUse,&lt;br /&gt;            "twitter" =&gt; \$TwitterUse,&lt;br /&gt;            "version" =&gt; \&amp;Version);&lt;br /&gt;&lt;br /&gt;# Read Password file passed as argument or twit.txt by default&lt;br /&gt;$PasswordFile = "twit.txt" unless ($PasswordFile);&lt;br /&gt;open(LOGINFILE, $PasswordFile) or die "Cannot open \"$PasswordFile\" file: $!\n";&lt;br /&gt;while (&lt;LOGINFILE&gt;) {&lt;br /&gt;    my $line = $_;&lt;br /&gt;    my $PlaceHolder;&lt;br /&gt;&lt;br /&gt;    chomp $line;    # Remove trailing newline character&lt;br /&gt;    next if ($line =~ m/^#/);       # Ignore lines starting with '#'&lt;br /&gt;    if ($line =~ m/^twitter/i) {    # /^ indicates the beginning of the line&lt;br /&gt;        ($PlaceHolder, $TwitLogin{"UserName"}, $TwitLogin{"Password"}) = split (/:/, $line);&lt;br /&gt;    }&lt;br /&gt;    if ($line =~ m/^identica/i) {   # /i to ignore alphabetic case&lt;br /&gt;        ($PlaceHolder, $IdenticaLogin{"UserName"}, $IdenticaLogin{"Password"}) = split (/:/, $line);&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;close (LOGINFILE);&lt;br /&gt;&lt;br /&gt;say SendMessage("Twitter", $Status, %TwitLogin) if ($TwitterUse);&lt;br /&gt;say SendMessage("Identica", $Status, %IdenticaLogin) if ($IdenticaUse);&lt;br /&gt;Help if (!defined ($TwitterUse) &amp;&amp; !defined ($IdenticaUse));&lt;br /&gt;&lt;br /&gt;__END__&lt;br /&gt;To do:&lt;br /&gt;- Use POD format for comments&lt;br /&gt;- Simple GUI interface (1 text box + 1 check box for each Twitter and Identi.ca + 1 "Send" button)&lt;br /&gt;- Create executable file for standalone use without need of a Perl interpreter&lt;br /&gt;&lt;br /&gt;History:&lt;br /&gt;...&lt;br /&gt;v0.2.0 (2009/02/21): Added --twitter (-t) and --identica (-i) command line options to select site for updates&lt;br /&gt;                     Added --help (-h) and --version (-v) command line options&lt;br /&gt;                     Added undefined argument check for $Message in SendUpdate().&lt;br /&gt;&lt;/pre&gt;It is getting a bit long to post the whole script on this blog. You can still find the latest version to download &lt;a href="http://sites.google.com/site/damienlearnsperl/DLP-scripts?pli=1"&gt;here&lt;/a&gt;.&lt;br /&gt;There are better ways to include help and comments in code. I will talk about &lt;a href="http://perldoc.perl.org/perlpod.html"&gt;POD&lt;/a&gt; soon.&lt;br /&gt;&lt;br /&gt;Larry Wall quote of the day:&lt;br /&gt;&lt;span class="body"&gt;"We all agree on the necessity of compromise. We just can't agree on when it's necessary to compromise.&lt;/span&gt;"&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Possible next posts:&lt;/span&gt;&lt;br /&gt;&lt;ul style="font-style: italic;"&gt;&lt;li&gt;Perl template - Part II: Adding Help and Version procedures&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Perl help resources&lt;/li&gt;&lt;li&gt;Improving on twit.pl: Graphical User interface&lt;br /&gt;&lt;/li&gt;&lt;li&gt;POD&lt;/li&gt;&lt;li&gt;Install Google Analytics on your Blogger blog and stats for DLP&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5699142825044889235-1301301358762630342?l=damienlearnsperl.blogspot.com'/&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/UJevSwKTt-OVK-KN9PZuuXflKlE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/UJevSwKTt-OVK-KN9PZuuXflKlE/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/UJevSwKTt-OVK-KN9PZuuXflKlE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/UJevSwKTt-OVK-KN9PZuuXflKlE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=bRHTn2DwnkY:KLaKGcBugnE:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?i=bRHTn2DwnkY:KLaKGcBugnE:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=bRHTn2DwnkY:KLaKGcBugnE:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?i=bRHTn2DwnkY:KLaKGcBugnE:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=bRHTn2DwnkY:KLaKGcBugnE:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=bRHTn2DwnkY:KLaKGcBugnE:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DamienLearnsPerl/~4/bRHTn2DwnkY" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://damienlearnsperl.blogspot.com/feeds/1301301358762630342/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://damienlearnsperl.blogspot.com/2009/02/improving-twit-perl-script.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5699142825044889235/posts/default/1301301358762630342?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5699142825044889235/posts/default/1301301358762630342?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/DamienLearnsPerl/~3/bRHTn2DwnkY/improving-twit-perl-script.html" title="Improving the twit perl script" /><author><name>Damien</name><uri>http://www.blogger.com/profile/07183471087108492840</uri><email>damienlearnsperl@gmx.com</email><gd:extendedProperty name="OpenSocialUserId" value="13321007406475916362" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">2</thr:total><feedburner:origLink>http://damienlearnsperl.blogspot.com/2009/02/improving-twit-perl-script.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DU4DQH04fip7ImA9WxVWFEw.&quot;"><id>tag:blogger.com,1999:blog-5699142825044889235.post-2604760814011756541</id><published>2009-02-23T20:33:00.003+01:00</published><updated>2009-02-23T20:39:31.336+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-02-23T20:39:31.336+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Notepad++" /><category scheme="http://www.blogger.com/atom/ns#" term="wxPerl" /><category scheme="http://www.blogger.com/atom/ns#" term="Perl tools" /><title>How to run wxPerl scripts from Notepad++</title><content type="html">Last month, I explained &lt;a href="http://damienlearnsperl.blogspot.com/search/label/Notepad%2B%2B?max-results=100"&gt;how to launch a Perl script from Notepad++&lt;/a&gt; using the nppexec plugin.&lt;br /&gt;John left a comment asking how to run wxPerl scripts directly from Notepad++.&lt;br /&gt;At the time, I had no idea &lt;a href="http://wxperl.sourceforge.net/index.html"&gt;what wxPerl was&lt;/a&gt;.&lt;br /&gt;Now that I have started to work on a GUI implementation of twit.pl, I can finally answer the question:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;In the Run menu, select the last item: Perl.&lt;br /&gt;This will start the Perl interpreter and open the GUI application. That's it!&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;There is no shortcut to Run&gt;Perl by default. Here is how to add one:&lt;br /&gt;Click on Settings&gt;Shortcut Mapper. The following window appears:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_-EghEXBgxV4/SaB6vZ_2yaI/AAAAAAAAAC4/WcphFsOdpKI/s1600-h/npp-perl.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 395px;" src="http://2.bp.blogspot.com/_-EghEXBgxV4/SaB6vZ_2yaI/AAAAAAAAAC4/WcphFsOdpKI/s400/npp-perl.jpg" alt="" id="BLOGGER_PHOTO_ID_5305375315893602722" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Select the "Run commands" tab and chose your shortcut for the "Perl" command by double-clicking on the Perl line (last one in the table).&lt;/li&gt;&lt;li&gt;In this example, I have remapped the Alt+F1 shortcut from the php Search (I also have deleted the php search shortcut by right-clicking on the line and selecting "delete)&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;I have not found the equivalent feature in Padre.&lt;br /&gt;&lt;br /&gt;Perl quote of the day = '&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Possible next posts:&lt;/span&gt;&lt;br /&gt;&lt;ul style="font-style: italic;"&gt;&lt;li&gt;Improving on twit.pl: using more of the Net::Twitter API&lt;/li&gt;&lt;li&gt;Install Google Analytics on your Blogger blog and stats for DLP&lt;/li&gt;&lt;li&gt;Improving on twit.pl: Graphical User interface&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Perl help resources&lt;/li&gt;&lt;li&gt;POD&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5699142825044889235-2604760814011756541?l=damienlearnsperl.blogspot.com'/&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/vo0vEOIaqZVxmXP6AF6tPs7m58M/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/vo0vEOIaqZVxmXP6AF6tPs7m58M/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/vo0vEOIaqZVxmXP6AF6tPs7m58M/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/vo0vEOIaqZVxmXP6AF6tPs7m58M/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=cbhXYdoirIE:3BCwM4_nfuA:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?i=cbhXYdoirIE:3BCwM4_nfuA:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=cbhXYdoirIE:3BCwM4_nfuA:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?i=cbhXYdoirIE:3BCwM4_nfuA:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=cbhXYdoirIE:3BCwM4_nfuA:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=cbhXYdoirIE:3BCwM4_nfuA:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DamienLearnsPerl/~4/cbhXYdoirIE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://damienlearnsperl.blogspot.com/feeds/2604760814011756541/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://damienlearnsperl.blogspot.com/2009/02/how-to-run-wxperl-scripts-from-notepad.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5699142825044889235/posts/default/2604760814011756541?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5699142825044889235/posts/default/2604760814011756541?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/DamienLearnsPerl/~3/cbhXYdoirIE/how-to-run-wxperl-scripts-from-notepad.html" title="How to run wxPerl scripts from Notepad++" /><author><name>Damien</name><uri>http://www.blogger.com/profile/07183471087108492840</uri><email>damienlearnsperl@gmx.com</email><gd:extendedProperty name="OpenSocialUserId" value="13321007406475916362" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/_-EghEXBgxV4/SaB6vZ_2yaI/AAAAAAAAAC4/WcphFsOdpKI/s72-c/npp-perl.jpg" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total><feedburner:origLink>http://damienlearnsperl.blogspot.com/2009/02/how-to-run-wxperl-scripts-from-notepad.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CU4AR3YyeCp7ImA9WxVWEkQ.&quot;"><id>tag:blogger.com,1999:blog-5699142825044889235.post-2259063492851329413</id><published>2009-02-21T13:27:00.013+01:00</published><updated>2009-02-22T10:12:26.890+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-02-22T10:12:26.890+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Padre" /><category scheme="http://www.blogger.com/atom/ns#" term="blogging" /><category scheme="http://www.blogger.com/atom/ns#" term="Perl tools" /><title>First impressions on Padre (running on Windows Vista)</title><content type="html">&lt;span&gt;I played with &lt;/span&gt;&lt;span&gt;Padre (v0.27) a bit today while working on&lt;/span&gt;&lt;span style="font-weight: bold;"&gt; &lt;/span&gt;&lt;span&gt;twit&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span&gt;pl v0.2.0.&lt;br /&gt;Here are my first impressions...&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_-EghEXBgxV4/SaAuzk34I9I/AAAAAAAAACw/Qdh4TRZ4b48/s1600-h/Padre1.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 264px;" src="http://1.bp.blogspot.com/_-EghEXBgxV4/SaAuzk34I9I/AAAAAAAAACw/Qdh4TRZ4b48/s400/Padre1.jpg" alt="" id="BLOGGER_PHOTO_ID_5305291824648692690" border="0" /&gt;&lt;/a&gt;&lt;span style="font-weight: bold;"&gt;The Good&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;When I used the &lt;span style="font-family:courier new;"&gt;length &lt;/span&gt;and &lt;span style="font-family:courier new;"&gt;print &lt;/span&gt;functions, a tip window appeared below the cursor to show the function's prototype and a help message.&lt;/li&gt;&lt;li&gt;An "Install Module" menu that lets you install CPAN modules as if you were typing &lt;span style="font-family:courier new;"&gt;"install ModuleName&lt;module&gt;"&lt;/module&gt;&lt;/span&gt; in a CPAN shell.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;The "Automatic bracket completion" feature seems to work pretty well. As a rule, I would recommend leaving it on all the time. It is good practice to write the closing bracket (or parenthesis) right after the opening one and fill in the blank. This feature will do the job for you by adding the closing bracket character automatically.&lt;br /&gt;The only time when it can be annoyaing is if you go back in the code and add a bracket or parenthesis. Then you will have to delete the extra closing character.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;The "Toggle comment" command accessible by the right-click menu: just select the lines you want to (un)comment and Padre will add (or remove) the '#' characters in front of the lines for you.&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold;"&gt;The Bad&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Just a feeling of "still a lot to do" to compete with an editor like Notepad++ (although Padre really is an IDE, not just an editor)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://damienlearnsperl.blogspot.com/2009/02/installing-padre-on-windows-via.html"&gt;Not "super easy" to install&lt;/a&gt; (from CPAN, need to use the "force install Padre" command): no installer file for easy deployment.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;I entered my second ticket on Padre v0.27 today about an unwanted application exit when trying to view the CPAN config file.&lt;/li&gt;&lt;li&gt;You can select your syntax highlighting scheme (Padre, Notepad++, Dark background and UltraEdit at the moment) but there is no way yet to chose formatting by categories (keywords, comments, etc.)&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold;"&gt;The Ugly&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Nothing in this category yet as far as I'm concerned&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Perl blogroll&lt;/span&gt;&lt;br /&gt;On a totally unrelated subject, I just set up the new "Blog List" widget of Blogger. Chek out for yourself on the right. It displays the blogs by order of most recent activity with a link on that last post. I think it looks pretty nice.&lt;br /&gt;Also, I discovered two sites that are aggregates of Perl blogs. There are some slight differences between the two but most of the posts are similar:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://perlsphere.net/"&gt;Perlsphere&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://planet.perl.org/"&gt;Planet Perl&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;Larry Wall quote of the day:&lt;br /&gt;"&lt;span class="body"&gt;The world has become a larger place. The universe has been expanding, and Perl's been expanding along with the universe.&lt;/span&gt; "&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Possible next posts:&lt;/span&gt;&lt;br /&gt;&lt;ul style="font-style: italic;"&gt;&lt;li&gt;Install Google Analytics on your Blogger blog and stats for DLP&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Improving on twit.pl: using more of the Net::Twitter API&lt;/li&gt;&lt;li&gt;Some post about Padre&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Improving on twit.pl: Graphical User interface&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Perl help resources&lt;/li&gt;&lt;li&gt;POD&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5699142825044889235-2259063492851329413?l=damienlearnsperl.blogspot.com'/&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/BUrm4fzi8hjYhsVXyORFFNY3DGs/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/BUrm4fzi8hjYhsVXyORFFNY3DGs/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/BUrm4fzi8hjYhsVXyORFFNY3DGs/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/BUrm4fzi8hjYhsVXyORFFNY3DGs/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=E79Jp0Cpja0:ionk_HMtFuY:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?i=E79Jp0Cpja0:ionk_HMtFuY:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=E79Jp0Cpja0:ionk_HMtFuY:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?i=E79Jp0Cpja0:ionk_HMtFuY:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=E79Jp0Cpja0:ionk_HMtFuY:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=E79Jp0Cpja0:ionk_HMtFuY:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DamienLearnsPerl/~4/E79Jp0Cpja0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://damienlearnsperl.blogspot.com/feeds/2259063492851329413/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://damienlearnsperl.blogspot.com/2009/02/first-impressions-on-padre-running-on.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5699142825044889235/posts/default/2259063492851329413?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5699142825044889235/posts/default/2259063492851329413?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/DamienLearnsPerl/~3/E79Jp0Cpja0/first-impressions-on-padre-running-on.html" title="First impressions on Padre (running on Windows Vista)" /><author><name>Damien</name><uri>http://www.blogger.com/profile/07183471087108492840</uri><email>damienlearnsperl@gmx.com</email><gd:extendedProperty name="OpenSocialUserId" value="13321007406475916362" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_-EghEXBgxV4/SaAuzk34I9I/AAAAAAAAACw/Qdh4TRZ4b48/s72-c/Padre1.jpg" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://damienlearnsperl.blogspot.com/2009/02/first-impressions-on-padre-running-on.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUMNRHc7eyp7ImA9WxVXF04.&quot;"><id>tag:blogger.com,1999:blog-5699142825044889235.post-890672505078216543</id><published>2009-02-15T21:39:00.005+01:00</published><updated>2009-02-15T22:31:35.903+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-02-15T22:31:35.903+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="SZABGAB" /><category scheme="http://www.blogger.com/atom/ns#" term="Perl" /><category scheme="http://www.blogger.com/atom/ns#" term="chromatic" /><category scheme="http://www.blogger.com/atom/ns#" term="blogging" /><title>Perl blogs</title><content type="html">As noted by chromatic in &lt;a href="http://use.perl.org/%7Echromatic/journal/38484?from=rss"&gt;his journal&lt;/a&gt;, very few Perl blogs seem to link to other Perl blogs.&lt;br /&gt;Tonight, as my little contribution to the community, I will give a list of Perl blogs that I have started to follow. I am sure that I am missing some wonderful links, please fill me in!&lt;br /&gt;&lt;br /&gt;Also, I will start a Perl blogroll, please send me your site if you want to be included. The criteria to be accepted:&lt;br /&gt;- talk about programming in general and/or Perl in particular&lt;br /&gt;- have original content&lt;br /&gt;- leave a comment with your url&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Perl blogs I subscribe to:&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://perl.about.com/"&gt;About.com Perl&lt;/a&gt;: saddly, there has not been any new post since last September. Too bad, the last article was a how-to on &lt;a href="http://perl.about.com/b/2008/09/21/how-to-read-character-information-from-the-world-of-warcraft-servers.htm"&gt;getting information from the World of Warcarft servers&lt;/a&gt;!&lt;/li&gt;&lt;li&gt;The &lt;a href="http://www.szabgab.com/blog.html"&gt;blog of Gabor Szabo&lt;/a&gt;, father of &lt;a href="http://padre.perlide.org/"&gt;Padre&lt;/a&gt; (yes, I am aware that Padre is spanish for "father" and that there is a pun just waiting to happen). I just subscribed today but it can only be great if it &lt;a href="http://www.szabgab.com/blog/2009/02/1234687596.html"&gt;links back to this blog&lt;/a&gt;, right?! Thanks Gabor!&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Then there's &lt;a href="http://use.perl.org/%7Echromatic/journal/"&gt;chromatic's Journal&lt;/a&gt;, where you can find Perl6 design minutes and other Perl news&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.fayland.org/blog/"&gt;Fayland and Perl Programming&lt;/a&gt;: just found this tonight thanks to Gabor's post. Looks interesting.&lt;/li&gt;&lt;li&gt;&lt;a href="http://jquelin.blogspot.com/"&gt;Jerome Quelin's blog&lt;/a&gt;: Padre developper (and Blogger user:you'll notice how similar our layouts look like). Another blog that I discovered tonight!&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.modernperlbooks.com/mt/"&gt;Modern Perl Books&lt;/a&gt;: a site for maybe more advanced Perl programmers, maintained by chromatic. You will find there insights on how to write maintainable Perl code.&lt;/li&gt;&lt;li&gt;&lt;a href="http://perlbuzz.com/"&gt;Perlbuzz&lt;/a&gt;: general newsfeed about the Perl world&lt;/li&gt;&lt;li&gt;&lt;a href="http://draegtun.wordpress.com/"&gt;Transfixed but not dead&lt;/a&gt;: Barry Walsh's blog, proving that he is indeed alive!&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold;"&gt;Programming blogs that I read:&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.codinghorror.com/blog/"&gt;Coding horror&lt;/a&gt; by Jeff Atwood&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.joelonsoftware.com/"&gt;Joel on software&lt;/a&gt; by Joel Spolsky&lt;/li&gt;&lt;/ul&gt;What other blogs would you recommend?&lt;br /&gt;&lt;br /&gt;Larry Wall quote of the day:&lt;br /&gt;"&lt;span class="body"&gt;There is no schedule. We are all volunteers, so we get it done when we get it done. Perl 5 still works fine, and we plan to take the right amount of time on Perl 6.&lt;/span&gt;"&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Possible next posts:&lt;/span&gt;&lt;br /&gt;&lt;ul style="font-style: italic;"&gt;&lt;li&gt;Install Google Analytics on your Blogger blog and stats for DLP&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Improving on twit.pl: using more of the Net::Twitter API&lt;/li&gt;&lt;li&gt;Some post about Padre&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Improving on twit.pl: Graphical User interface&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Perl help resources&lt;/li&gt;&lt;li&gt;POD&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5699142825044889235-890672505078216543?l=damienlearnsperl.blogspot.com'/&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/lGaATgFu7ZeFAY_O5lWvYRQstQ4/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/lGaATgFu7ZeFAY_O5lWvYRQstQ4/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/lGaATgFu7ZeFAY_O5lWvYRQstQ4/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/lGaATgFu7ZeFAY_O5lWvYRQstQ4/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=DO3ZGdgPe7Y:J4TSy39bnKM:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?i=DO3ZGdgPe7Y:J4TSy39bnKM:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=DO3ZGdgPe7Y:J4TSy39bnKM:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?i=DO3ZGdgPe7Y:J4TSy39bnKM:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=DO3ZGdgPe7Y:J4TSy39bnKM:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=DO3ZGdgPe7Y:J4TSy39bnKM:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DamienLearnsPerl/~4/DO3ZGdgPe7Y" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://damienlearnsperl.blogspot.com/feeds/890672505078216543/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://damienlearnsperl.blogspot.com/2009/02/perl-blogs.html#comment-form" title="4 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5699142825044889235/posts/default/890672505078216543?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5699142825044889235/posts/default/890672505078216543?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/DamienLearnsPerl/~3/DO3ZGdgPe7Y/perl-blogs.html" title="Perl blogs" /><author><name>Damien</name><uri>http://www.blogger.com/profile/07183471087108492840</uri><email>damienlearnsperl@gmx.com</email><gd:extendedProperty name="OpenSocialUserId" value="13321007406475916362" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">4</thr:total><feedburner:origLink>http://damienlearnsperl.blogspot.com/2009/02/perl-blogs.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUEHQ3w9eyp7ImA9WxVXF08.&quot;"><id>tag:blogger.com,1999:blog-5699142825044889235.post-955768092508368526</id><published>2009-02-14T20:00:00.002+01:00</published><updated>2009-02-15T20:53:52.263+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-02-15T20:53:52.263+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="CPAN" /><category scheme="http://www.blogger.com/atom/ns#" term="Strawberry Perl" /><category scheme="http://www.blogger.com/atom/ns#" term="Padre" /><title>Installing Padre on Windows via Strawberry Perl</title><content type="html">I decided to give&lt;span style="text-decoration: underline;"&gt; &lt;/span&gt;&lt;a href="http://padre.perlide.org/wiki"&gt;Padre&lt;/a&gt; a try as a &lt;a href="http://damienlearnsperl.blogspot.com/2009/01/perl-development-tools-part-i-text.html"&gt;Notepad++&lt;/a&gt; replacement for a Perl development environment, on a suggestion from a reader.&lt;br /&gt;Padre is a work in progress, which is one of the reasons why I would like to get involved in it. The main goal is to look at (and understand) Perl code written by experienced developpers. If I can also contribute in improving the tool, it's all bonus. Plus, it will give me material for this blog :)&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Padre installation from CPAN&lt;br /&gt;&lt;/span&gt;On the Padre's site, it is &lt;span style="font-family:georgia;"&gt;written that &lt;/span&gt;the installation process is as easy as typing "&lt;span style="font-family:courier new;"&gt;install Padre&lt;/span&gt;" in the cpan shell.&lt;br /&gt;Not in my experience. I had several "&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;Can't locate Wx.pm in @INC&lt;/span&gt;&lt;/span&gt;" error messages.&lt;br /&gt;At the end of the test report, I received:&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;Files=20, Tests=534, 61 wallclock secs ( 0.28 usr +  0.11 sys =  0.39 CPU)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;Result: FAIL&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;Failed 10/20 test programs. 142/534 subtests failed.&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;dmake.EXE:  Error code 130, while making 'test_dynamic'&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  SZABGAB/Padre-0.27.tar.gz&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  C:\strawberry\c\bin\dmake.EXE test -- NOT OK&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;//hint// to see the cpan-testers results for installing this module, try:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  reports SZABGAB/Padre-0.27.tar.gz&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;Running make install&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  make test had returned bad status, won't install without force&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;Failed during this command:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; MBARBON/Wx-0.89.tar.gz                       : make NO&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; MDOOTSON/Wx-Perl-ProcessStream-0.11.tar.gz   : make_test NO&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; SZABGAB/Wx-Perl-Dialog-0.04.tar.gz           : make_test NO&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; ADAMK/File-Find-Rule-VCS-1.05.tar.gz         : make NO&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; ADAMK/Module-Inspector-1.05.tar.gz           : make_test NO&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; SZABGAB/Padre-0.27.tar.gz                    : make_test NO&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=";font-family:georgia;font-size:100%;"  &gt;I ran the &lt;span style="font-family:courier new;"&gt;reports SZBGAB/Padre-0.27.tar.gz&lt;/span&gt; but the result came bask as PASS for MSWin32.&lt;br /&gt;I tried to push my luck with the following command (still in CPAN):&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;"force install Padre&lt;/span&gt;"&lt;br /&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:georgia;"&gt;and the process went to its end but with the following errors:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;Failed during this command:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; DANKOGAI/Encode-2.29.tar.gz                  : make_test FAILED but failure ignored because 'force' in effect&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; JDHEDDEN/threads-1.71.tar.gz                 : make_test FAILED but failure ignored because 'force' in effect&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; MDOOTSON/Wx-Perl-ProcessStream-0.11.tar.gz   : make_test FAILED but failure ignored because 'force' in effect&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I was able to launch Padre v0.27 by following the instructions from the Padre's site: I created a shortcut with the "C:\strawberry\perl\bin\wperl.exe C:\strawberry\perl\bin\padre" command.&lt;br /&gt;&lt;br /&gt;I didn't get to experience much of it because it is getting late and I am going on a trip with my Valentine tomorrow ;)&lt;br /&gt;I still had the time to create a new ticket though...&lt;br /&gt;There'll be more about my impressions on Padre in the posts to come.&lt;br /&gt;When I have played with it a bit and read the docs, I'll start digging in the code.&lt;br /&gt;&lt;br /&gt;Larry Wall quote of the day:&lt;br /&gt;"&lt;span class="body"&gt;Programmers can be lazy.&lt;/span&gt;"&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&lt;br /&gt;Possible next posts:&lt;/span&gt;&lt;br /&gt;&lt;ul style="font-style: italic;"&gt;&lt;li&gt;How to install and use Google Analytics on your Blogger blog&lt;/li&gt;&lt;li&gt;Improving on twit.pl: using more of the Net::Twitter API&lt;/li&gt;&lt;li&gt;Some post about Padre&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Improving on twit.pl: Graphical User interface&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Perl help resources&lt;/li&gt;&lt;li&gt;POD&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5699142825044889235-955768092508368526?l=damienlearnsperl.blogspot.com'/&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/ewSnEtoP3CdUGF0jXhxoMenhUKs/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ewSnEtoP3CdUGF0jXhxoMenhUKs/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/ewSnEtoP3CdUGF0jXhxoMenhUKs/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ewSnEtoP3CdUGF0jXhxoMenhUKs/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=aU9itq3a2XE:o1skAUo6cKc:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?i=aU9itq3a2XE:o1skAUo6cKc:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=aU9itq3a2XE:o1skAUo6cKc:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?i=aU9itq3a2XE:o1skAUo6cKc:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=aU9itq3a2XE:o1skAUo6cKc:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=aU9itq3a2XE:o1skAUo6cKc:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DamienLearnsPerl/~4/aU9itq3a2XE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://damienlearnsperl.blogspot.com/feeds/955768092508368526/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://damienlearnsperl.blogspot.com/2009/02/installing-padre-on-windows-via.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5699142825044889235/posts/default/955768092508368526?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5699142825044889235/posts/default/955768092508368526?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/DamienLearnsPerl/~3/aU9itq3a2XE/installing-padre-on-windows-via.html" title="Installing Padre on Windows via Strawberry Perl" /><author><name>Damien</name><uri>http://www.blogger.com/profile/07183471087108492840</uri><email>damienlearnsperl@gmx.com</email><gd:extendedProperty name="OpenSocialUserId" value="13321007406475916362" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">2</thr:total><feedburner:origLink>http://damienlearnsperl.blogspot.com/2009/02/installing-padre-on-windows-via.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUcASH08fyp7ImA9WxVXFU4.&quot;"><id>tag:blogger.com,1999:blog-5699142825044889235.post-5007323474950742975</id><published>2009-02-12T18:28:00.012+01:00</published><updated>2009-02-13T15:57:29.377+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-02-13T15:57:29.377+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Perl" /><category scheme="http://www.blogger.com/atom/ns#" term="Strawberry Perl" /><category scheme="http://www.blogger.com/atom/ns#" term="Padre" /><category scheme="http://www.blogger.com/atom/ns#" term="Twitter" /><title>Hashes and regular expressions</title><content type="html">&lt;span style="font-weight: bold;"&gt;StrawberryPerl v5.10.0.4&lt;/span&gt;&lt;br /&gt;I installed &lt;a href="http://strawberryperl.com/releases.html"&gt;StrawberryPerl v5.10.0.4&lt;/a&gt; on top of  my existing directory yesterday and it cleaned up my module installs. I didn't have that many installed but it is a good thing to know for next time.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Perl open source project: Padre&lt;/span&gt;&lt;br /&gt;Someone commented on &lt;a href="http://damienlearnsperl.blogspot.com/2009/02/new-blog-template-euler-project-and.html"&gt;my previous post about a Perl open source project&lt;/a&gt; to look at. &lt;a href="http://padre.perlide.org/"&gt;Padre&lt;/a&gt;, the Perl integrated development environment (IDE) does look like an interesting project. I will start reading about it.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Twit.pl v0.1.0&lt;/span&gt;: &lt;span style="font-weight: bold;"&gt;reading from file, hashes and regexes&lt;/span&gt;&lt;br /&gt;Version 0.1.0 of twit.pl adds the ability to read your twitter and identica login info (username and password) from a file.&lt;br /&gt;The text file must have the following format:&lt;br /&gt;&lt;pre name="code" class="perl:nogutter"&gt;#Should I be writing down my password in a file?&lt;br /&gt;Twitter:TwitterUserName:TwitterPassword&lt;br /&gt;Identica:IdenticaUserName:IdenticaPassword&lt;/pre&gt;&lt;ul&gt;&lt;li&gt;Lines starting with '#' are comments and will be ignored by the script&lt;br /&gt;&lt;/li&gt;&lt;li&gt;The last line starting with "Twitter" will be parsed for username and password. Each of these fields must be separated by a semi-column ':'&lt;/li&gt;&lt;li&gt;Same with "Identica"&lt;/li&gt;&lt;li&gt;Save it as "twit.txt" in the same directory as twit.pl or use the --file (or -f) option on the command line just like this:&lt;br /&gt;perl twit.pl -s "Reading DamienLearnsPerl!" -f "~/secretstuff/mytwitterpassword.txt"&lt;br /&gt;or&lt;br /&gt;perl twit.pl -s "Watching the snow falling" -f "C:\temp\pass.txt"&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;With this in mind, let's see how we can parse the file inside our script:&lt;br /&gt;&lt;pre name="code" class="perl:nogutter"&gt;# ------------------------------------------------------------------------------&lt;br /&gt;# Main&lt;br /&gt;# ------------------------------------------------------------------------------&lt;br /&gt;my $Status;&lt;br /&gt;my $PasswordFile;&lt;br /&gt;my %TwitLogin;&lt;br /&gt;my %IdenticaLogin;&lt;br /&gt;&lt;br /&gt;#Parse command line arguments&lt;br /&gt;GetOptions ("status=s" =&gt; \$Status,&lt;br /&gt;            "file=s" =&gt; \$PasswordFile);&lt;br /&gt;&lt;br /&gt;# Read Password file passed as argument or twit.txt by default&lt;br /&gt;$PasswordFile = "twit.txt" unless ($PasswordFile);&lt;br /&gt;open(LOGINFILE, $PasswordFile) or die "Cannot open \"$PasswordFile\" file: $!\n";&lt;br /&gt;while (&amp;lt;LOGINFILE&amp;gt;) {&lt;br /&gt;    my $line = $_;&lt;br /&gt;    my $PlaceHolder;&lt;br /&gt;&lt;br /&gt;    chomp $line;    # Remove trailing newline character&lt;br /&gt;    next if ($line =~ m/^#/);       # Ignore lines starting with '#'&lt;br /&gt;    if ($line =~ m/^twitter/i) {    # /^ indicates the beginning of the line&lt;br /&gt;        ($PlaceHolder, $TwitLogin{"UserName"}, $TwitLogin{"Password"}) = split (/:/, $line);&lt;br /&gt;    }&lt;br /&gt;    if ($line =~ m/^identica/i) {   # /i to ignore alphabetic case&lt;br /&gt;        ($PlaceHolder, $IdenticaLogin{"UserName"}, $IdenticaLogin{"Password"}) = split (/:/, $line);&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;close (LOGINFILE);&lt;br /&gt;&lt;br /&gt;say SendMessage("Twitter", $Status, %TwitLogin) if ($TwitterUse);&lt;br /&gt;say SendMessage("Identica", $Status, %IdenticaLogin) if ($IdenticaUse);&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;New Perl concepts&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Notice how global scalar variables &lt;span style="font-family:courier new;"&gt;$TwitUser = 'twitterlogin'&lt;/span&gt; and &lt;span style="font-family:courier new;"&gt;$TwitPass = 'twitterpasswd'&lt;/span&gt; are replaced by &lt;span style="font-family:courier new;"&gt;%TwitLogin&lt;/span&gt;&lt;/li&gt;&lt;li&gt;The &lt;span style="font-family:courier new;"&gt;%&lt;/span&gt; in front of &lt;span style="font-family:courier new;"&gt;TwitLogin &lt;/span&gt;means that this variable is a hash. For more details about hashes, see &lt;a href="http://perl.about.com/od/perltutorials/a/datatypehash.htm"&gt;here&lt;/a&gt;. Right now, we just need to know that a hash is a list of unsorted scalars. The goal is to use the TwitLogin hash to regroup the user name and password in a single entity. They are individually accessible as scalars with  &lt;span style="font-family:courier new;"&gt;$TwitLogin{"UserName"}&lt;/span&gt; and &lt;span style="font-family:courier new;"&gt;$TwitLogin{"Password"}.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Note how the GetOptions command got an extra field for the  --file option where the login information will be stored&lt;/li&gt;&lt;li&gt;Line &lt;span style="font-family:courier new;"&gt;open(LOGINFILE, $PasswordFile)&lt;/span&gt; will associate the &lt;span style="font-family:courier new;"&gt;LOGINFILE&lt;/span&gt; &lt;a href="http://perldoc.perl.org/FileHandle.html"&gt;filehandle&lt;/a&gt; to an external file specified in $PasswordFile. By default, it opens the file in input (read) mode. If it is successful, the interpreter will not execute the second part of the line after the &lt;a href="http://perldoc.perl.org/perlop.html#Logical-or%2c-Defined-or%2c-and-Exclusive-Or"&gt;&lt;span style="font-family:courier new;"&gt;or&lt;/span&gt;&lt;/a&gt; operator. It will consider that the result of the expression &lt;span style="font-family:courier new;"&gt;(a or b)&lt;/span&gt; is true if &lt;span style="font-family:courier new;"&gt;a == true&lt;/span&gt; and will not assess the right part of the operator.&lt;/li&gt;&lt;li&gt;The &lt;span style="font-family:courier new;"&gt;die "msg"&lt;/span&gt;  function will exit from the program with a message&lt;/li&gt;&lt;li&gt;The last error is stored by Perl in the &lt;span style="font-family:courier new;"&gt;$!&lt;/span&gt; string,  so printing it in the &lt;span style="font-family:courier new;"&gt;die&lt;/span&gt; message will give you an idea of where the faulty logic was.&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:courier new;"&gt;while(&lt;loginfile&gt;) &lt;/loginfile&gt;&lt;/span&gt;will read each line of the file handled by LOGINFILE until the end of the file.&lt;/li&gt;&lt;li&gt;The current line being read is stored in &lt;span style="font-family:courier new;"&gt;$_. &lt;/span&gt;This is another special Perl variable for the default input.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;The &lt;a href="http://perldoc.perl.org/functions/chomp.html"&gt;&lt;span style="font-family:courier new;"&gt;chomp&lt;/span&gt; &lt;/a&gt;function removes the newline character from a string. In the twit.txt file, each line is terminated by a newline character, so we need to remove it before we can do operations on the line string.&lt;/li&gt;&lt;li&gt;&lt;a href="http://perldoc.perl.org/functions/next.html"&gt;&lt;span style="font-family:courier new;"&gt;next&lt;/span&gt; &lt;/a&gt;will tell the &lt;span style="font-family:courier new;"&gt;while&lt;/span&gt; loop to stop the execution of statements within the block and go back to testing the exit condition (the 'EOF' (End oF File) character in this case).&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:courier new;"&gt;next if ($line =~ m/^#/);&lt;/span&gt; will execute the next command if the current line matches the regular expression between //. There is &lt;a href="http://perldoc.perl.org/perlre.html"&gt;lots to say about regexes&lt;/a&gt;, I'll keep it for another post if you don't mind. ^ marks the beginning of the line and # is the '#' character. The statement then means: "&lt;span style="font-style: italic;"&gt;go to the next line in the file if the current line starts with the '#' character&lt;/span&gt;".&lt;/li&gt;&lt;li&gt;Finally, the &lt;a href="http://perldoc.perl.org/functions/split.html"&gt;&lt;span style="font-family:courier new;"&gt;split &lt;/span&gt;&lt;/a&gt;command will separate the line into several strings, based on the separator character (':' in our case).  The unnamed array ($PlaceHolder, $IdenticaLogin{"UserName"}, $IdenticaLogin{"Password"}) will contain three elements created from a single string.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold;"&gt;Changes to the SendMessage routine&lt;/span&gt;&lt;br /&gt;The last two arguments have been replaced by a hash:&lt;br /&gt;&lt;pre name="code" class="perl:nogutter"&gt;# ------------------------------------------------------------------------------&lt;br /&gt;# Name    : SendMessage&lt;br /&gt;# Comment : Sends message to chosen macroblogging site&lt;br /&gt;# Input   : $_[0] = Input string with value&lt;br /&gt;#               "twitter" -&gt; twitter.com instance&lt;br /&gt;#               "identica" -&gt; identi.ca instance&lt;br /&gt;#           $_[1] = Message string to be sent&lt;br /&gt;#           $_[2] = Hash with "UserName" and "Password" elements&lt;br /&gt;# Output  : Return string: "Error" if couldn't create object or string from SendUpdate&lt;br /&gt;# ------------------------------------------------------------------------------&lt;br /&gt;sub SendMessage {&lt;br /&gt;    my $ReturnString;&lt;br /&gt;    my $Instance;&lt;br /&gt;    my ($SiteName, $Message, %Login) = @_;&lt;br /&gt;&lt;br /&gt;    $Instance = CreateObject($SiteName, %Login);&lt;br /&gt;    if ($Instance) {&lt;br /&gt;        $ReturnString = SendUpdate($Instance, $Message);&lt;br /&gt;    }&lt;br /&gt;    else {&lt;br /&gt;        $ReturnString = "Error with $SiteName creation process";&lt;br /&gt;    }&lt;br /&gt;    return $ReturnString;&lt;br /&gt;} #End of SendMessage&lt;/pre&gt;&lt;ul&gt;&lt;li&gt;The @_ array is split into individual elements $SiteName, $Message, %Login to improve the readability&lt;br /&gt;&lt;/li&gt;&lt;li&gt;The CreateObject prototype is also changed to accept a hash as argument&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;pre name="code" class="perl:nogutter"&gt;# ------------------------------------------------------------------------------&lt;br /&gt;# Name    : CreateObject&lt;br /&gt;# Comment : Creates and returns an instance of the Net::Twitter class&lt;br /&gt;# Input   : - Input string with value&lt;br /&gt;#               "twitter" -&gt; twitter.com instance&lt;br /&gt;#               "identica" -&gt; identi.ca instance&lt;br /&gt;#               all other values return an error&lt;br /&gt;#           - Hash with "UserName" and "Password"&lt;br /&gt;# Output  : Object newly created or 0 if error&lt;br /&gt;# ------------------------------------------------------------------------------&lt;br /&gt;sub CreateObject {&lt;br /&gt;    my $SiteInstance = 0;&lt;br /&gt;    my $NameString = shift;&lt;br /&gt;    my %Login = @_;&lt;br /&gt;&lt;br /&gt;    $NameString =~ tr/A-Z/a-z/;&lt;br /&gt;    if ($NameString eq "twitter") {&lt;br /&gt;        $SiteInstance = Net::Twitter-&gt;new(username =&gt; $Login{"UserName"}, password =&gt; $Login{"Password"});&lt;br /&gt;    }&lt;br /&gt;    elsif ($NameString eq "identica") {&lt;br /&gt;        $SiteInstance = Net::Twitter-&gt;new(identica =&gt; 1, username =&gt; $Login{"UserName"}, password =&gt; $Login{"Password"});&lt;br /&gt;    }&lt;br /&gt;    return $SiteInstance;&lt;br /&gt;} # End of CreateObject&lt;/pre&gt;SendUpdate() is unchanged except for the inclusion of a suggestion from &lt;a href="http://thought.blutiges-gemetzel.de/"&gt;kreetrapper&lt;/a&gt;.&lt;br /&gt;&lt;pre name="code" class="perl:nogutter"&gt;    my $SiteName = "twitter.com";&lt;br /&gt;  $SiteName = "identi.ca" if ($Site-&gt;{identica});&lt;/pre&gt;can be written in a single line using the ? operator:&lt;br /&gt;&lt;pre name="code" class="perl:nogutter"&gt;    my $SiteName = ($Site-&gt;{identica})?"identi.ca":"twitter.com";&lt;/pre&gt;&lt;ul&gt;&lt;li&gt;The &lt;a href="http://perldoc.perl.org/perlop.html#Conditional-Operator"&gt;&lt;span style="font-family:courier new;"&gt;?&lt;/span&gt; conditonal operator&lt;/a&gt; assesses the statement to the left. If it is true, then it will assign "identi.ca" to $Sitename, else "twitter.com" will be stored in the variable.&lt;/li&gt;&lt;/ul&gt;The complete script can be downloaded from &lt;a href="http://sites.google.com/site/damienlearnsperl/DLP-scripts/twit_0_1_0.pl?attredirects=0"&gt;here&lt;/a&gt; (or go to &lt;a href="http://sites.google.com/site/damienlearnsperl/DLP-scripts"&gt;http://sites.google.com/site/damienlearnsperl/DLP-scripts&lt;/a&gt; to select your version).&lt;br /&gt;&lt;br /&gt;Larry Wall quote of the day:&lt;br /&gt;"&lt;span class="body"&gt;&lt;a href="http://en.wikipedia.org/wiki/Hubris"&gt;Hubris&lt;/a&gt; itself will not let you be an artist.&lt;/span&gt; "&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&lt;br /&gt;Possible next posts:&lt;/span&gt;&lt;br /&gt;&lt;ul style="font-style: italic;"&gt;&lt;li&gt;How to install and use Google Analytics on your Blogger blog&lt;/li&gt;&lt;li&gt;Improving on twit.pl: using more of the Net::Twitter API&lt;/li&gt;&lt;li&gt;Improving on twit.pl: Graphical User interface&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Perl help resources&lt;/li&gt;&lt;li&gt;POD&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5699142825044889235-5007323474950742975?l=damienlearnsperl.blogspot.com'/&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/cn5q0tDuj5IoPfS9Fp-TokXQbzI/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/cn5q0tDuj5IoPfS9Fp-TokXQbzI/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/cn5q0tDuj5IoPfS9Fp-TokXQbzI/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/cn5q0tDuj5IoPfS9Fp-TokXQbzI/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=de5rJFbqLcc:Fd1wBG7zUNg:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?i=de5rJFbqLcc:Fd1wBG7zUNg:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=de5rJFbqLcc:Fd1wBG7zUNg:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?i=de5rJFbqLcc:Fd1wBG7zUNg:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=de5rJFbqLcc:Fd1wBG7zUNg:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=de5rJFbqLcc:Fd1wBG7zUNg:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DamienLearnsPerl/~4/de5rJFbqLcc" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://damienlearnsperl.blogspot.com/feeds/5007323474950742975/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://damienlearnsperl.blogspot.com/2009/02/hashes-and-regular-expressions.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5699142825044889235/posts/default/5007323474950742975?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5699142825044889235/posts/default/5007323474950742975?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/DamienLearnsPerl/~3/de5rJFbqLcc/hashes-and-regular-expressions.html" title="Hashes and regular expressions" /><author><name>Damien</name><uri>http://www.blogger.com/profile/07183471087108492840</uri><email>damienlearnsperl@gmx.com</email><gd:extendedProperty name="OpenSocialUserId" value="13321007406475916362" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://damienlearnsperl.blogspot.com/2009/02/hashes-and-regular-expressions.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Ck4MQHczeSp7ImA9WxVXE0Q.&quot;"><id>tag:blogger.com,1999:blog-5699142825044889235.post-1965950681939022345</id><published>2009-02-11T13:47:00.018+01:00</published><updated>2009-02-11T23:23:01.981+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-02-11T23:23:01.981+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Perl" /><category scheme="http://www.blogger.com/atom/ns#" term="Perl personalities" /><category scheme="http://www.blogger.com/atom/ns#" term="Twitter" /><title>Refactoring the twit.pl Perl script to interact with twitter.com and identi.ca</title><content type="html">Today I'll be revisiting the &lt;a href="http://damienlearnsperl.blogspot.com/2009/02/how-to-post-in-both-twitter-and_08.html"&gt;twit.pl script&lt;/a&gt;.&lt;br /&gt;The new version (0.0.2) will be a (hopefully) good practice on the use of functions (or subroutines).&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Version numbering explained&lt;/span&gt;&lt;br /&gt;A short sidenote about the version numbering that I use (x.y.z):&lt;br /&gt;- I'll be updating the last number (z) when the program interface stays the same and only internal changes are made.&lt;br /&gt;- The middle number (y) will be increased when a new functionality is introduced&lt;br /&gt;- The first part (x) notifies the user that they have to change the way that they are using the program (command format changed for example).&lt;br /&gt;&lt;br /&gt;In version 0.0.1 of the code, you'll have noticed that we repeat almost the same code at the end for twitter.com and identi.ca updates:&lt;br /&gt;&lt;pre name="code" class="perl:firstline[25]"&gt;if ($TwitterUse) {&lt;br /&gt;    my $twitter = Net::Twitter-&gt;new(username =&gt; $TwitUser, password =&gt; $TwitPass);&lt;br /&gt;    if ($twitter-&gt;update($Status)) {&lt;br /&gt;        say "twitter: OK";&lt;br /&gt;    } &lt;br /&gt;    else {&lt;br /&gt;        say "twitter: FAIL";&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;if ($IdenticaUse) {&lt;br /&gt;    my $identica = Net::Twitter-&gt;new(identica =&gt; 1, username =&gt; $IdenticaUser, password =&gt; $IdenticaPass);&lt;br /&gt;    if ($identica-&gt;update($Status)) {&lt;br /&gt;        say "Identica: OK";&lt;br /&gt;    } &lt;br /&gt;    else {&lt;br /&gt;        say "Identica: FAIL";&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;&lt;span style="font-weight: bold;"&gt;twit.pl v0.0.2&lt;/span&gt;&lt;br /&gt;I'll try to refactor the code by using functions. In the end, I want the result to be something like:&lt;br /&gt;&lt;pre name="code" class="perl:nogutter"&gt;say SendMessage("Twitter", $Status, $TwitUser, $TwitPass) if ($TwitterUse);&lt;br /&gt;say SendMessage("Identica", $Status, $IdenticaUser, $IdenticaPass) if ($IdenticaUse);&lt;/pre&gt;SendMessage is a function that will have for:&lt;br /&gt;- input = "twitter" or "identica" string, status string (your message), login, password&lt;br /&gt;- output = string with update status or error message&lt;br /&gt;&lt;br /&gt;Notice how Perl lets you add the &lt;span style="font-family:courier new;"&gt;if(..)&lt;/span&gt; statement at the end of the line when there is only one statement inside the &lt;span style="font-family:courier new;"&gt;if&lt;/span&gt; block.&lt;br /&gt;SendMessage() returns a string, so we can feed it directly to the &lt;span style="font-family:courier new;"&gt;print&lt;/span&gt; or &lt;span style="font-family:courier new;"&gt;say&lt;/span&gt; function.&lt;br /&gt;Here is how I implemented the SendMessage() subroutine:&lt;br /&gt;&lt;pre name="code" class="perl:nogutter"&gt;# ------------------------------------------------------------------------------&lt;br /&gt;# Name    : SendMessage&lt;br /&gt;# Comment : Sends message to chosen macroblogging site&lt;br /&gt;# Input   : $_[0] = Input string with value&lt;br /&gt;#               "twitter" -&gt; twitter.com instance&lt;br /&gt;#               "identica" -&gt; identi.ca instance&lt;br /&gt;#           $_[1] = Message string to be sent&lt;br /&gt;#           $_[2] =  User name (login)&lt;br /&gt;#           $_[3] =  Password&lt;br /&gt;# Output  : Return string: "Error" if couldn't create object or string from SendUpdate&lt;br /&gt;# ------------------------------------------------------------------------------&lt;br /&gt;sub SendMessage {&lt;br /&gt;    my $ReturnString;&lt;br /&gt;    my $Instance;&lt;br /&gt;&lt;br /&gt;    $Instance = CreateObject($_[0], $_[2], $_[3]);&lt;br /&gt;    if ($Instance) {&lt;br /&gt;        $ReturnString = SendUpdate($Instance, $_[1]);&lt;br /&gt;    }&lt;br /&gt;    else {&lt;br /&gt;        $ReturnString = "Error with $_[0] creation process";&lt;br /&gt;    }&lt;br /&gt;    return $ReturnString;&lt;br /&gt;} #End of SendMessage&lt;/pre&gt;&lt;span style="font-weight: bold;"&gt;New Perl concepts introduced by SendMessage():&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;A subroutine if defined by the &lt;span style="font-family:courier new;"&gt;sub&lt;/span&gt; keyword followed by the function name and a {} block&lt;/li&gt;&lt;li&gt;Arguments are passed to a function between parenthesis and are separated by commas: &lt;span style="font-family:courier new;"&gt;subroutine(arg1, arg2);&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Arguments are retrieved by the function inside the &lt;span style="font-family:courier new;"&gt;@_&lt;/span&gt; array. An array is a list of individual values. As scalars are prefixed by the &lt;span style="font-family:courier new;"&gt;$&lt;/span&gt; symbols, arrays are recognized by the &lt;span style="font-family:courier new;"&gt;@&lt;/span&gt; sign preceding their name.&lt;/li&gt;&lt;li&gt;Individual values can be accessed within a list. For example, the second element of &lt;span style="font-family:courier new;"&gt;@ToDoList&lt;/span&gt; is &lt;span style="font-family:courier new;"&gt;$ToDoList[1]&lt;/span&gt; (subscripts start from 0)&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:courier new;"&gt;$_[0]&lt;/span&gt; is therefore the first parameter passed to the function. In the SendMessage example, that would be the website identifier ("twitter" or "identica").&lt;/li&gt;&lt;li&gt;You can only return one scalar or one list directly from a function by means of the &lt;span style="font-family:courier new;"&gt;return&lt;/span&gt; keyword.&lt;/li&gt;&lt;li&gt;In the &lt;span style="font-family:courier new;"&gt;SendMessage&lt;/span&gt; example, &lt;span style="font-family:courier new;"&gt;$ReturnString&lt;/span&gt; and &lt;span style="font-family:courier new;"&gt;$Instance&lt;/span&gt; only exist within the subroutine's {} block because of the &lt;span style="font-family:courier new;"&gt;my&lt;/span&gt; keyword. They cease to exist outside of &lt;span style="font-family:courier new;"&gt;SendMessage&lt;/span&gt;'s scope.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;In SendMessage, we call two other functions:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;CreateObject() which will return the newly created Net::Twitter instance. It is inside CreateObject() that we will differentiate the twitter and identica cases.&lt;/li&gt;&lt;li&gt;SendUpdate() will send the message to the twitter or identica instance.&lt;/li&gt;&lt;/ul&gt;CreateObject() introduces a few new Perl contructs:&lt;br /&gt;&lt;pre name="code" class="perl:nogutter"&gt;# ------------------------------------------------------------------------------&lt;br /&gt;# Name    : CreateObject&lt;br /&gt;# Comment : Creates and returns an instance of Net::Twitter&lt;br /&gt;# Input   : - Input string with value&lt;br /&gt;#               "twitter" -&gt; twitter.com instance&lt;br /&gt;#               "identica" -&gt; identi.ca instance&lt;br /&gt;#               all other values return an error&lt;br /&gt;#           - User name (login)&lt;br /&gt;#           - Password&lt;br /&gt;# Output  : Object newly created or 0 if error&lt;br /&gt;# ------------------------------------------------------------------------------&lt;br /&gt;sub CreateObject {&lt;br /&gt;    my $SiteInstance = 0;&lt;br /&gt;    my $NameString = shift; &lt;br /&gt;    # After shift, UserName parameter becomes $_[0] (was $_[1] before)&lt;br /&gt;    # and Password  parameter becomes $_[1] (was $_[2] before)&lt;br /&gt;    &lt;br /&gt;    $NameString =~ tr/A-Z/a-z/;    &lt;br /&gt;    if ($NameString eq "twitter") {&lt;br /&gt;        $SiteInstance = Net::Twitter-&gt;new(username =&gt; $_[0], password =&gt; $_[1]);&lt;br /&gt;    }&lt;br /&gt;    elsif ($NameString eq "identica") {&lt;br /&gt;        $SiteInstance = Net::Twitter-&gt;new(identica =&gt; 1, username =&gt; $_[0], password =&gt; $_[1]);&lt;br /&gt;    }&lt;br /&gt;    return $SiteInstance;&lt;br /&gt;} # End of CreateObject&lt;/pre&gt;&lt;span style="font-weight: bold;"&gt;New Perl concepts introduced by CreateObject():&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;First one is the &lt;span style="font-family:courier new;"&gt;shift&lt;/span&gt; operator. It removes a single element from the argument list. So if we have @_ = ("site", "username", "password") passed as parameters to CreateObject, the line &lt;span style="font-family:courier new;"&gt;my $NameString = shift;&lt;/span&gt; will store "site" in &lt;span style="font-family:courier new;"&gt;$NameString&lt;/span&gt; and @_ will become ("username", "password").&lt;/li&gt;&lt;li&gt;Hence, username which used to be referred to as &lt;span style="font-family:courier new;"&gt;$_[1] &lt;/span&gt;now becomes &lt;span style="font-family:courier new;"&gt;$_[0]&lt;/span&gt;&lt;span style="font-family:monospace;"&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:courier new;"&gt;$NameString =~ tr/A-Z/a-z/;&lt;/span&gt; uses the transliteration operator tr///. It transforms a set of characters (A-Z: means ASCII characters 'A', 'B', ..., 'Z') into another set of characters (a-z: means ASCII 'a', 'b', ..., 'z'). The transliteration is bound to a string via the =~operator. In our example, we make sure that &lt;span style="font-family:courier new;"&gt;$NameString&lt;/span&gt; only contains lowercase characters for easy comparison.&lt;/li&gt;&lt;/ul&gt;The SendUpdate sub is pretty straightforward:&lt;br /&gt;&lt;pre name="code" class="perl:nogutter"&gt;# ------------------------------------------------------------------------------&lt;br /&gt;# Name    : SendUpdate&lt;br /&gt;# Comment : Sends update to Twitter object&lt;br /&gt;# Input   : - Net::Twitter object&lt;br /&gt;#           - message string&lt;br /&gt;# Output  : string "OK" if successful update, string "FAIL" otherwise&lt;br /&gt;# ------------------------------------------------------------------------------&lt;br /&gt;sub SendUpdate {&lt;br /&gt;    my $Site = shift;&lt;br /&gt;    my $Message = shift;&lt;br /&gt;    my $SiteName = "twitter.com";&lt;br /&gt;&lt;br /&gt;    $SiteName = "identi.ca" if ($Site-&gt;{identica});&lt;br /&gt;    #There's a hard limit on the size of twits for both twitter and identica&lt;br /&gt;    if (length $Message &gt; 140) {&lt;br /&gt;        return "$SiteName update: FAILED (message over 140 characters)";&lt;br /&gt;    }&lt;br /&gt;    &lt;br /&gt;    if ($Site-&gt;update($Message)) {&lt;br /&gt;        return "$SiteName update: OK";&lt;br /&gt;    }&lt;br /&gt;    else {&lt;br /&gt;        return "$SiteName update: FAIL";&lt;br /&gt;    }&lt;br /&gt;} #End of SendUpdate&lt;/pre&gt;&lt;span style="font-weight: bold;"&gt;New Perl concepts introduced by SendUpdate():&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Nothing new really. Just note the weird construct of $Site-&gt;{identica}. For the moment, I won't analyze too much, suffice to know that when it is true, then we are dealing with an identi.ca object.&lt;/li&gt;&lt;/ul&gt;Well, that rounds it up for today: a lot of new things to review.&lt;br /&gt;Version 0.0.2 doesn't add any functionality compared with v0.0.1 but has close to 50% extra code. Was it worth the effort? Probably not, as all identica-specific code is not located in one single function. However, each logical block is well separated now and can be reused through the program later.&lt;br /&gt;Do you see any other way to improve twit.pl v0.0.2?&lt;br /&gt;&lt;br /&gt;I have created a site with Google Sites to host all the scripts that I talk about in this blog. You can go take a look at &lt;a href="http://sites.google.com/site/damienlearnsperl/DLP-scripts"&gt;http://sites.google.com/site/damienlearnsperl/DLP-scripts&lt;/a&gt;.&lt;br /&gt;I also added a link to the side --&gt;&lt;br /&gt;&lt;br /&gt;Finally, I will intersperse (or even replace) French expressions of the day with Larry Wall quotes (taken from &lt;a href="http://www.brainyquote.com/quotes/authors/l/larry_wall.html"&gt;here&lt;/a&gt; and &lt;a href="http://en.wikiquote.org/wiki/Larry_Wall"&gt;here&lt;/a&gt; for example) and other sayings by Perl personnalities.&lt;br /&gt;&lt;br /&gt;Larry Wall quote of the day:&lt;br /&gt;&lt;span class="body"&gt;"The three chief virtues of a programmer are: Laziness, Impatience and Hubris.&lt;/span&gt;"&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Possible next posts:&lt;/span&gt;&lt;br /&gt;&lt;ul style="font-style: italic;"&gt;&lt;li&gt;Improving on twit.pl: reading from file&lt;br /&gt;&lt;/li&gt;&lt;li&gt;How to install and use Google Analytics on your Blogger blog&lt;/li&gt;&lt;li&gt;Improving on twit.pl: using more of the Net::Twitter API&lt;/li&gt;&lt;li&gt;Improving on twit.pl: Graphical User interface&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Perl help resources&lt;/li&gt;&lt;li&gt;POD&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5699142825044889235-1965950681939022345?l=damienlearnsperl.blogspot.com'/&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/xKvrRjdNEFGL4PdYEMATqdf4-qg/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/xKvrRjdNEFGL4PdYEMATqdf4-qg/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/xKvrRjdNEFGL4PdYEMATqdf4-qg/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/xKvrRjdNEFGL4PdYEMATqdf4-qg/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=NiqKE3CsID4:XqjegaI4x44:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?i=NiqKE3CsID4:XqjegaI4x44:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=NiqKE3CsID4:XqjegaI4x44:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?i=NiqKE3CsID4:XqjegaI4x44:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=NiqKE3CsID4:XqjegaI4x44:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=NiqKE3CsID4:XqjegaI4x44:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DamienLearnsPerl/~4/NiqKE3CsID4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://damienlearnsperl.blogspot.com/feeds/1965950681939022345/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://damienlearnsperl.blogspot.com/2009/02/refactoring-twitpl-perl-script-to.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5699142825044889235/posts/default/1965950681939022345?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5699142825044889235/posts/default/1965950681939022345?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/DamienLearnsPerl/~3/NiqKE3CsID4/refactoring-twitpl-perl-script-to.html" title="Refactoring the twit.pl Perl script to interact with twitter.com and identi.ca" /><author><name>Damien</name><uri>http://www.blogger.com/profile/07183471087108492840</uri><email>damienlearnsperl@gmx.com</email><gd:extendedProperty name="OpenSocialUserId" value="13321007406475916362" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total><feedburner:origLink>http://damienlearnsperl.blogspot.com/2009/02/refactoring-twitpl-perl-script-to.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0ECRHczcSp7ImA9WxVXEUU.&quot;"><id>tag:blogger.com,1999:blog-5699142825044889235.post-8621682029938407530</id><published>2009-02-09T13:07:00.005+01:00</published><updated>2009-02-09T14:21:05.989+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-02-09T14:21:05.989+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="blogging" /><category scheme="http://www.blogger.com/atom/ns#" term="Project Euler" /><title>New blog template, the Euler project and SourceForge</title><content type="html">&lt;span style="font-weight: bold;"&gt;New blog template&lt;/span&gt;&lt;br /&gt;I have changed the blog's template because the previous one (TicTac Blue) was too narrow. Only 53 characters would fit on each line. This made for either a poor visibility over the scripts or a tedious work of formatting each line to fit within the limit.&lt;br /&gt;Neither was acceptable to me so I switched my Blogger template to Minima Stretch. I'll try to pretty it up over time.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;The Euler project&lt;/span&gt;&lt;br /&gt;Last Saturday I stumbled upon &lt;a href="http://projecteuler.net/index.php"&gt;Project Euler&lt;/a&gt;. From the website's own words:&lt;br /&gt;&lt;blockquote&gt;Project Euler is a series of challenging mathematical/computer programming problems that will require more than just mathematical insights to solve. Although mathematics will help you arrive at elegant and efficient methods, the use of a computer and programming skills will be required to solve most problems.&lt;/blockquote&gt;When you register, you can fill in fields for your country and for your programming language. Statistics are updated only for the latter:&lt;br /&gt;- Number of users per programming language&lt;br /&gt;- Average user rating for each language&lt;br /&gt;I joined the Perl community, boosting their number but also pulling down the rating...&lt;br /&gt;There are 231 problems to date and each time you resolve one, you can access the forums and check for the most efficient method that was used. As you progress, you build upon what you have previously learned.&lt;br /&gt;My reasons for joining were to:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Cram an additional project in the small amount of spare time that I have&lt;/li&gt;&lt;li&gt;Learn the Perl syntax by solving mathematical puzzles&lt;/li&gt;&lt;li&gt;Have fun developping mathematical algorithm&lt;/li&gt;&lt;/ul&gt;Didn't go too far yet, only solved the first two problems.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;SourceForge&lt;/span&gt;&lt;br /&gt;I also started to scan &lt;a href="https://sourceforge.net/"&gt;SourceForge&lt;/a&gt; for open source projects in Perl. The goal is to look at Perl code written by proficient users of the language and learn from it. One obvious choice is the Perl core itself but I probably won't be able to contribute before a loooong time.&lt;br /&gt;Do you have any idea of a good project where you can both learn and contribute?&lt;br /&gt;&lt;br /&gt;French expression of the day:&lt;br /&gt;"Courir deux lièvres à la fois": To have one's finger in one more pie (litt: to hunt two hares at the same time).&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Probable next posts:&lt;/span&gt;&lt;br /&gt;&lt;ul style="font-style: italic;"&gt;&lt;li&gt;Improving on twit.pl: fonctions and reading from file&lt;br /&gt;&lt;/li&gt;&lt;li&gt;How to install and use Google Analytics on your Blogger blog&lt;/li&gt;&lt;li&gt;Improving on twit.pl: using more of the Net::Twitter API&lt;/li&gt;&lt;li&gt;Improving on twit.pl: Graphical User interface&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Perl help resources&lt;/li&gt;&lt;li&gt;POD&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5699142825044889235-8621682029938407530?l=damienlearnsperl.blogspot.com'/&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/X-jAiy66JVfb8cJ1CntyCRie-Rg/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/X-jAiy66JVfb8cJ1CntyCRie-Rg/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/X-jAiy66JVfb8cJ1CntyCRie-Rg/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/X-jAiy66JVfb8cJ1CntyCRie-Rg/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=OFGNzhrdCP4:lJXwT_qw0IA:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?i=OFGNzhrdCP4:lJXwT_qw0IA:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=OFGNzhrdCP4:lJXwT_qw0IA:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?i=OFGNzhrdCP4:lJXwT_qw0IA:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=OFGNzhrdCP4:lJXwT_qw0IA:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/DamienLearnsPerl?a=OFGNzhrdCP4:lJXwT_qw0IA:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DamienLearnsPerl?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DamienLearnsPerl/~4/OFGNzhrdCP4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://damienlearnsperl.blogspot.com/feeds/8621682029938407530/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://damienlearnsperl.blogspot.com/2009/02/new-blog-template-euler-project-and.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5699142825044889235/posts/default/8621682029938407530?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5699142825044889235/posts/default/8621682029938407530?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/DamienLearnsPerl/~3/OFGNzhrdCP4/new-blog-template-euler-project-and.html" title="New blog template, the Euler project and SourceForge" /><author><name>Damien</name><uri>http://www.blogger.com/profile/07183471087108492840</uri><email>damienlearnsperl@gmx.com</email><gd:extendedProperty name="OpenSocialUserId" value="13321007406475916362" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total><feedburner:origLink>http://damienlearnsperl.blogspot.com/2009/02/new-blog-template-euler-project-and.html</feedburner:origLink></entry></feed>
