<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>transfixed but not dead! &#187; perl 5.10</title>
	<atom:link href="http://transfixedbutnotdead.com/tag/perl-510/feed/" rel="self" type="application/rss+xml" />
	<link>http://transfixedbutnotdead.com</link>
	<description>my ramblings on life, work &#38; anything left in-between</description>
	<lastBuildDate>Tue, 08 May 2012 09:57:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='transfixedbutnotdead.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://0.gravatar.com/blavatar/0a317653027efb1ab2bf8adde3dcb067?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>transfixed but not dead! &#187; perl 5.10</title>
		<link>http://transfixedbutnotdead.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://transfixedbutnotdead.com/osd.xml" title="transfixed but not dead!" />
	<atom:link rel='hub' href='http://transfixedbutnotdead.com/?pushpress=hub'/>
		<item>
		<title>Readable and compositional regexes in Perl</title>
		<link>http://transfixedbutnotdead.com/2010/09/29/readable-and-compositional-regexes-in-perl/</link>
		<comments>http://transfixedbutnotdead.com/2010/09/29/readable-and-compositional-regexes-in-perl/#comments</comments>
		<pubDate>Wed, 29 Sep 2010 15:39:44 +0000</pubDate>
		<dc:creator>draegtun</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[clojure]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[perl 5.10]]></category>
		<category><![CDATA[regex]]></category>

		<guid isPermaLink="false">http://transfixedbutnotdead.com/?p=1091</guid>
		<description><![CDATA[Regexes don&#8217;t (always!) have to be unreadable mess. For example see this HN post a little Clojure DSL for readable, compositional regexes. Here is the simple Clojure example that was given: And the equivalent Perl regex &#8220;DSL&#8221; can be equally lucid: The two things that provide a little extra help to grok whats going on [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=transfixedbutnotdead.com&#038;blog=351142&#038;post=1091&#038;subd=draegtun&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Regexes don&#8217;t (always!) have to be unreadable mess. For example see this HN post <a href="http://news.ycombinator.com/item?id=1719171">a little Clojure DSL for readable, compositional regexes</a>. Here is the simple Clojure example that was given:</p>
<p><pre class="brush: clojure;">
(def datestamp-re
  (let [d {&#092;&#048; \9}]
    (regex [d d d d :as :year] \- [d d :as :month] \- [d d :as :day])))
</pre></p>
<p>And the equivalent Perl regex &#8220;DSL&#8221; can be equally lucid:</p>
<p><pre class="brush: perl;">
sub datestamp_re {
    qr/ (?&lt;year&gt; \d \d \d \d) - (?&lt;month&gt; \d \d) - (?&lt;day&gt; \d \d ) /x;
}
</pre></p>
<p>The two things that provide a little extra help to grok whats going on here are:</p>
<ol>
<li>The <code>x</code> modifier on the end of <code>qr//</code> which allows whitespace and newlines to be sprinkled into your regex pattern without any effect on the pattern matching.  See <a href="http://perldoc.perl.org/perlre.html#Modifiers">perlre Modifers</a>
<li>And &#8220;Named Capture Buffers&#8221; which were added at <a href="http://perldoc.perl.org/perl5100delta.html#Regular-expressions">perl 5.10</a>.<br />
<pre class="brush: perl;">(?&lt;year&gt; \d{4}) # stores pattern matched in &quot;year&quot; buffer</pre><br />
Above not only gives a name to that capture buffer but provides an excellent visual placeholder to help describe what you are trying to do with the regex.
</ol>
<p>When processing named capture regexes the matches to patterns are recorded in the <code>%+</code> hash variable:<br />
<pre class="brush: perl;">
for my $date (qw/2007-10-23 20X7-10-23/) {
    printf &quot;year:%d, month:%d, day:%d\n&quot;, @+{qw/year month day/}
        if $date =~ datestamp_re;
}

# =&gt; year:2007, month:10, day:23
</pre></p>
<p>This is much more flexible for dealing with regex captures compared to positional <code>$1, $2, $3, etc</code>.  So not just more readable but more compositional:</p>
<p><pre class="brush: perl;">
# nice readable regex
sub datestamp_re  {
     my $year  = qr/ (?&lt;year&gt;  \d{4}) /x;  
     my $month = qr/ (?&lt;month&gt; \d{2}) /x;
     my $day   = qr/ (?&lt;day&gt;   \d{2}) /x;
 
     qr/ $year - $month - $day /x;
}
</pre></p>
<p>or:<br />
<pre class="brush: perl;">
# DRY regex
sub datestamp_re {
    my %re = map { 
        my ($name, $digits) = @$_;
        $name =&gt; qr/ (?&lt;$name&gt;  \d{$digits}) /x;
    } [ year  =&gt; 4 ], [ month =&gt; 2 ], [ day   =&gt; 2 ];
    
    qr/ $re{year} - $re{month} - $re{day} /x;
}
</pre></p>
<p>and even:<br />
<pre class="brush: perl;">
# regex generator
sub re { qr/ (?&lt;$_[0]&gt; $_[1] )/x }

sub regex {
    my $pattern = join q{}, @_;
    qr/ $pattern /x;
}

sub datestamp_re {
    regex re( year =&gt; '\d{4}' ), '-', re( month =&gt; '\d{2}' ), '-', re( day =&gt; '\d{2}' );
}
</pre></p>
<p>Now that is a regex DSL  <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Note that the <code>%+</code> hash variable only captures the first occurrence in the relevant named buffer:<br />
<pre class="brush: perl;">
sub numbers_re {
    my $four  = qr/ (?&lt;four&gt; \d{4}) /x;
    my $two   = qr/ (?&lt;two&gt;  \d{2}) /x;
    qr/ $four - $two - $two /x;
}

if ('2007-10-23' =~ numbers_re) {
    say 'four =&gt; ', $+{four};
    say 'two  =&gt; ', $+{two};
}

# four =&gt; 2007
# two  =&gt; 10
</pre></p>
<p>To get to the second $two (ie. 23) then use the <code>%-</code> hash variable which stores all the captures in an array reference for relevant named buffer:<br />
<pre class="brush: perl;">
if ('2007-10-23' =~ numbers_re) {
    say 'two(s) =&gt; ', join ',' =&gt; @{ $-{two} };
}

# two(s) =&gt; 10,23
</pre></p>
<p>/I3az/</p>
<p>PS. Please note that the WordPress syntax highlighter used is unfortunately upper-casing all code comments <img src='http://s0.wp.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/draegtun.wordpress.com/1091/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/draegtun.wordpress.com/1091/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/draegtun.wordpress.com/1091/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/draegtun.wordpress.com/1091/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/draegtun.wordpress.com/1091/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/draegtun.wordpress.com/1091/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/draegtun.wordpress.com/1091/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/draegtun.wordpress.com/1091/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/draegtun.wordpress.com/1091/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/draegtun.wordpress.com/1091/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/draegtun.wordpress.com/1091/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/draegtun.wordpress.com/1091/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/draegtun.wordpress.com/1091/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/draegtun.wordpress.com/1091/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=transfixedbutnotdead.com&#038;blog=351142&#038;post=1091&#038;subd=draegtun&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://transfixedbutnotdead.com/2010/09/29/readable-and-compositional-regexes-in-perl/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/29cb106071d163d703484e63839d89cb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">draegtun</media:title>
		</media:content>
	</item>
		<item>
		<title>given/when &#8211; the Perl switch statement</title>
		<link>http://transfixedbutnotdead.com/2010/08/30/givenwhen-the-perl-switch-statement/</link>
		<comments>http://transfixedbutnotdead.com/2010/08/30/givenwhen-the-perl-switch-statement/#comments</comments>
		<pubDate>Mon, 30 Aug 2010 20:13:15 +0000</pubDate>
		<dc:creator>draegtun</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[perl 5.10]]></category>
		<category><![CDATA[perl 5.12]]></category>
		<category><![CDATA[switch]]></category>

		<guid isPermaLink="false">http://transfixedbutnotdead.com/?p=1072</guid>
		<description><![CDATA[Its been a while since my last post; summer holidays have inflicted upon me some big distractions! So to ease myself back in gently I&#8217;ll I&#8217;ve pulled out a (nearly finished but unposted) article from last year (in true Blue Peter tradition!) This post was inspired by this nice &#38; straightforward blog article: How A [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=transfixedbutnotdead.com&#038;blog=351142&#038;post=1072&#038;subd=draegtun&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Its been a while since my last post; summer holidays have inflicted upon me some big distractions!   So to ease myself back in gently I&#8217;ll I&#8217;ve pulled out a (nearly finished but unposted) article from last year (in true <a href="http://en.wikipedia.org/wiki/Blue_Peter">Blue Peter</a> tradition!)</p>
<p>This post was inspired by this nice &amp; straightforward blog article: <a href="http://www.skorks.com/2009/08/how-a-ruby-case-statement-works-and-what-you-can-do-with-it/">How A Ruby Case Statement Works And What You Can Do With It</a>.  I&#8217;ve simply converted the Ruby code to Perl and added some so called insightful notes <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Now what Ruby calls <code>case/when</code> statements is more commonly known in computer parlance has the <a href="http://en.wikipedia.org/wiki/Switch_statement">switch statement</a>.</p>
<p>Perl itself has had such a <a href="http://perldoc.perl.org/5.8.9/Switch.html">switch statement</a> for quite a while now:</p>
<p><pre class="brush: perl;">
use Switch;

switch ($grade) {
    case &quot;A&quot;   { say &quot;Well done!&quot; }
    case &quot;B&quot;   { say &quot;Try harder!&quot; }
    case &quot;C&quot;   { say &quot;You need help!!!&quot; }
    else         { print &quot;You just making it up&quot; }
}
</pre> </p>
<p><b>However DON&#8217;T USE IT!!!</b> Its a source filter and is being deprecated.</p>
<p>Instead use <a href="http://search.cpan.org/dist/perl-5.10.0/pod/perl5100delta.pod#Switch_and_Smart_Match_operator">given/when</a> which is the Perl 6 <em>switch statement</em> that was introduced at perl 5.10.</p>
<p><pre class="brush: perl;">
use strict;
use warnings;
use feature qw(switch say);

print 'Enter your grade: ';
chomp( my $grade = &lt;&gt; );

given ($grade) {
    when ('A') { say 'Well done!'       }
    when ('B') { say 'Try harder!'      }
    when ('C') { say 'You need help!!!' }
    default { say 'You are just making it up!' }
}
</pre></p>
<p>And at perl 5.12 you could also use <code>when</code> has a <a href="http://search.cpan.org/dist/perl-5.12.0/pod/perl5120delta.pod#when_as_a_statement_modifier">statement modifiers</a>:<br />
<pre class="brush: perl;">
use 5.012;
use warnings;

print 'Enter your grade: ';
chomp( my $grade = &lt;&gt; );

given ($grade) {
    say 'Well done!'        when 'A';
    say 'Try harder!'       when 'B';
    say 'You need help!!!'  when 'C';
    default { say 'You are just making it up!' }
}
</pre></p>
<p>And even more enhancements are coming with perl 5.14 because <code>given</code> now returns the <a href="http://search.cpan.org/dist/perl-5.13.4/pod/perl5131delta.pod#given_return_values">last evaluated expression</a>:<br />
<pre class="brush: perl;">
use 5.013;  # 5.014
use warnings;

print 'Enter your grade: ';
chomp( my $grade = &lt;&gt; );

say do { 
    given ($grade) {
        'Well done!'        when 'A';
        'Try harder!'       when 'B';
        'You need help!!!'  when 'C';
        default { 'You are just making it up!' }
    }
};
</pre></p>
<p>Which can lead to some very pleasant looking dry code.</p>
<p>But there is more to <code>given/when</code> than just single value conditionals.  You can also check multi-values and ranges:<br />
<pre class="brush: perl;">
use 5.012;
use warnings;

print 'Enter your grade: ';
chomp( my $grade = &lt;&gt; );

given ($grade) {
    say 'You pretty smart'  when ['A', 'B'];
    say 'You pretty dumb!!' when ['C', 'D'];
    default { say &quot;You can't even use a computer&quot; }
}
</pre></p>
<p>And also pattern match using a regex:<br />
<pre class="brush: perl;">
use 5.012;
use warnings;

print 'Enter some text: ';
chomp( my $some_string = &lt;&gt; );

given ($some_string) {
    say 'String has numbers'  when /\d/;
    say 'String has letters'  when /[a-zA-Z]/;
    default { say &quot;String has no numbers or letters&quot; }
}
</pre></p>
<p>In fact you can use anything that <a href="http://search.cpan.org/dist/perl-5.13.4/pod/perlsyn.pod#Smart_matching_in_detail">Smart Matching</a> can resolve.</p>
<p>And because smart matching is used under the hood by <code>given/when</code> then you can customise it by overloading the <code>~~</code> smart match operator:</p>
<p><pre class="brush: perl;">
use 5.012;
use warnings;

{
    package Vehicle;
    use Moose;
    use overload '~~' =&gt; '_same_wheels', fallback =&gt; 1;
    
    has number_of_wheels =&gt; (is =&gt; 'rw', isa =&gt; 'Int');
    
    sub _same_wheels {
        my ($self, $another_vehicle) = @_;
        $self-&gt;number_of_wheels == $another_vehicle-&gt;number_of_wheels;
    } 
}

my $four_wheeler =  Vehicle-&gt;new( number_of_wheels =&gt;  4 );
my $two_wheeler  =  Vehicle-&gt;new( number_of_wheels =&gt;  2 );
my $robin_reliant = Vehicle-&gt;new( number_of_wheels =&gt;  3 );

print 'Enter number of wheel for vehicles: '; chomp( my $wheels = &lt;&gt; );
my $vehicle = Vehicle-&gt;new( number_of_wheels =&gt; $wheels );

given ($vehicle) {
    say 'Vehicle has the same number of wheels as a two-wheeler!'
        when $two_wheeler;
    
    say 'Vehicle has the same number of wheels as a four-wheeler!'
        when $four_wheeler;
        
    say 'Gosh... is that Del Trotter!!'
        when $robin_reliant;
      
    default { 
        say   &quot;Don't know of a vehicle with that wheel arrangement!&quot;
    }
}
</pre></p>
<p>Hopefully that was a nice lightweight introduction to <code>given/when</code>.  And I haven&#8217;t even touched upon <a href="http://perldoc.perl.org/functions/break.html">break</a> or <a href="http://perldoc.perl.org/functions/continue.html">continue</a> <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>/I3az/</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/draegtun.wordpress.com/1072/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/draegtun.wordpress.com/1072/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/draegtun.wordpress.com/1072/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/draegtun.wordpress.com/1072/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/draegtun.wordpress.com/1072/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/draegtun.wordpress.com/1072/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/draegtun.wordpress.com/1072/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/draegtun.wordpress.com/1072/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/draegtun.wordpress.com/1072/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/draegtun.wordpress.com/1072/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/draegtun.wordpress.com/1072/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/draegtun.wordpress.com/1072/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/draegtun.wordpress.com/1072/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/draegtun.wordpress.com/1072/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=transfixedbutnotdead.com&#038;blog=351142&#038;post=1072&#038;subd=draegtun&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://transfixedbutnotdead.com/2010/08/30/givenwhen-the-perl-switch-statement/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/29cb106071d163d703484e63839d89cb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">draegtun</media:title>
		</media:content>
	</item>
		<item>
		<title>Mac OS X &#8220;Snow Leopard&#8221; (10.6) and Perl</title>
		<link>http://transfixedbutnotdead.com/2010/01/24/mac-os-x-snow-leopard-10-6-and-perl/</link>
		<comments>http://transfixedbutnotdead.com/2010/01/24/mac-os-x-snow-leopard-10-6-and-perl/#comments</comments>
		<pubDate>Sun, 24 Jan 2010 16:38:27 +0000</pubDate>
		<dc:creator>draegtun</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Mac OSX]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[perl 5.10]]></category>
		<category><![CDATA[Snow Leopard]]></category>

		<guid isPermaLink="false">http://transfixedbutnotdead.com/?p=831</guid>
		<description><![CDATA[Snow Leopard ships with multiple versions of Perl: 5.10.0 (64 bit) 5.10.0 (32 bit) 5.8.9 (32 bit) The default Perl is 5.10.0 (64 bit). However you can change this to 32-bit Perl by setting the following ENV shell variable: export VERSIONER_PERL_PREFER_32_BIT=yes And to switch to 5.8.9 all you need is this ENV variable set: export [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=transfixedbutnotdead.com&#038;blog=351142&#038;post=831&#038;subd=draegtun&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Snow Leopard ships with multiple versions of Perl:</p>
<ul>
<li>5.10.0 (64 bit)
<li>5.10.0 (32 bit)
<li>5.8.9  (32 bit)
</ul>
<p>The default Perl is 5.10.0 (64 bit).   However you can change this to 32-bit Perl by setting the following ENV shell variable:</p>
<p><code>export VERSIONER_PERL_PREFER_32_BIT=yes</code></p>
<p>And to switch to 5.8.9 all you need is this ENV variable set:</p>
<p><code>export VERSIONER_PERL_VERSION=5.8.9</code></p>
<p>Instead of setting these ENV variables in your Terminal sessions you can also make the change to the systems defaults:</p>
<ul>
<li>defaults write com.apple.versioner.perl Prefer-32-Bit -bool yes
<li>defaults write com.apple.versioner.perl Version 5.8.9
</ul>
<p>This is a interesting move by Apple and something which may come in very handy in the future.</p>
<p>As it stands at this moment though you probably want 5.10.1 (and beyond) because of issues with 5.10.0.  So you will probably be looking down the compiling route anyway.  Still it does give the future option of a <a href="http://search.cpan.org/dist/local-lib/">local::lib</a> possibility with the pre-installed Perl provided by Apple.</p>
<p><em>NB. I always recommend that you avoid installing modules with CPAN (shell) on OS provided Perl.  Always stick to the OS provided package installer to update Perl &amp; modules (which unfortunately for Mac&#8217;s means &#8220;zilch&#8221; <img src='http://s0.wp.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' />   Apple &#8220;Software Updater&#8221; may update Perl itself but no extra modules are provided above what Apple provides on top of core Perl)</em></p>
<p>/I3az/</p>
<p>References:</p>
<ul>
<li><a href="http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man1/perlmacosx5.10.0.1.html">README.macosx &#8211; Perl under Mac OS X</a>
<li><a href="http://use.perl.org/~pudge/journal/39596">Mac-Carbon Modules and Mac OS X 10.6</a>
<li><a href="http://daringfireball.net/2009/09/snow_leopard_applescript_perl_safari_webkit">Snow Leopard Compatibility Tweaks for That Thing I Wrote in January About Writing AppleScripts That Dynamically Target Either Safari or WebKit</a>
<li><a href="http://stackoverflow.com/questions/2092944/how-can-i-find-out-which-perl-version-was-available-on-older-mac-os-x-versions/2093325#2093325">How can I find out which Perl version was available on older Mac OS X versions?</a>
</ul>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/draegtun.wordpress.com/831/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/draegtun.wordpress.com/831/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/draegtun.wordpress.com/831/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/draegtun.wordpress.com/831/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/draegtun.wordpress.com/831/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/draegtun.wordpress.com/831/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/draegtun.wordpress.com/831/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/draegtun.wordpress.com/831/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/draegtun.wordpress.com/831/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/draegtun.wordpress.com/831/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/draegtun.wordpress.com/831/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/draegtun.wordpress.com/831/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/draegtun.wordpress.com/831/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/draegtun.wordpress.com/831/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=transfixedbutnotdead.com&#038;blog=351142&#038;post=831&#038;subd=draegtun&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://transfixedbutnotdead.com/2010/01/24/mac-os-x-snow-leopard-10-6-and-perl/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/29cb106071d163d703484e63839d89cb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">draegtun</media:title>
		</media:content>
	</item>
		<item>
		<title>Best things in life come in threes</title>
		<link>http://transfixedbutnotdead.com/2009/11/08/best-things-in-life-come-in-threes/</link>
		<comments>http://transfixedbutnotdead.com/2009/11/08/best-things-in-life-come-in-threes/#comments</comments>
		<pubDate>Sun, 08 Nov 2009 20:48:18 +0000</pubDate>
		<dc:creator>draegtun</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Padre]]></category>
		<category><![CDATA[parrot]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[perl 5.10]]></category>
		<category><![CDATA[perl6]]></category>
		<category><![CDATA[rakudo]]></category>

		<guid isPermaLink="false">http://transfixedbutnotdead.com/?p=675</guid>
		<description><![CDATA[Following on from my last post it seems I have also been waiting for a kind of virtual conjunction between Perl 5.10.1, Parrot 1.0 &#38; Padre being a year old. Perl 5.10.1 Currently I run 5.8.8 in production on all servers that I manage. I do have Perl 5.10.0 running locally on my Mac but [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=transfixedbutnotdead.com&#038;blog=351142&#038;post=675&#038;subd=draegtun&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Following on from my <a href="http://transfixedbutnotdead.com/2009/10/31/patience-is-a-virtue-2/">last post</a>  it seems I have also been waiting for a kind of virtual conjunction between <a href="http://www.h-online.com/open/news/item/Perl-5-10-1-released-743063.html">Perl 5.10.1</a>, <a href="http://perlbuzz.com/2009/03/parrot-100-has-been-released.html">Parrot 1.0</a> &amp; <a href="http://onionstand.blogspot.com/2009/07/on-padres-birthday-gift-to-you-042.html">Padre being a year old</a>.</p>
<p><strong>Perl 5.10.1</strong></p>
<p>Currently I run 5.8.8 in production on all servers that I manage.  I do have Perl 5.10.0 running locally on my Mac but only for playing with.  </p>
<p>So first step is to load Perl 5.10.1 on my Mac (Tiger) alongside my other Perl&#8217;s and then start testing &amp; with the plan to roll it out to replace 5.8.8 in the not too distant future.  </p>
<p>These are my steps to load 5.10.1 locally so that it doesn&#8217;t conflict with any other Perl I have here:</p>
<ul>
<li>Download &amp; unpack Perl source code in my normal user login</li>
<li>./Configure -de -Dusethreads -Dprefix=~/local/Perl/perl-5.10.1/</li>
<li>gmake</li>
<li>gmake test</li>
<li>gmake install-all</li>
</ul>
<p>I now have Perl 5.10.1 running out of my $HOME directory.   </p>
<p>This all worked fine except the default location of .cpan directory was in $HOME (~/.cpan).   This could clash with other locally installed Perl if nothing is done so I amended everything in cpan shell to use ~/local/Perl/perl-5.10.1/.cpan instead (I did this using &#8220;o conf&#8221;).</p>
<p>I then quickly blasted my new local Perl 5.10.1 with a few CPAN modules which included:</p>
<ul>
<li>Moose</li>
<li>MooseX::Declare</li>
<li>autobox::Core</li>
<li>DateTime</li>
<li>XML::LibXML</li>
<li>Devel::REPL</li>
</ul>
<p>All modules I selected installed without a single hitch.   CPAN comes up trumps again!</p>
<p>Devel::REPL was of great interest to me because when I last tried to install this on 5.8.8 &amp; 5.10.0 I did have some problems.   </p>
<p>This time it installed &amp; worked wonderfully.  Only slight issue was there was no command line history? (ie. readline).   This was easily resolved by loading Bundle::CPAN (which also gave cpan shell history as well!)</p>
<p><strong>Padre</strong></p>
<p>Normally I don&#8217;t compile Perl with threads.   However I needed it for Padre, which is something I forgot about when I last tried installing Padre on my local 5.10.0 <img src='http://s0.wp.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>I installed the following CPAN modules into my new Perl 5.10.1:</p>
<ul>
<li>Alien::wxWidgets</li>
<li>Wx</li>
<li>Padre</li>
</ul>
<p>All compiled &amp; installed seamlessly.   On starting Padre I got a nice pretty butterfly splash screen but then unfortunately it crashed <img src='http://s0.wp.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>As with most things in life if you not starting off with a clean slate then it may cause problems.  I had some residue stuff from previous attempt that was part of the problem.</p>
<p>Two things were needed resolve this stumbling block:</p>
<ul>
<li>Remove WxWidget which was installed via <a href="http://www.macports.org/">MacPorts</a>  (<code>sudo port deactivate wxWidgets</code>) </li>
<li>Make sure new Perl 5.10.1 was first Perl in $PATH env variable.  Because even though I was running 5.10.1 CPAN shell the Wx module seemed fixated on picking up Alien::wxWidgets from the first Perl it could get its hands on <img src='http://s2.wp.com/wp-includes/images/smilies/icon_razz.gif' alt=':-P' class='wp-smiley' />  </li>
</ul>
<p>After this reinstalling the Wx &amp; Padre modules gave me a fully functional Padre.</p>
<p><strong>Parrot 1.0 / Rakudo / Perl6</strong></p>
<p>I was now using Padre 0.48 to edit &amp; run my Perl 5.10.1 code.   Want I wanted now was to add Perl6 into the mix.   </p>
<p>For this I just followed the <a href="http://rakudo.org/how-to-get-rakudo">instructions from Rakudo site</a> and installed it in my local user dir with no hitch at all.</p>
<p>Next in Perl 5.10.1 I installed the <a href="http://search.cpan.org/dist/Padre-Plugin-Perl6/">Padre::Plugin::Perl6</a> to make Padre Perl6 aware.  My first bit of Perl6 code ran from Padre &amp; command line perfectly (don&#8217;t forget to add your rakudo path to $PATH env):</p>
<p><pre class="brush: perl;">
use v6;

for 1..10 { .say }

class Dog {
    method bark { &quot;woof&quot; }
}

my Dog $rover .= new;
my $spot = Dog.new;

say $rover.bark;
say $spot.bark;
</pre></p>
<p>&nbsp;</p>
<p>So where do I stand with <a href="http://padre.perlide.org/">Padre</a>?  Well I do love my <a href="http://macromates.com/">Textmate</a> so it is going to be hard to tug me away from it.  </p>
<p>But I love the idea of an editor being hosted and extensible in Perl.  So come my next round of free time I may find the tugging from Padre just to strong to resist <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>/I3az/</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/draegtun.wordpress.com/675/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/draegtun.wordpress.com/675/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/draegtun.wordpress.com/675/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/draegtun.wordpress.com/675/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/draegtun.wordpress.com/675/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/draegtun.wordpress.com/675/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/draegtun.wordpress.com/675/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/draegtun.wordpress.com/675/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/draegtun.wordpress.com/675/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/draegtun.wordpress.com/675/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/draegtun.wordpress.com/675/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/draegtun.wordpress.com/675/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/draegtun.wordpress.com/675/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/draegtun.wordpress.com/675/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=transfixedbutnotdead.com&#038;blog=351142&#038;post=675&#038;subd=draegtun&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://transfixedbutnotdead.com/2009/11/08/best-things-in-life-come-in-threes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/29cb106071d163d703484e63839d89cb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">draegtun</media:title>
		</media:content>
	</item>
		<item>
		<title>Pragma for fatal error exceptions in Perl 5.10.*</title>
		<link>http://transfixedbutnotdead.com/2008/06/10/fatal-error-exception-in-perl-510/</link>
		<comments>http://transfixedbutnotdead.com/2008/06/10/fatal-error-exception-in-perl-510/#comments</comments>
		<pubDate>Tue, 10 Jun 2008 09:41:45 +0000</pubDate>
		<dc:creator>draegtun</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[perl 5.10]]></category>

		<guid isPermaLink="false">http://draegtun.wordpress.com/?p=31</guid>
		<description><![CDATA[Potential new pragma called &#8220;autodie&#8221;. Like it! Like it even more if stuck with original codename of &#8220;lethal&#8221; More info at Paul Fenwick&#8217;s blog<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=transfixedbutnotdead.com&#038;blog=351142&#038;post=31&#038;subd=draegtun&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Potential new pragma called &#8220;autodie&#8221;.   Like it!   Like it even more if stuck with original codename of &#8220;lethal&#8221;  <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<span style="text-align:center; display: block;"><a href="http://transfixedbutnotdead.com/2008/06/10/fatal-error-exception-in-perl-510/"><img src="http://img.youtube.com/vi/9-nrwAUiIv8/2.jpg" alt="" /></a></span>
<p>More info at Paul Fenwick&#8217;s <a href="http://pjf.id.au/blog/?position=540">blog</a><br /></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/draegtun.wordpress.com/31/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/draegtun.wordpress.com/31/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/draegtun.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/draegtun.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/draegtun.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/draegtun.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/draegtun.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/draegtun.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/draegtun.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/draegtun.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/draegtun.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/draegtun.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/draegtun.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/draegtun.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/draegtun.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/draegtun.wordpress.com/31/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=transfixedbutnotdead.com&#038;blog=351142&#038;post=31&#038;subd=draegtun&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://transfixedbutnotdead.com/2008/06/10/fatal-error-exception-in-perl-510/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/29cb106071d163d703484e63839d89cb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">draegtun</media:title>
		</media:content>
	</item>
	</channel>
</rss>
