<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>Goldblog - Perl</title>
    <link>http://www.goldb.org/goldblog/</link>
    <description>Corey Goldberg - Technology | Software | Performance</description>
    <language>en-us</language>
    <copyright>Corey Goldberg</copyright>
    <lastBuildDate>Wed, 14 Nov 2007 20:45:26 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 1.9.6264.0</generator>
    <managingEditor>corey@goldb.org</managingEditor>
    <webMaster>corey@goldb.org</webMaster>
    <item>
      <trackback:ping>http://www.goldb.org/goldblog/Trackback.aspx?guid=9e825d49-1332-41a6-a1ab-2cb12750db09</trackback:ping>
      <pingback:server>http://www.goldb.org/goldblog/pingback.aspx</pingback:server>
      <pingback:target>http://www.goldb.org/goldblog/PermaLink,guid,9e825d49-1332-41a6-a1ab-2cb12750db09.aspx</pingback:target>
      <dc:creator>Corey Goldberg</dc:creator>
      <wfw:comment>http://www.goldb.org/goldblog/CommentView,guid,9e825d49-1332-41a6-a1ab-2cb12750db09.aspx</wfw:comment>
      <wfw:commentRss>http://www.goldb.org/goldblog/SyndicationService.asmx/GetEntryCommentsRss?guid=9e825d49-1332-41a6-a1ab-2cb12750db09</wfw:commentRss>
      <slash:comments>6</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I am a Python programmer and ex-Perl hacker. 
</p>
        <p>
Regular Expressions are possibly the quintessential feature of Perl and are directly
part of the language syntax. 
</p>
        <p>
Rather than being part of the syntax, Python's Regular expressions are available via
the 're' module. For some reason, I had some trouble figuring out matching groups
when I first started using Python's Regular Expressions. 
</p>
        <p>
He are examples of extracting capture groups in both Perl and Python. 
</p>
        <p>
Lets say we have a string containing a date: '11/14/2007', and we want to capture
only the year from this string. 
</p>
        <p>
A regex to match this format might be something like this: 
</p>
        <pre>
          <code class="geekcode">[0-9]{2}/[0-9]{2}/[0-9]{4} </code>
        </pre>
        <p>
We can then put parenthesis around the piece we want to extract (the 4-digit year)
to denote a capture group. 
</p>
        <p>
So now our regex would look like this: 
</p>
        <pre>
          <code class="geekcode">[0-9]{2}/[0-9]{2}/([0-9]{4}) </code>
        </pre>
        <p>
          <br />
        </p>
        <p>
          <strong>Perl Example:</strong>
        </p>
        <pre>
          <code class="geekcode">$foo = '11/14/2007'; if ($foo =~ m^[0-9]{2}/[0-9]{2}/([0-9]{4})^)
{ print $1; } </code>
        </pre>
        <p>
output: 
</p>
        <pre>
          <code class="geekcode">2007 </code>
        </pre>
        <p>
          <em>* Note the string we captured ended up in the special variable $1</em>
        </p>
        <p>
          <br />
        </p>
        <p>
          <strong>Python Example:</strong>
        </p>
        <pre>
          <code class="geekcode">import re foo = '11/14/2007' match = re.search('[0-9]{2}/[0-9]{2}/([0-9]{4})',
foo) if match: print match.group(1) </code>
        </pre>
        <p>
output: 
</p>
        <pre>
          <code class="geekcode">2007 </code>
        </pre>
        <p>
          <em>* Note the string we captured ended up in a match object, which can be accessed
with the 'group()' method.</em>
        </p>
      </body>
      <title>Regex Capture Groups In Python and Perl</title>
      <guid isPermaLink="false">http://www.goldb.org/goldblog/PermaLink,guid,9e825d49-1332-41a6-a1ab-2cb12750db09.aspx</guid>
      <link>http://www.goldb.org/goldblog/2007/11/14/RegexCaptureGroupsInPythonAndPerl.aspx</link>
      <pubDate>Wed, 14 Nov 2007 20:45:26 GMT</pubDate>
      <description>&lt;p&gt;
I am a Python programmer and ex-Perl hacker. 
&lt;/p&gt;
&lt;p&gt;
Regular Expressions are possibly the quintessential feature of Perl and are directly
part of the language syntax. 
&lt;/p&gt;
&lt;p&gt;
Rather than being part of the syntax, Python's Regular expressions are available via
the 're' module. For some reason, I had some trouble figuring out matching groups
when I first started using Python's Regular Expressions. 
&lt;/p&gt;
&lt;p&gt;
He are examples of extracting capture groups in both Perl and Python. 
&lt;/p&gt;
&lt;p&gt;
Lets say we have a string containing a date: '11/14/2007', and we want to capture
only the year from this string. 
&lt;/p&gt;
&lt;p&gt;
A regex to match this format might be something like this: 
&lt;/p&gt;
&lt;pre&gt;&lt;code class="geekcode"&gt;[0-9]{2}/[0-9]{2}/[0-9]{4} &lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
We can then put parenthesis around the piece we want to extract (the 4-digit year)
to denote a capture group. 
&lt;/p&gt;
&lt;p&gt;
So now our regex would look like this: 
&lt;/p&gt;
&lt;pre&gt;&lt;code class="geekcode"&gt;[0-9]{2}/[0-9]{2}/([0-9]{4}) &lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
&lt;br&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Perl Example:&lt;/strong&gt; 
&lt;/p&gt;
&lt;pre&gt;&lt;code class="geekcode"&gt;$foo = '11/14/2007'; if ($foo =~ m^[0-9]{2}/[0-9]{2}/([0-9]{4})^)
{ print $1; } &lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
output: 
&lt;/p&gt;
&lt;pre&gt;&lt;code class="geekcode"&gt;2007 &lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
&lt;em&gt;* Note the string we captured ended up in the special variable $1&lt;/em&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;br&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Python Example:&lt;/strong&gt; 
&lt;/p&gt;
&lt;pre&gt;&lt;code class="geekcode"&gt;import re foo = '11/14/2007' match = re.search('[0-9]{2}/[0-9]{2}/([0-9]{4})',
foo) if match: print match.group(1) &lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
output: 
&lt;/p&gt;
&lt;pre&gt;&lt;code class="geekcode"&gt;2007 &lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
&lt;em&gt;* Note the string we captured ended up in a match object, which can be accessed
with the 'group()' method.&lt;/em&gt; 
&lt;/p&gt;

</description>
      <comments>http://www.goldb.org/goldblog/CommentView,guid,9e825d49-1332-41a6-a1ab-2cb12750db09.aspx</comments>
      <category>Perl;Programming;Python</category>
    </item>
    <item>
      <trackback:ping>http://www.goldb.org/goldblog/Trackback.aspx?guid=0a2e1974-e028-490d-bdc4-8dc6b8419dee</trackback:ping>
      <pingback:server>http://www.goldb.org/goldblog/pingback.aspx</pingback:server>
      <pingback:target>http://www.goldb.org/goldblog/PermaLink,guid,0a2e1974-e028-490d-bdc4-8dc6b8419dee.aspx</pingback:target>
      <dc:creator>Corey Goldberg</dc:creator>
      <wfw:comment>http://www.goldb.org/goldblog/CommentView,guid,0a2e1974-e028-490d-bdc4-8dc6b8419dee.aspx</wfw:comment>
      <wfw:commentRss>http://www.goldb.org/goldblog/SyndicationService.asmx/GetEntryCommentsRss?guid=0a2e1974-e028-490d-bdc4-8dc6b8419dee</wfw:commentRss>
      <slash:comments>3</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
In a recent post: "<a href="http://www.terminally-incoherent.com/blog/index.php?p=1843">What
does your favorite text editor say about you</a>", the author lists popular text editors
and what they say about their users.  Here is the Editor or IDE I use with various
programming languages: 
</p>
        <p>
Python:  <strong>SciTE</strong><br />
Perl:  <strong>SciTE</strong><br />
C#:  <strong>Visual Studio</strong><br />
Java:  <strong>Eclipse</strong></p>
        <p>
I do all of my writing and a large portion of my programming in a plain old text editor. 
Most of the code I write is in Python.  I love using a lightweight text editor
instead of a big bloated IDE.  So... I pretty much live inside a text editor. 
</p>
        <p>
... and I love <a href="http://www.scintilla.org/SciTE.html">SciTE</a>.  It rocks
equally on Windows and GNU/Linux.  So what does this say about me? 
</p>
        <hr />
        <p>
          <strong>SciTE</strong>:<br /><em>"Your text editor is lightweight, full featured, extensible and cross platform.
In addition, it can work as a stand-alone executable which requires no installation.
Fits perfectly with all your other portable tools on your USB thumb drive. You also
love how SciTE let’s you write Lua scripts to extend it’s functionality. You take
your text editor choice very seriously. You like tinkering, and minimalistic, portable
applications."</em></p>
      </body>
      <title>My Text Editor - What SciTE Says About Me</title>
      <guid isPermaLink="false">http://www.goldb.org/goldblog/PermaLink,guid,0a2e1974-e028-490d-bdc4-8dc6b8419dee.aspx</guid>
      <link>http://www.goldb.org/goldblog/2007/08/22/MyTextEditorWhatSciTESaysAboutMe.aspx</link>
      <pubDate>Wed, 22 Aug 2007 15:00:05 GMT</pubDate>
      <description>&lt;p&gt;
In a recent post: "&lt;a href="http://www.terminally-incoherent.com/blog/index.php?p=1843"&gt;What
does your favorite text editor say about you&lt;/a&gt;", the author lists popular text editors
and what they say about their users.&amp;nbsp; Here is the Editor or IDE I use with various
programming languages: 
&lt;/p&gt;
&lt;p&gt;
Python:&amp;nbsp; &lt;strong&gt;SciTE&lt;/strong&gt;
&lt;br&gt;
Perl:&amp;nbsp; &lt;strong&gt;SciTE&lt;/strong&gt;
&lt;br&gt;
C#:&amp;nbsp; &lt;strong&gt;Visual Studio&lt;/strong&gt;
&lt;br&gt;
Java:&amp;nbsp; &lt;strong&gt;Eclipse&lt;/strong&gt; 
&lt;/p&gt;
&lt;p&gt;
I do all of my writing and a large portion of my programming in a plain old text editor.&amp;nbsp;
Most of the code I write is in Python.&amp;nbsp; I love using a lightweight text editor
instead of a big bloated IDE.&amp;nbsp; So... I pretty much live inside a text editor. 
&lt;/p&gt;
&lt;p&gt;
... and I love &lt;a href="http://www.scintilla.org/SciTE.html"&gt;SciTE&lt;/a&gt;.&amp;nbsp; It rocks
equally on Windows and GNU/Linux.&amp;nbsp; So what does this say about me? 
&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;
&lt;strong&gt;SciTE&lt;/strong&gt;:&lt;br&gt;
&lt;em&gt;"Your text editor is lightweight, full featured, extensible and cross platform.
In addition, it can work as a stand-alone executable which requires no installation.
Fits perfectly with all your other portable tools on your USB thumb drive. You also
love how SciTE let’s you write Lua scripts to extend it’s functionality. You take
your text editor choice very seriously. You like tinkering, and minimalistic, portable
applications."&lt;/em&gt; 
&lt;/p&gt;


</description>
      <comments>http://www.goldb.org/goldblog/CommentView,guid,0a2e1974-e028-490d-bdc4-8dc6b8419dee.aspx</comments>
      <category>C#;Java;Perl;Programming;Python</category>
    </item>
    <item>
      <trackback:ping>http://www.goldb.org/goldblog/Trackback.aspx?guid=5f2aa378-309d-48c2-a1b3-bdebcf902d48</trackback:ping>
      <pingback:server>http://www.goldb.org/goldblog/pingback.aspx</pingback:server>
      <pingback:target>http://www.goldb.org/goldblog/PermaLink,guid,5f2aa378-309d-48c2-a1b3-bdebcf902d48.aspx</pingback:target>
      <dc:creator>Corey Goldberg</dc:creator>
      <wfw:comment>http://www.goldb.org/goldblog/CommentView,guid,5f2aa378-309d-48c2-a1b3-bdebcf902d48.aspx</wfw:comment>
      <wfw:commentRss>http://www.goldb.org/goldblog/SyndicationService.asmx/GetEntryCommentsRss?guid=5f2aa378-309d-48c2-a1b3-bdebcf902d48</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I just got the <a href="http://www.oreilly.com/catalog/9780596529260/">RESTful Web
Services</a> book (Leonard Richardson &amp; <a href="http://intertwingly.net/blog/">Sam
Ruby</a>, O'Reilly, 2007) in the mail today.  I've only read the beginning, but
so far it is great.  In fact, it brings me back to when I first started working
with the "programmable web".  I got into the programmable web back when the web
was only a few years old.  I spent years doing performance/scalability testing
and tuning for large Web 1.0 applications and bizarre custom Web API's (think huge
financial services rushing to get online).  Building tools to run realistic workloads
through a system involves writing custom clients to simulate real user/browser interaction. 
This is pretty ugly stuff when you are dealing with an application that was designed
with only humans in mind (AKA all).  It involves lots of HTTP protocol level
work.. screen scraping.. protocol sniffing and analyzing.. requests.. header mangling..
cookie handling.. redirects.. authentication.. session information parsing.. etc,
etc.
</p>
        <p>
Application simulation is pretty messy work.  There is no simple API to hide
behind; you had to figure out what the API was for yourself.  See.. *every* web
application has an API.  Though it might have been designed by accident. 
This allowed me to see first hand how developers and frameworks butchered the use
of the "Web" as a platform.  Staring at naked HTTP let me see every little bit
of the hairball underneath.  Alas, any standardization around web services (or
the concept to be officially named) was far off.
</p>
        <p>
A friend (bearded Perl hacker) let me borrow a book to show me how Perl can do this
cool web stuff:  <a href="http://www.oreilly.com/openbook/webclient/">Web Client
Programming with Perl</a> (Clinton Wong, O'Reilly, 1997).  This book helped me
build my first web clients to do application simulation and testing.  There wasn't
a ton of documentation at the time to do this sort of thing, so i relied heavily on
this book.<br /><br />
So now.. 10 years later..  the Web has changed..  it has morphed into *the*
distributed platform..  it is becoming organized.<br /><br />
As I flip through Restful Web Services, it all just looks right..  REST looks
right..   It is simple..  it is HTTP..  it is all the guts I already
know.  It almost feels like a sequel to my old favorite:
</p>
        <img src="http://www.goldb.org/goldblog/cmg_images/webservices_rest.jpg" />
        <p>
I have traded Perl for Python as my preferred scripting language the past few years,
but I am still building simulators, web clients, and virtual users. I am excited to
work on some new stuff in this area.
</p>
      </body>
      <title>RESTful Web Services - 10 Years of 'Programmable Web' Books</title>
      <guid isPermaLink="false">http://www.goldb.org/goldblog/PermaLink,guid,5f2aa378-309d-48c2-a1b3-bdebcf902d48.aspx</guid>
      <link>http://www.goldb.org/goldblog/2007/05/18/RESTfulWebServices10YearsOfProgrammableWebBooks.aspx</link>
      <pubDate>Fri, 18 May 2007 01:30:37 GMT</pubDate>
      <description>&lt;p&gt;
I just got the &lt;a href="http://www.oreilly.com/catalog/9780596529260/"&gt;RESTful Web
Services&lt;/a&gt; book (Leonard Richardson &amp;amp; &lt;a href="http://intertwingly.net/blog/"&gt;Sam
Ruby&lt;/a&gt;, O'Reilly, 2007) in the mail today.&amp;nbsp; I've only read the beginning, but
so far it is great.&amp;nbsp; In fact, it brings me back to when I first started working
with the "programmable web".&amp;nbsp; I got into the programmable web back when the web
was only a few years old.&amp;nbsp; I spent years doing performance/scalability testing
and tuning for large Web 1.0 applications and bizarre custom Web API's (think huge
financial services rushing to get online).&amp;nbsp; Building tools to run realistic workloads
through a system involves writing custom clients to simulate real user/browser interaction.&amp;nbsp;
This is pretty ugly stuff when you are dealing with an application that was designed
with only humans in mind (AKA all).&amp;nbsp; It involves lots of HTTP protocol level
work.. screen scraping.. protocol sniffing and analyzing.. requests.. header mangling..
cookie handling.. redirects.. authentication.. session information parsing.. etc,
etc.
&lt;/p&gt;
&lt;p&gt;
Application simulation is pretty messy work.&amp;nbsp; There is no simple API to hide
behind; you had to figure out what the API was for yourself.&amp;nbsp; See.. *every* web
application has an API.&amp;nbsp; Though it might have been designed by accident.&amp;nbsp;
This allowed me to see first hand how developers and frameworks butchered the use
of the "Web" as a platform.&amp;nbsp; Staring at naked HTTP let me see every little bit
of the hairball underneath.&amp;nbsp; Alas, any standardization around web services (or
the concept to be officially named) was far off.
&lt;/p&gt;
&lt;p&gt;
A friend (bearded Perl hacker) let me borrow a book to show me how Perl can do this
cool web stuff:&amp;nbsp; &lt;a href="http://www.oreilly.com/openbook/webclient/"&gt;Web Client
Programming with Perl&lt;/a&gt; (Clinton Wong, O'Reilly, 1997).&amp;nbsp; This book helped me
build my first web clients to do application simulation and testing.&amp;nbsp; There wasn't
a ton of documentation at the time to do this sort of thing, so i relied heavily on
this book.&lt;br&gt;
&lt;br&gt;
So now.. 10 years later..&amp;nbsp; the Web has changed..&amp;nbsp; it has morphed into *the*
distributed platform..&amp;nbsp; it is becoming organized.&lt;br&gt;
&lt;br&gt;
As I flip through Restful Web Services, it all just looks right..&amp;nbsp; REST looks
right..&amp;nbsp;&amp;nbsp; It is simple..&amp;nbsp; it is HTTP..&amp;nbsp; it is all the guts I already
know.&amp;nbsp; It almost feels like a sequel to my old favorite:
&lt;/p&gt;
&lt;img src="http://www.goldb.org/goldblog/cmg_images/webservices_rest.jpg"&gt; 
&lt;p&gt;
I have traded Perl for Python as my preferred scripting language the past few years,
but I am still building simulators, web clients, and virtual users. I am excited to
work on some new stuff in this area.
&lt;/p&gt;</description>
      <comments>http://www.goldb.org/goldblog/CommentView,guid,5f2aa378-309d-48c2-a1b3-bdebcf902d48.aspx</comments>
      <category>Distributed Systems;Performance;Perl;Programming;Python;Testing;Web</category>
    </item>
    <item>
      <trackback:ping>http://www.goldb.org/goldblog/Trackback.aspx?guid=cd3bcd0f-4dc5-402e-9387-dc912e80f8a4</trackback:ping>
      <pingback:server>http://www.goldb.org/goldblog/pingback.aspx</pingback:server>
      <pingback:target>http://www.goldb.org/goldblog/PermaLink,guid,cd3bcd0f-4dc5-402e-9387-dc912e80f8a4.aspx</pingback:target>
      <dc:creator>Corey Goldberg</dc:creator>
      <wfw:comment>http://www.goldb.org/goldblog/CommentView,guid,cd3bcd0f-4dc5-402e-9387-dc912e80f8a4.aspx</wfw:comment>
      <wfw:commentRss>http://www.goldb.org/goldblog/SyndicationService.asmx/GetEntryCommentsRss?guid=cd3bcd0f-4dc5-402e-9387-dc912e80f8a4</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
The <a href="http://www.perlfoundation.org/">Perl Foundation</a> won't be involved
in Google Summer of Code 2007.
</p>
        <p>
          <a href="http://news.perl-foundation.org/2007/03/tpf_and_soc_2007.html">Bill Odom</a>:
</p>
        <blockquote>
          <em>"The short version: We submitted an application to be a mentoring
organization, but we weren't accepted."</em>
        </blockquote>
        <p>
However, even without the Perl community represented, the <a href="http://code.google.com/soc">list
of mentoring organizations and projects</a> is really good! 
</p>
      </body>
      <title>Google Summer of Code 2007 - No Perl for You</title>
      <guid isPermaLink="false">http://www.goldb.org/goldblog/PermaLink,guid,cd3bcd0f-4dc5-402e-9387-dc912e80f8a4.aspx</guid>
      <link>http://www.goldb.org/goldblog/2007/03/21/GoogleSummerOfCode2007NoPerlForYou.aspx</link>
      <pubDate>Wed, 21 Mar 2007 12:02:19 GMT</pubDate>
      <description>&lt;p&gt;
The &lt;a href="http://www.perlfoundation.org/"&gt;Perl Foundation&lt;/a&gt; won't be involved
in Google Summer of Code 2007.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://news.perl-foundation.org/2007/03/tpf_and_soc_2007.html"&gt;Bill Odom&lt;/a&gt;:
&lt;/p&gt;
&lt;blockquote&gt; &lt;em&gt;"The short version: We submitted an application to be a mentoring
organization, but we weren't accepted."&lt;/em&gt; &lt;/blockquote&gt; 
&lt;p&gt;
However, even without the Perl community represented, the &lt;a href="http://code.google.com/soc"&gt;list
of mentoring organizations and projects&lt;/a&gt; is really good! 
&lt;/p&gt;</description>
      <comments>http://www.goldb.org/goldblog/CommentView,guid,cd3bcd0f-4dc5-402e-9387-dc912e80f8a4.aspx</comments>
      <category>Open Source;Perl</category>
    </item>
    <item>
      <trackback:ping>http://www.goldb.org/goldblog/Trackback.aspx?guid=e1a59762-8878-461f-9197-bba5f781abcd</trackback:ping>
      <pingback:server>http://www.goldb.org/goldblog/pingback.aspx</pingback:server>
      <pingback:target>http://www.goldb.org/goldblog/PermaLink,guid,e1a59762-8878-461f-9197-bba5f781abcd.aspx</pingback:target>
      <dc:creator>Corey Goldberg</dc:creator>
      <wfw:comment>http://www.goldb.org/goldblog/CommentView,guid,e1a59762-8878-461f-9197-bba5f781abcd.aspx</wfw:comment>
      <wfw:commentRss>http://www.goldb.org/goldblog/SyndicationService.asmx/GetEntryCommentsRss?guid=e1a59762-8878-461f-9197-bba5f781abcd</wfw:commentRss>
      <slash:comments>6</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <a href="http://dev.perl.org/perl6/">Perl6</a>...<br /><a href="http://www.python.org/dev/peps/pep-3000/">Python3000</a>... 
</p>
        <p>
Both are redesigns of very popular dynamic/scripting languages.  Both have very
strong, <a href="http://mythago.net/blog.rv?id=7">though very different</a>, communities
supporting them. 
</p>
        <p>
Out of the gate, Perl's plans were much more ambitious, including a new <a temp_href="http://www.parrotcode.org/ for running dynamic languages" href="http://www.parrotcode.org/%20for%20running%20dynamic%20languages">generic
virtual machine</a>.  Python's plans were more pragmatic; more of a language
cleanup than a drastic redesign. 
</p>
        <p>
Perl 6 was officially announced nearly 7 years ago and I don't see a stable production
release <a href="http://www.goldb.org/goldblog/2006/11/05/Perl6TheLongWait.aspx">coming
*any* time soon</a>.  On the other hand, the idea of Python3000 was sorta tossed
around for a while and swung into gear 2 years ago. 
</p>
        <p>
          <a href="http://en.wikipedia.org/wiki/Guido_van_Rossum"> Guido (Python's BDFL)</a> has
been spearheading the effort, whereas Perl's leadership structure is much more anarchic
(Where is Larry Wall these days?).  Guido has been very transparent and <a href="http://mail.python.org/pipermail/python-3000/2006-December/005128.html">kept
the community aware of his worries</a>.<br /></p>
        <p>
Some people saw this as a slippery slope... 
</p>
        <p>
          <a href="http://www.oreillynet.com/onlamp/blog/2006/12/dear_python_3000_bdfl.html"> Chromatic</a>:<br /></p>
        <blockquote>
          <em> "Language redesign is difficult, isn’t it?  Once you start
challenging base assumptions, you find that a lot of your previous conclusions are
shaky, and good luck reigning in blue-sky ideas!<br /><br />
See you in 2007… or 2008… or 2009.<br /><br />
Best wishes,<br />
a Perl 6 hacker" </em>
        </blockquote>
        <p>
I disagree.. 
</p>
        <p>
I'd bet anyone money that I will be hacking on a stable release of Python3000 long
before I'm using a stable version of Perl6... any takers? 
</p>
        <p>
          <br />
        </p>
        <p>
          <em>(disclosure: <a href="http://www.goldb.org">I have written lots of code in both
Perl and Python</a> and am a fan of both)</em>
        </p>
      </body>
      <title>Python3000 vs. Perl6 ... Wanna Bet?</title>
      <guid isPermaLink="false">http://www.goldb.org/goldblog/PermaLink,guid,e1a59762-8878-461f-9197-bba5f781abcd.aspx</guid>
      <link>http://www.goldb.org/goldblog/2007/03/17/Python3000VsPerl6WannaBet.aspx</link>
      <pubDate>Sat, 17 Mar 2007 16:15:59 GMT</pubDate>
      <description>&lt;p&gt;
&lt;a href="http://dev.perl.org/perl6/"&gt;Perl6&lt;/a&gt;...&lt;br&gt;
&lt;a href="http://www.python.org/dev/peps/pep-3000/"&gt;Python3000&lt;/a&gt;... 
&lt;/p&gt;
&lt;p&gt;
Both are redesigns of very popular dynamic/scripting languages.&amp;nbsp; Both have very
strong, &lt;a href="http://mythago.net/blog.rv?id=7"&gt;though very different&lt;/a&gt;, communities
supporting them. 
&lt;/p&gt;
&lt;p&gt;
Out of the gate, Perl's plans were much more ambitious, including a new &lt;a temp_href="http://www.parrotcode.org/ for running dynamic languages" href="http://www.parrotcode.org/%20for%20running%20dynamic%20languages"&gt;generic
virtual machine&lt;/a&gt;.&amp;nbsp; Python's plans were more pragmatic; more of a language
cleanup than a drastic redesign. 
&lt;/p&gt;
&lt;p&gt;
Perl 6 was officially announced nearly 7 years ago and I don't see a stable production
release &lt;a href="http://www.goldb.org/goldblog/2006/11/05/Perl6TheLongWait.aspx"&gt;coming
*any* time soon&lt;/a&gt;.&amp;nbsp; On the other hand, the idea of Python3000 was sorta tossed
around for a while and swung into gear 2 years ago. 
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://en.wikipedia.org/wiki/Guido_van_Rossum"&gt; Guido (Python's BDFL)&lt;/a&gt; has
been spearheading the effort, whereas Perl's leadership structure is much more anarchic
(Where is Larry Wall these days?).&amp;nbsp; Guido has been very transparent and &lt;a href="http://mail.python.org/pipermail/python-3000/2006-December/005128.html"&gt;kept
the community aware of his worries&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;
&lt;p&gt;
Some people saw this as a slippery slope... 
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.oreillynet.com/onlamp/blog/2006/12/dear_python_3000_bdfl.html"&gt; Chromatic&lt;/a&gt;:&lt;br&gt;
&lt;/p&gt;
&lt;blockquote&gt; &lt;em&gt; "Language redesign is difficult, isn’t it?&amp;nbsp; Once you start
challenging base assumptions, you find that a lot of your previous conclusions are
shaky, and good luck reigning in blue-sky ideas!&lt;br&gt;
&lt;br&gt;
See you in 2007… or 2008… or 2009.&lt;br&gt;
&lt;br&gt;
Best wishes,&lt;br&gt;
a Perl 6 hacker" &lt;/em&gt; &lt;/blockquote&gt; 
&lt;p&gt;
I disagree.. 
&lt;/p&gt;
&lt;p&gt;
I'd bet anyone money that I will be hacking on a stable release of Python3000 long
before I'm using a stable version of Perl6... any takers? 
&lt;/p&gt;
&lt;p&gt;
&lt;br&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;em&gt;(disclosure: &lt;a href="http://www.goldb.org"&gt;I have written lots of code in both
Perl and Python&lt;/a&gt; and am a fan of both)&lt;/em&gt;
&lt;/p&gt;</description>
      <comments>http://www.goldb.org/goldblog/CommentView,guid,e1a59762-8878-461f-9197-bba5f781abcd.aspx</comments>
      <category>Perl;Programming;Python</category>
    </item>
    <item>
      <trackback:ping>http://www.goldb.org/goldblog/Trackback.aspx?guid=a858e606-de5d-4378-b538-8d4738cd9438</trackback:ping>
      <pingback:server>http://www.goldb.org/goldblog/pingback.aspx</pingback:server>
      <pingback:target>http://www.goldb.org/goldblog/PermaLink,guid,a858e606-de5d-4378-b538-8d4738cd9438.aspx</pingback:target>
      <dc:creator>Corey Goldberg</dc:creator>
      <wfw:comment>http://www.goldb.org/goldblog/CommentView,guid,a858e606-de5d-4378-b538-8d4738cd9438.aspx</wfw:comment>
      <wfw:commentRss>http://www.goldb.org/goldblog/SyndicationService.asmx/GetEntryCommentsRss?guid=a858e606-de5d-4378-b538-8d4738cd9438</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
A common idiom in Perl 5 is "slurping".  Slurping is the process of reading a
file into an array, split by line breaks.  You can then iterate over the array
and perform an operation on each line.  This is the basic input mechanism I use
to process all sorts of data/text files.
</p>
        <p>
          <br />
        </p>
        <p>
The basic slurp goes like this...
</p>
        <p>
Open a file in read mode and assign it a file handle:
</p>
        <pre>
          <div class="geekcode">open(FILE, 'foo.txt') or die $!; 
</div>
        </pre>
        <p>
Read (slurp) the file into an array of lines (splitting the file on newlines):
</p>
        <pre>
          <div class="geekcode">@file = &lt;FILE&gt;; 
</div>
        </pre>
        <p>
          <br />
        </p>
        <p>
You can then process the array in a foreach loop and "Un-slurp" (De-slurp?) it back
to the file system like this...
</p>
        <p>
Now we have an array which we can iterate through and do whatever we want with each
line:
</p>
        <pre>
          <div class="geekcode">foreach (@file) { # do something here } 
</div>
        </pre>
        <p>
Re-open the file in overwrite mode:
</p>
        <pre>
          <div class="geekcode">open(FILE, '&gt;foo.txt') or die $!; 
</div>
        </pre>
        <p>
Print the contents of the array back to the file:
</p>
        <pre>
          <div class="geekcode">print FILE @file; 
</div>
        </pre>
        <p>
          <br />
        </p>
        <p>
The following script shows some slurping in a action. This script will read a file
named "foo.txt" and replace all intances of "foo" with "bar"
</p>
        <pre>
          <div class="geekcode">
#!/usr/bin/perl replace('foo.txt', 'foo', 'bar'); sub replace { ($filename, $original,
$substituted) = @_; open(FILE, $filename) or die $!; @file = ; foreach (@file) { s/$original/$substituted/g;
} open(FILE, '&gt;foo.txt') or die $!; print FILE @file; } 
</div>
        </pre>
      </body>
      <title>Perl - File Slurping</title>
      <guid isPermaLink="false">http://www.goldb.org/goldblog/PermaLink,guid,a858e606-de5d-4378-b538-8d4738cd9438.aspx</guid>
      <link>http://www.goldb.org/goldblog/2007/02/15/PerlFileSlurping.aspx</link>
      <pubDate>Thu, 15 Feb 2007 20:34:55 GMT</pubDate>
      <description>&lt;p&gt;
A common idiom in Perl 5 is "slurping".&amp;nbsp; Slurping is the process of reading a
file into an array, split by line breaks. &amp;nbsp;You can then iterate over the array
and perform an operation on each line. &amp;nbsp;This is the basic input mechanism I use
to process all sorts of data/text files.
&lt;/p&gt;
&lt;p&gt;
&lt;br&gt;
&lt;/p&gt;
&lt;p&gt;
The basic slurp goes like this...
&lt;/p&gt;
&lt;p&gt;
Open a file in read mode and assign it a file handle:
&lt;/p&gt;
&lt;pre&gt;
&lt;div class="geekcode"&gt;open(FILE, 'foo.txt') or die $!; 
&lt;/div&gt;
&lt;/pre&gt;
&lt;p&gt;
Read (slurp) the file into an array of lines (splitting the file on newlines):
&lt;/p&gt;
&lt;pre&gt;
&lt;div class="geekcode"&gt;@file = &amp;lt;FILE&amp;gt;; 
&lt;/div&gt;
&lt;/pre&gt;
&lt;p&gt;
&lt;br&gt;
&lt;/p&gt;
&lt;p&gt;
You can then process the array in a foreach loop and "Un-slurp" (De-slurp?) it back
to the file system like this...
&lt;/p&gt;
&lt;p&gt;
Now we have an array which we can iterate through and do whatever we want with each
line:
&lt;/p&gt;
&lt;pre&gt;
&lt;div class="geekcode"&gt;foreach (@file) { # do something here } 
&lt;/div&gt;
&lt;/pre&gt;
&lt;p&gt;
Re-open the file in overwrite mode:
&lt;/p&gt;
&lt;pre&gt;
&lt;div class="geekcode"&gt;open(FILE, '&amp;gt;foo.txt') or die $!; 
&lt;/div&gt;
&lt;/pre&gt;
&lt;p&gt;
Print the contents of the array back to the file:
&lt;/p&gt;
&lt;pre&gt;
&lt;div class="geekcode"&gt;print FILE @file; 
&lt;/div&gt;
&lt;/pre&gt;
&lt;p&gt;
&lt;br&gt;
&lt;/p&gt;
&lt;p&gt;
The following script shows some slurping in a action. This script will read a file
named "foo.txt" and replace all intances of "foo" with "bar"
&lt;/p&gt;
&lt;pre&gt;
&lt;div class="geekcode"&gt;
#!/usr/bin/perl replace('foo.txt', 'foo', 'bar'); sub replace { ($filename, $original,
$substituted) = @_; open(FILE, $filename) or die $!; @file = ; foreach (@file) { s/$original/$substituted/g;
} open(FILE, '&amp;gt;foo.txt') or die $!; print FILE @file; } 
&lt;/div&gt;
&lt;/pre&gt;
</description>
      <comments>http://www.goldb.org/goldblog/CommentView,guid,a858e606-de5d-4378-b538-8d4738cd9438.aspx</comments>
      <category>Perl;Programming</category>
    </item>
    <item>
      <trackback:ping>http://www.goldb.org/goldblog/Trackback.aspx?guid=f532e9ab-6bfa-48af-b971-cd04631562d4</trackback:ping>
      <pingback:server>http://www.goldb.org/goldblog/pingback.aspx</pingback:server>
      <pingback:target>http://www.goldb.org/goldblog/PermaLink,guid,f532e9ab-6bfa-48af-b971-cd04631562d4.aspx</pingback:target>
      <dc:creator>Corey Goldberg</dc:creator>
      <wfw:comment>http://www.goldb.org/goldblog/CommentView,guid,f532e9ab-6bfa-48af-b971-cd04631562d4.aspx</wfw:comment>
      <wfw:commentRss>http://www.goldb.org/goldblog/SyndicationService.asmx/GetEntryCommentsRss?guid=f532e9ab-6bfa-48af-b971-cd04631562d4</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <em>(* I am not affiliated with Slim Devices.. this is just a fanboy post.)</em>
        </p>
        <p>
I wanted to hook up something that would integrate my home PC (jacked full of glorious
DRM-free MP3's) and my home audio system. I didn't want to go the full <a href="http://en.wikipedia.org/wiki/HTPC">HTPC</a> route,
I am more of an audio guy and my immediate need is for an audio-only solution. 
</p>
        <p>
After browsing the various Media Servers, Sound Cards, External Components, and other
music playing gizmos; I finally figured out the type of unit I was looking for and
what it should do... 
</p>
        <p>
Here are my requirements: 
</p>
        <ul>
          <li>
Must be able to play the MP3's stored on my computer</li>
          <li>
Must have a cross platform client application (I use both Linux and Windows at home)</li>
          <li>
Must have high quality analog and digital output that can connect to my receiver/amp</li>
          <li>
Must have a remote with basic controls (volume, tuning, select, etc)</li>
          <li>
Must be able to control it from my computer (change songs, playlists, etc)</li>
          <li>
Must be able to stream Internet Radio (of some sort)</li>
          <li>
No wires connected to my PC</li>
        </ul>
        <p>
Obviously some of these requirements became apparent when I read about the <a href="http://www.slimdevices.com/pi_squeezebox.html">Squeezebox</a> from <a href="http://www.slimdevices.com">Slim
Devices</a>.  It seems to do everything I need (and more), and isn't outrageously
expensive ($299 retail). 
</p>
        <img src="http://www.goldb.org/goldblog/cmg_images/squeezebox_front.jpg" />
        <br />
        <img src="http://www.goldb.org/goldblog/cmg_images/squeezebox_back.jpg" />
        <br />
        <p>
So I ended up ordering one of these bad boys to play around with.  (of course
I got the all black version)
</p>
        <p>
        </p>
        <p>
OK.. but now the real reason I chose the Squeezebox... It is <a href="http://www.eetimes.com/showArticle.jhtml?articleID=26806405">Open
Source</a> and has a <a href="http://www.slimdevices.com/dev_overview.html">developer
community</a>! 
</p>
        <p>
Well... it is sort of Open Source.  Its SlimServer software (the audio server
software) is <a href="http://www.gnu.org/copyleft/gpl.html">GPL licensed</a>, so the <a href="http://www.slimdevices.com/dev_resources.html">Source
Code</a> is available to modify, hack, and contribute to.  But.. the device's
firmware is proprietary and closed (boo). 
</p>
        <p>
The real kicker came when I realized that the SlimServer is written in <a href="http://www.perl.org/">Perl</a> It
is web based, and uses templated HTML/CSS.  Hmm.. I've written a Perl program
or 2 [thousand] in my day... this could get interesting.  I already have SlimServer
running from Source and I am making little tweaks to the interface to customize it
for myself.  Hopefully someday I'll do something worth contributing back... 
I love that I have the option. 
</p>
        <p>
... More to come once I actually get the Sqeezebox and hook it up..  I just ordered
it last night. 
</p>
        <p>
        </p>
      </body>
      <title>Sqeezebox - Hackable Device For Streaming My Tunes</title>
      <guid isPermaLink="false">http://www.goldb.org/goldblog/PermaLink,guid,f532e9ab-6bfa-48af-b971-cd04631562d4.aspx</guid>
      <link>http://www.goldb.org/goldblog/2007/02/11/SqeezeboxHackableDeviceForStreamingMyTunes.aspx</link>
      <pubDate>Sun, 11 Feb 2007 20:13:30 GMT</pubDate>
      <description>&lt;p&gt;
&lt;em&gt;(* I am not affiliated with Slim Devices.. this is just a fanboy post.)&lt;/em&gt; 
&lt;/p&gt;
&lt;p&gt;
I wanted to hook up something that would integrate my home PC (jacked full of glorious
DRM-free MP3's) and my home audio system. I didn't want to go the full &lt;a href="http://en.wikipedia.org/wiki/HTPC"&gt;HTPC&lt;/a&gt; route,
I am more of an audio guy and my immediate need is for an audio-only solution. 
&lt;/p&gt;
&lt;p&gt;
After browsing the various Media Servers, Sound Cards, External Components, and other
music playing gizmos; I finally figured out the type of unit I was looking for and
what it should do... 
&lt;/p&gt;
&lt;p&gt;
Here are my requirements: 
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Must be able to play the MP3's stored on my computer&lt;/li&gt;
&lt;li&gt;
Must have a cross platform client application (I use both Linux and Windows at home)&lt;/li&gt;
&lt;li&gt;
Must have high quality analog and digital output that can connect to my receiver/amp&lt;/li&gt;
&lt;li&gt;
Must have a remote with basic controls (volume, tuning, select, etc)&lt;/li&gt;
&lt;li&gt;
Must be able to control it from my computer (change songs, playlists, etc)&lt;/li&gt;
&lt;li&gt;
Must be able to stream Internet Radio (of some sort)&lt;/li&gt;
&lt;li&gt;
No wires connected to my PC&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Obviously some of these requirements became apparent when I read about the &lt;a href="http://www.slimdevices.com/pi_squeezebox.html"&gt;Squeezebox&lt;/a&gt; from &lt;a href="http://www.slimdevices.com"&gt;Slim
Devices&lt;/a&gt;.&amp;nbsp; It seems to do everything I need (and more), and isn't outrageously
expensive ($299 retail). 
&lt;/p&gt;
&lt;img src="http://www.goldb.org/goldblog/cmg_images/squeezebox_front.jpg"&gt;
&lt;br&gt;
&lt;img src="http://www.goldb.org/goldblog/cmg_images/squeezebox_back.jpg"&gt;
&lt;br&gt;
&lt;p&gt;
So I ended up ordering one of these bad boys to play around with.&amp;nbsp; (of course
I got the all black version)
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
OK.. but now the real reason I chose the Squeezebox... It is &lt;a href="http://www.eetimes.com/showArticle.jhtml?articleID=26806405"&gt;Open
Source&lt;/a&gt; and has a &lt;a href="http://www.slimdevices.com/dev_overview.html"&gt;developer
community&lt;/a&gt;! 
&lt;/p&gt;
&lt;p&gt;
Well... it is sort of Open Source.&amp;nbsp; Its SlimServer software (the audio server
software) is &lt;a href="http://www.gnu.org/copyleft/gpl.html"&gt;GPL licensed&lt;/a&gt;, so the &lt;a href="http://www.slimdevices.com/dev_resources.html"&gt;Source
Code&lt;/a&gt; is available to modify, hack, and contribute to.&amp;nbsp; But.. the device's
firmware is proprietary and closed (boo). 
&lt;/p&gt;
&lt;p&gt;
The real kicker came when I realized that the SlimServer is written in &lt;a href="http://www.perl.org/"&gt;Perl&lt;/a&gt; It
is web based, and uses templated HTML/CSS.&amp;nbsp; Hmm.. I've written a Perl program
or 2 [thousand] in my day... this could get interesting.&amp;nbsp; I already have SlimServer
running from Source and I am making little tweaks to the interface to customize it
for myself.&amp;nbsp; Hopefully someday I'll do something worth contributing back...&amp;nbsp;
I love that I have the option. 
&lt;/p&gt;
&lt;p&gt;
... More to come once I actually get the Sqeezebox and hook it up..&amp;nbsp; I just ordered
it last night. 
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;</description>
      <comments>http://www.goldb.org/goldblog/CommentView,guid,f532e9ab-6bfa-48af-b971-cd04631562d4.aspx</comments>
      <category>MP3;Open Source;Perl;SlimServer</category>
    </item>
    <item>
      <trackback:ping>http://www.goldb.org/goldblog/Trackback.aspx?guid=147c9900-7f53-424e-a535-494828390e7f</trackback:ping>
      <pingback:server>http://www.goldb.org/goldblog/pingback.aspx</pingback:server>
      <pingback:target>http://www.goldb.org/goldblog/PermaLink,guid,147c9900-7f53-424e-a535-494828390e7f.aspx</pingback:target>
      <dc:creator>Corey Goldberg</dc:creator>
      <wfw:comment>http://www.goldb.org/goldblog/CommentView,guid,147c9900-7f53-424e-a535-494828390e7f.aspx</wfw:comment>
      <wfw:commentRss>http://www.goldb.org/goldblog/SyndicationService.asmx/GetEntryCommentsRss?guid=147c9900-7f53-424e-a535-494828390e7f</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <i>The following is a short tutorial on
web programming in Perl I wrote several years ago.  This type of programming
was my first foray into the guts of the web.  Writing tools at the protocol level
forced me to gain a deep understanding of </i>
        <a href="http://www.w3.org/Protocols/">
          <i>HTTP</i>
        </a>
        <i> and
Web Architecture, which has been extremely helpful to me since.</i>
        <br />
        <br />
        <br />
These examples show how to use Perl's 'LWP' (<a href="http://search.cpan.org/dist/libwww-perl/">libwww-perl</a>)
modules to make requests to a web server. The libwww-perl collection is a set of Perl
modules which provides a simple and consistent application programming interface to
the web.<br /><br /><br /><b>Using 'LWP' to do an HTTP GET Request:</b><br /><br />
This will request the main Google page and store the entire contents of the response
in the the '$response' object.<br /><blockquote><div class="geekcode">#!/usr/bin/perl<br /><br />
use LWP;<br /><br />
$useragent = LWP::UserAgent-&gt;new;<br />
$request = new HTTP::Request('GET',"http://www.example.com");<br />
$response = $useragent-&gt;simple_request($request);<br /><br />
print $response-&gt;as_string();
</div></blockquote><br /><i>(*use "useragent-&gt;request" instead of "useragent-&gt;simple_request" to follow
server redirects)</i><br /><br /><br /><b>Working With Cookies:</b><br /><br />
Here is the http header returned by the initial http request to Google:<br />
(first part of 'print $response-&gt;as_string();' output in the previous example)<br /><blockquote><div class="geekcode">Date: Mon, 14 Apr 2003 18:38:28 GMT<br />
Server: GWS/2.0<br />
Content-Length: 2691<br />
Content-Type: text/html<br />
Content-Type: text/html; charset=ISO-8859-1<br />
Client-Date: Mon, 14 Apr 2003 18:38:29 GMT<br />
Client-Peer: 216.239.57.99:80<br />
Client-Response-Num: 1<br />
Connection: Close<br />
Set-Cookie: PREF=ID=48fd767576ebd920:TM=1050345508:LM=1050345508:S=qLA8i5XyvLX37lG6;<br />
expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/; domain=.google.com<br />
Title: Google
</div></blockquote><br />
Notice the "Set-Cookie:" line in the header. This is what tells your web browser that
a cookie needs to be set and returned as part of the http header in subsequent http
requests to this server. In this case the cookie doesnt do much, but for a site that
requires a login, this is how the server knows who you are to maintain a session.<br /><br />
In Perl, cookies can be handled for you by using the HTTP::Cookies module.<br /><br />
You first need to construct the object to contain your cookies:<br /><blockquote><div class="geekcode">$cookie_jar = HTTP::Cookies-&gt;new;
</div></blockquote><br />
After an http request is sent, you can then extract the cookie from the response header:<br /><blockquote><div class="geekcode">$cookie_jar-&gt;extract_cookies($response);
</div></blockquote><br />
Once you have the cookie stored in your cookie_jar, it needs to be sent back to the
server in the header of every subsequent http request. This is done by adding the
following command after you format each request:<br /><blockquote><div class="geekcode">$cookie_jar-&gt;add_cookie_header($request);
</div></blockquote><b><br /><br />
Now for the whole thing in a script: </b><br /><br />
The following script will make a request to the main Google page and store the cookie
it receives. It will then make a request to Google to change the default language
(user preference) to Spanish. A new cookie will be returned that we will store and
use it to make another request to the main Google page. Google will recognize the
information stored in our cookie and return the page in Spanish.<br /><blockquote><div class="geekcode">#!/usr/bin/perl<br /><br />
use LWP;<br />
use HTTP::Cookies;<br /><br />
# construct objects<br />
$useragent = LWP::UserAgent-&gt;new;<br />
$cookie_jar = HTTP::Cookies-&gt;new;<br /><br />
# send request for main Google page<br />
$request = new HTTP::Request('GET',"http://www.google.com");<br />
$response = $useragent-&gt;simple_request($request);<br /><br />
# extract cookie from response header<br />
$cookie_jar-&gt;extract_cookies($response);<br /><br />
# set user preference on Google to Spanish language<br /><div class="geekcode">$request = new HTTP::Request('GET',"http://www.google.com/setprefs?<br />
              
submit2=Save+Preferences+&amp;hl=es&lt;=all&amp;safe=images&amp;num=10<br />
              
&amp;q=&amp;prev=http%3A%2F%2Fwww.google.com%2F&amp;ie=UTF-8&amp;oe=UTF-8");<br />
$cookie_jar-&gt;add_cookie_header($request);<br />
$response = $useragent-&gt;simple_request($request);<br /><br />
# extract new cookie from response header<br />
$cookie_jar-&gt;extract_cookies($response);<br /><br />
# send request for main Google page (will return Spanish Google page)  
 <br />
$request = new HTTP::Request('GET',"http://www.google.com");<br />
$cookie_jar-&gt;add_cookie_header($request);<br />
$response = $useragent-&gt;simple_request($request);<br /><br />
print $response-&gt;as_string; # print response body to verify cookies work (some
text now in spanish)
</div></div></blockquote><p></p></body>
      <title>Perl - Building Web Clients</title>
      <guid isPermaLink="false">http://www.goldb.org/goldblog/PermaLink,guid,147c9900-7f53-424e-a535-494828390e7f.aspx</guid>
      <link>http://www.goldb.org/goldblog/2007/02/05/PerlBuildingWebClients.aspx</link>
      <pubDate>Mon, 05 Feb 2007 04:59:43 GMT</pubDate>
      <description>&lt;i&gt;The following is a short tutorial on web programming in Perl I wrote several years
ago.&amp;nbsp; This type of programming was my first foray into the guts of the web.&amp;nbsp;
Writing tools at the protocol level forced me to gain a deep understanding of &lt;/i&gt;&lt;a href="http://www.w3.org/Protocols/"&gt;&lt;i&gt;HTTP&lt;/i&gt;&lt;/a&gt;&lt;i&gt; and
Web Architecture, which has been extremely helpful to me since.&lt;/i&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
These examples show how to use Perl's 'LWP' (&lt;a href="http://search.cpan.org/dist/libwww-perl/"&gt;libwww-perl&lt;/a&gt;)
modules to make requests to a web server. The libwww-perl collection is a set of Perl
modules which provides a simple and consistent application programming interface to
the web.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;b&gt;Using 'LWP' to do an HTTP GET Request:&lt;/b&gt;
&lt;br&gt;
&lt;br&gt;
This will request the main Google page and store the entire contents of the response
in the the '$response' object.&lt;br&gt;
&lt;blockquote&gt;
&lt;div class="geekcode"&gt;#!/usr/bin/perl&lt;br&gt;
&lt;br&gt;
use LWP;&lt;br&gt;
&lt;br&gt;
$useragent = LWP::UserAgent-&amp;gt;new;&lt;br&gt;
$request = new HTTP::Request('GET',"http://www.example.com");&lt;br&gt;
$response = $useragent-&amp;gt;simple_request($request);&lt;br&gt;
&lt;br&gt;
print $response-&amp;gt;as_string();
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;br&gt;
&lt;i&gt;(*use "useragent-&amp;gt;request" instead of "useragent-&amp;gt;simple_request" to follow
server redirects)&lt;/i&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;b&gt;Working With Cookies:&lt;/b&gt;
&lt;br&gt;
&lt;br&gt;
Here is the http header returned by the initial http request to Google:&lt;br&gt;
(first part of 'print $response-&amp;gt;as_string();' output in the previous example)&lt;br&gt;
&lt;blockquote&gt;
&lt;div class="geekcode"&gt;Date: Mon, 14 Apr 2003 18:38:28 GMT&lt;br&gt;
Server: GWS/2.0&lt;br&gt;
Content-Length: 2691&lt;br&gt;
Content-Type: text/html&lt;br&gt;
Content-Type: text/html; charset=ISO-8859-1&lt;br&gt;
Client-Date: Mon, 14 Apr 2003 18:38:29 GMT&lt;br&gt;
Client-Peer: 216.239.57.99:80&lt;br&gt;
Client-Response-Num: 1&lt;br&gt;
Connection: Close&lt;br&gt;
Set-Cookie: PREF=ID=48fd767576ebd920:TM=1050345508:LM=1050345508:S=qLA8i5XyvLX37lG6;&lt;br&gt;
expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/; domain=.google.com&lt;br&gt;
Title: Google
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;br&gt;
Notice the "Set-Cookie:" line in the header. This is what tells your web browser that
a cookie needs to be set and returned as part of the http header in subsequent http
requests to this server. In this case the cookie doesnt do much, but for a site that
requires a login, this is how the server knows who you are to maintain a session.&lt;br&gt;
&lt;br&gt;
In Perl, cookies can be handled for you by using the HTTP::Cookies module.&lt;br&gt;
&lt;br&gt;
You first need to construct the object to contain your cookies:&lt;br&gt;
&lt;blockquote&gt;
&lt;div class="geekcode"&gt;$cookie_jar = HTTP::Cookies-&amp;gt;new;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;br&gt;
After an http request is sent, you can then extract the cookie from the response header:&lt;br&gt;
&lt;blockquote&gt;
&lt;div class="geekcode"&gt;$cookie_jar-&amp;gt;extract_cookies($response);
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;br&gt;
Once you have the cookie stored in your cookie_jar, it needs to be sent back to the
server in the header of every subsequent http request. This is done by adding the
following command after you format each request:&lt;br&gt;
&lt;blockquote&gt;
&lt;div class="geekcode"&gt;$cookie_jar-&amp;gt;add_cookie_header($request);
&lt;/div&gt;
&lt;/blockquote&gt;&lt;b&gt;
&lt;br&gt;
&lt;br&gt;
Now for the whole thing in a script: &lt;/b&gt;
&lt;br&gt;
&lt;br&gt;
The following script will make a request to the main Google page and store the cookie
it receives. It will then make a request to Google to change the default language
(user preference) to Spanish. A new cookie will be returned that we will store and
use it to make another request to the main Google page. Google will recognize the
information stored in our cookie and return the page in Spanish.&lt;br&gt;
&lt;blockquote&gt;
&lt;div class="geekcode"&gt;#!/usr/bin/perl&lt;br&gt;
&lt;br&gt;
use LWP;&lt;br&gt;
use HTTP::Cookies;&lt;br&gt;
&lt;br&gt;
# construct objects&lt;br&gt;
$useragent = LWP::UserAgent-&amp;gt;new;&lt;br&gt;
$cookie_jar = HTTP::Cookies-&amp;gt;new;&lt;br&gt;
&lt;br&gt;
# send request for main Google page&lt;br&gt;
$request = new HTTP::Request('GET',"http://www.google.com");&lt;br&gt;
$response = $useragent-&amp;gt;simple_request($request);&lt;br&gt;
&lt;br&gt;
# extract cookie from response header&lt;br&gt;
$cookie_jar-&amp;gt;extract_cookies($response);&lt;br&gt;
&lt;br&gt;
# set user preference on Google to Spanish language&lt;br&gt;
&lt;div class="geekcode"&gt;$request = new HTTP::Request('GET',"http://www.google.com/setprefs?&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
submit2=Save+Preferences+&amp;amp;hl=es&amp;lt;=all&amp;amp;safe=images&amp;amp;num=10&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;amp;q=&amp;amp;prev=http%3A%2F%2Fwww.google.com%2F&amp;amp;ie=UTF-8&amp;amp;oe=UTF-8");&lt;br&gt;
$cookie_jar-&amp;gt;add_cookie_header($request);&lt;br&gt;
$response = $useragent-&amp;gt;simple_request($request);&lt;br&gt;
&lt;br&gt;
# extract new cookie from response header&lt;br&gt;
$cookie_jar-&amp;gt;extract_cookies($response);&lt;br&gt;
&lt;br&gt;
# send request for main Google page (will return Spanish Google page)&amp;nbsp;&amp;nbsp;
&amp;nbsp;&lt;br&gt;
$request = new HTTP::Request('GET',"http://www.google.com");&lt;br&gt;
$cookie_jar-&amp;gt;add_cookie_header($request);&lt;br&gt;
$response = $useragent-&amp;gt;simple_request($request);&lt;br&gt;
&lt;br&gt;
print $response-&amp;gt;as_string; # print response body to verify cookies work (some
text now in spanish)
&lt;/div&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;
&lt;/p&gt;</description>
      <comments>http://www.goldb.org/goldblog/CommentView,guid,147c9900-7f53-424e-a535-494828390e7f.aspx</comments>
      <category>Perl;Programming</category>
    </item>
    <item>
      <trackback:ping>http://www.goldb.org/goldblog/Trackback.aspx?guid=6969f8b8-5710-4b4c-ad7a-0f545da805da</trackback:ping>
      <pingback:server>http://www.goldb.org/goldblog/pingback.aspx</pingback:server>
      <pingback:target>http://www.goldb.org/goldblog/PermaLink,guid,6969f8b8-5710-4b4c-ad7a-0f545da805da.aspx</pingback:target>
      <dc:creator>Corey Goldberg</dc:creator>
      <wfw:comment>http://www.goldb.org/goldblog/CommentView,guid,6969f8b8-5710-4b4c-ad7a-0f545da805da.aspx</wfw:comment>
      <wfw:commentRss>http://www.goldb.org/goldblog/SyndicationService.asmx/GetEntryCommentsRss?guid=6969f8b8-5710-4b4c-ad7a-0f545da805da</wfw:commentRss>
      <slash:comments>3</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">The DSU (Decorate, Sort, Undecorate) idiom
originates from Lisp.  I first learned it in Perl, where it is called the <a href="http://en.wikipedia.org/wiki/Schwartzian_transform">Schwartzian
Transform</a> (coolest name ever?), named after longtime Perl hacker <a href="http://www.stonehenge.com/merlyn/">Randal
L. Schwartz</a>.<br /><br />
I find myself using this same DSU idiom in Python when I need to sort a nested sequence
(single level sequence of sequences).<br /><br />
Lets say I have the following list of lists:<br /><br /><div class="geekcode">seq = [<br />
    ['a', 1, 5],<br />
    ['b', 3, 4],<br />
    ['c', 2, 2],<br />
    ['d', 4, 3],<br />
    ['e', 5, 1],<br />
]
</div><br />
... and I want the outer list to contain the inner lists sorted by their last column
(in this case, index 2).<br /><br />
How would I do this?<br /><br />
Here is an implementations of the DSU (Decorate, Sort, Undecorate) idiom in a Python
function:<br /><br /><div class="geekcode">def dsu_sort(idx, seq):<br />
    for i, e in enumerate(seq):<br />
        seq[i] = (e[idx], e)<br />
    seq.sort()<br />
    for i, e in enumerate(seq):<br />
        seq[i] = e[1]<br />
    return seq
</div>
    
<br />
(Keep in mind that lists in Python are mutable and this will transform your original
sequence.)<br /><br /><br />
So applying this to the sequence above like this:<br /><br /><div class="geekcode">dsu_sort(2, seq)<br /></div><br />
gives us:<br /><br /><div class="geekcode">[['e', 5, 1], ['c', 2, 2], ['d', 4, 3], ['b', 3, 4], ['a', 1,
5]]
</div><br />
which is the original sequence, transformed so it is sorted by the last column (index
2).<br /><br /><hr size="2" width="100%" /><br />
Randal's original implementation in Perl from 1994:<br /><div class="geekcode">#!/usr/bin/perl<br />
 print<br />
     map { $_-&gt;[0] }<br />
     sort { $a-&gt;[1] cmp $b-&gt;[1] }<br />
     map { [$_, /(\S+)$/] }<br />
     &lt;&gt;;
</div><br /></body>
      <title>Python - Sort A Nested Sequence With DSU</title>
      <guid isPermaLink="false">http://www.goldb.org/goldblog/PermaLink,guid,6969f8b8-5710-4b4c-ad7a-0f545da805da.aspx</guid>
      <link>http://www.goldb.org/goldblog/2007/01/26/PythonSortANestedSequenceWithDSU.aspx</link>
      <pubDate>Fri, 26 Jan 2007 17:07:19 GMT</pubDate>
      <description>The DSU (Decorate, Sort, Undecorate) idiom originates from Lisp.&amp;nbsp; I first learned it in Perl, where it is called the &lt;a href="http://en.wikipedia.org/wiki/Schwartzian_transform"&gt;Schwartzian
Transform&lt;/a&gt; (coolest name ever?), named after longtime Perl hacker &lt;a href="http://www.stonehenge.com/merlyn/"&gt;Randal
L. Schwartz&lt;/a&gt;.&lt;br&gt;
&lt;br&gt;
I find myself using this same DSU idiom in Python when I need to sort a nested sequence
(single level sequence of sequences).&lt;br&gt;
&lt;br&gt;
Lets say I have the following list of lists:&lt;br&gt;
&lt;br&gt;
&lt;div class="geekcode"&gt;seq = [&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; ['a', 1, 5],&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; ['b', 3, 4],&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; ['c', 2, 2],&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; ['d', 4, 3],&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; ['e', 5, 1],&lt;br&gt;
]
&lt;/div&gt;
&lt;br&gt;
... and I want the outer list to contain the inner lists sorted by their last column
(in this case, index 2).&lt;br&gt;
&lt;br&gt;
How would I do this?&lt;br&gt;
&lt;br&gt;
Here is an implementations of the DSU (Decorate, Sort, Undecorate) idiom in a Python
function:&lt;br&gt;
&lt;br&gt;
&lt;div class="geekcode"&gt;def dsu_sort(idx, seq):&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; for i, e in enumerate(seq):&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; seq[i] = (e[idx], e)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; seq.sort()&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; for i, e in enumerate(seq):&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; seq[i] = e[1]&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; return seq
&lt;/div&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&lt;br&gt;
(Keep in mind that lists in Python are mutable and this will transform your original
sequence.)&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
So applying this to the sequence above like this:&lt;br&gt;
&lt;br&gt;
&lt;div class="geekcode"&gt;dsu_sort(2, seq)&lt;br&gt;
&lt;/div&gt;
&lt;br&gt;
gives us:&lt;br&gt;
&lt;br&gt;
&lt;div class="geekcode"&gt;[['e', 5, 1], ['c', 2, 2], ['d', 4, 3], ['b', 3, 4], ['a', 1,
5]]
&lt;/div&gt;
&lt;br&gt;
which is the original sequence, transformed so it is sorted by the last column (index
2).&lt;br&gt;
&lt;br&gt;
&lt;hr size="2" width="100%"&gt;
&lt;br&gt;
Randal's original implementation in Perl from 1994:&lt;br&gt;
&lt;div class="geekcode"&gt;#!/usr/bin/perl&lt;br&gt;
&amp;nbsp;print&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map { $_-&amp;gt;[0] }&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sort { $a-&amp;gt;[1] cmp $b-&amp;gt;[1] }&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map { [$_, /(\S+)$/] }&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&amp;gt;;
&lt;/div&gt;
&lt;br&gt;</description>
      <comments>http://www.goldb.org/goldblog/CommentView,guid,6969f8b8-5710-4b4c-ad7a-0f545da805da.aspx</comments>
      <category>Perl;Programming;Python</category>
    </item>
    <item>
      <trackback:ping>http://www.goldb.org/goldblog/Trackback.aspx?guid=e2f60740-4f51-44a7-9869-2ae9588851b1</trackback:ping>
      <pingback:server>http://www.goldb.org/goldblog/pingback.aspx</pingback:server>
      <pingback:target>http://www.goldb.org/goldblog/PermaLink,guid,e2f60740-4f51-44a7-9869-2ae9588851b1.aspx</pingback:target>
      <dc:creator>Corey Goldberg</dc:creator>
      <wfw:comment>http://www.goldb.org/goldblog/CommentView,guid,e2f60740-4f51-44a7-9869-2ae9588851b1.aspx</wfw:comment>
      <wfw:commentRss>http://www.goldb.org/goldblog/SyndicationService.asmx/GetEntryCommentsRss?guid=e2f60740-4f51-44a7-9869-2ae9588851b1</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">Guess what this is?<br /><br /><div class="geekcode">    ''=~(       
'(?{'        .('`'       
|'%')        .('['       
^'-')<br />
    .('`'        |'!')       
.('`'        |',')       
.'"'.        '\\$'<br />
    .'=='        .('['       
^'+')        .('`'       
|'/')        .('['<br />
    ^'+')        .'||'       
.(';'        &amp;'=')       
.(';'        &amp;'=')<br />
    .';-'        .'-'.       
'\\$'        .'=;'       
.('['        ^'(')<br />
    .('['        ^'.')       
.('`'        |'"')       
.('!'        ^'+')<br />
   .'_\\{'      .'(\\$'     
.';=('.      '\\$=|'      ."\|".(     
'`'^'.'<br />
  ).(('`')|    '/').').'    .'\\"'.+(   
'{'^'[').    ('`'|'"')    .('`'|'/'<br />
 ).('['^'/')  .('['^'/').  ('`'|',').(  '`'|('%')).  '\\".\\"'.( 
'['^('(')).<br />
 '\\"'.('['^  '#').'!!--'  .'\\$=.\\"'  .('{'^'[').  ('`'|'/').( 
'`'|"\&amp;").(<br />
 '{'^"\[").(  '`'|"\"").(  '`'|"\%").(  '`'|"\%").(  '['^(')')). 
'\\").\\"'.<br />
 ('{'^'[').(  '`'|"\/").(  '`'|"\.").(  '{'^"\[").(  '['^"\/").( 
'`'|"\(").(<br />
 '`'|"\%").(  '{'^"\[").(  '['^"\,").(  '`'|"\!").(  '`'|"\,").( 
'`'|(',')).<br />
 '\\"\\}'.+(  '['^"\+").(  '['^"\)").(  '`'|"\)").(  '`'|"\.").( 
'['^('/')).<br />
 '+_,\\",'.(  '{'^('[')).  ('\\$;!').(  '!'^"\+").(  '{'^"\/").( 
'`'|"\!").(<br />
 '`'|"\+").(  '`'|"\%").(  '{'^"\[").(  '`'|"\/").(  '`'|"\.").( 
'`'|"\%").(<br />
 '{'^"\[").(  '`'|"\$").(  '`'|"\/").(  '['^"\,").(  '`'|('.')). 
','.(('{')^<br />
 '[').("\["^  '+').("\`"|  '!').("\["^  '(').("\["^  '(').("\{"^ 
'[').("\`"|<br />
 ')').("\["^  '/').("\{"^  '[').("\`"|  '!').("\["^  ')').("\`"| 
'/').("\["^<br />
 '.').("\`"|  '.').("\`"|  '$')."\,".(  '!'^('+')).  '\\",_,\\"' 
.'!'.("\!"^<br />
 '+').("\!"^  '+').'\\"'.  ('['^',').(  '`'|"\(").(  '`'|"\)").( 
'`'|"\,").(<br />
 '`'|('%')).  '++\\$="})'  );$:=('.')^  '~';$~='@'|  '(';$^=')'^ 
'[';$/='`';
</div><br /><br />
It is Perl 5 source code.  When executed, it prints the "99 Bottles of Beer"
song.  Like this:<br /><br /><div class="geekcode">99 bottles of beer on the wall, 99 bottles of beer!<br />
Take one down, pass it around,<br />
98 bottles of beer on the wall!<br /><br />
98 bottles of beer on the wall, 98 bottles of beer!<br />
Take one down, pass it around,<br />
97 bottles of beer on the wall!<br /><br />
97 bottles of beer on the wall, 97 bottles of beer!<br />
Take one down, pass it around,<br />
96 bottles of beer on the wall!<br /><br />
etc...
</div><br /><br />
Pretty insane.<br />
Who said Perl can be hard to read?<br /><br />
(Lots of implementations of the song generator in various languages are <a href="http://99-bottles-of-beer.net">available</a>;
but none as cool as this one.)<br /><p></p></body>
      <title>Perl Bottles</title>
      <guid isPermaLink="false">http://www.goldb.org/goldblog/PermaLink,guid,e2f60740-4f51-44a7-9869-2ae9588851b1.aspx</guid>
      <link>http://www.goldb.org/goldblog/2007/01/21/PerlBottles.aspx</link>
      <pubDate>Sun, 21 Jan 2007 21:23:05 GMT</pubDate>
      <description>Guess what this is?&lt;br&gt;
&lt;br&gt;
&lt;div class="geekcode"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ''=~(&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
'(?{'&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .('`'&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
|'%')&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .('['&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
^'-')&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; .('`'&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |'!')&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
.('`'&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |',')&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
.'"'.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '\\$'&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; .'=='&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .('['&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
^'+')&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .('`'&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
|'/')&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .('['&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; ^'+')&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .'||'&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
.(';'&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;'=')&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
.(';'&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;'=')&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; .';-'&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .'-'.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
'\\$'&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .'=;'&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
.('['&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ^'(')&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; .('['&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ^'.')&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
.('`'&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |'"')&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
.('!'&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ^'+')&lt;br&gt;
&amp;nbsp;&amp;nbsp; .'_\\{'&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .'(\\$'&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
.';=('.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '\\$=|'&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ."\|".(&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
'`'^'.'&lt;br&gt;
&amp;nbsp; ).(('`')|&amp;nbsp;&amp;nbsp;&amp;nbsp; '/').').'&amp;nbsp;&amp;nbsp;&amp;nbsp; .'\\"'.+(&amp;nbsp;&amp;nbsp;&amp;nbsp;
'{'^'[').&amp;nbsp;&amp;nbsp;&amp;nbsp; ('`'|'"')&amp;nbsp;&amp;nbsp;&amp;nbsp; .('`'|'/'&lt;br&gt;
&amp;nbsp;).('['^'/')&amp;nbsp; .('['^'/').&amp;nbsp; ('`'|',').(&amp;nbsp; '`'|('%')).&amp;nbsp; '\\".\\"'.(&amp;nbsp;
'['^('(')).&lt;br&gt;
&amp;nbsp;'\\"'.('['^&amp;nbsp; '#').'!!--'&amp;nbsp; .'\\$=.\\"'&amp;nbsp; .('{'^'[').&amp;nbsp; ('`'|'/').(&amp;nbsp;
'`'|"\&amp;amp;").(&lt;br&gt;
&amp;nbsp;'{'^"\[").(&amp;nbsp; '`'|"\"").(&amp;nbsp; '`'|"\%").(&amp;nbsp; '`'|"\%").(&amp;nbsp; '['^(')')).&amp;nbsp;
'\\").\\"'.&lt;br&gt;
&amp;nbsp;('{'^'[').(&amp;nbsp; '`'|"\/").(&amp;nbsp; '`'|"\.").(&amp;nbsp; '{'^"\[").(&amp;nbsp; '['^"\/").(&amp;nbsp;
'`'|"\(").(&lt;br&gt;
&amp;nbsp;'`'|"\%").(&amp;nbsp; '{'^"\[").(&amp;nbsp; '['^"\,").(&amp;nbsp; '`'|"\!").(&amp;nbsp; '`'|"\,").(&amp;nbsp;
'`'|(',')).&lt;br&gt;
&amp;nbsp;'\\"\\}'.+(&amp;nbsp; '['^"\+").(&amp;nbsp; '['^"\)").(&amp;nbsp; '`'|"\)").(&amp;nbsp; '`'|"\.").(&amp;nbsp;
'['^('/')).&lt;br&gt;
&amp;nbsp;'+_,\\",'.(&amp;nbsp; '{'^('[')).&amp;nbsp; ('\\$;!').(&amp;nbsp; '!'^"\+").(&amp;nbsp; '{'^"\/").(&amp;nbsp;
'`'|"\!").(&lt;br&gt;
&amp;nbsp;'`'|"\+").(&amp;nbsp; '`'|"\%").(&amp;nbsp; '{'^"\[").(&amp;nbsp; '`'|"\/").(&amp;nbsp; '`'|"\.").(&amp;nbsp;
'`'|"\%").(&lt;br&gt;
&amp;nbsp;'{'^"\[").(&amp;nbsp; '`'|"\$").(&amp;nbsp; '`'|"\/").(&amp;nbsp; '['^"\,").(&amp;nbsp; '`'|('.')).&amp;nbsp;
','.(('{')^&lt;br&gt;
&amp;nbsp;'[').("\["^&amp;nbsp; '+').("\`"|&amp;nbsp; '!').("\["^&amp;nbsp; '(').("\["^&amp;nbsp; '(').("\{"^&amp;nbsp;
'[').("\`"|&lt;br&gt;
&amp;nbsp;')').("\["^&amp;nbsp; '/').("\{"^&amp;nbsp; '[').("\`"|&amp;nbsp; '!').("\["^&amp;nbsp; ')').("\`"|&amp;nbsp;
'/').("\["^&lt;br&gt;
&amp;nbsp;'.').("\`"|&amp;nbsp; '.').("\`"|&amp;nbsp; '$')."\,".(&amp;nbsp; '!'^('+')).&amp;nbsp; '\\",_,\\"'&amp;nbsp;
.'!'.("\!"^&lt;br&gt;
&amp;nbsp;'+').("\!"^&amp;nbsp; '+').'\\"'.&amp;nbsp; ('['^',').(&amp;nbsp; '`'|"\(").(&amp;nbsp; '`'|"\)").(&amp;nbsp;
'`'|"\,").(&lt;br&gt;
&amp;nbsp;'`'|('%')).&amp;nbsp; '++\\$="})'&amp;nbsp; );$:=('.')^&amp;nbsp; '~';$~='@'|&amp;nbsp; '(';$^=')'^&amp;nbsp;
'[';$/='`';
&lt;/div&gt;
&lt;br&gt;
&lt;br&gt;
It is Perl 5 source code.&amp;nbsp; When executed, it prints the "99 Bottles of Beer"
song.&amp;nbsp; Like this:&lt;br&gt;
&lt;br&gt;
&lt;div class="geekcode"&gt;99 bottles of beer on the wall, 99 bottles of beer!&lt;br&gt;
Take one down, pass it around,&lt;br&gt;
98 bottles of beer on the wall!&lt;br&gt;
&lt;br&gt;
98 bottles of beer on the wall, 98 bottles of beer!&lt;br&gt;
Take one down, pass it around,&lt;br&gt;
97 bottles of beer on the wall!&lt;br&gt;
&lt;br&gt;
97 bottles of beer on the wall, 97 bottles of beer!&lt;br&gt;
Take one down, pass it around,&lt;br&gt;
96 bottles of beer on the wall!&lt;br&gt;
&lt;br&gt;
etc...
&lt;/div&gt;
&lt;br&gt;
&lt;br&gt;
Pretty insane.&lt;br&gt;
Who said Perl can be hard to read?&lt;br&gt;
&lt;br&gt;
(Lots of implementations of the song generator in various languages are &lt;a href="http://99-bottles-of-beer.net"&gt;available&lt;/a&gt;;
but none as cool as this one.)&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;</description>
      <comments>http://www.goldb.org/goldblog/CommentView,guid,e2f60740-4f51-44a7-9869-2ae9588851b1.aspx</comments>
      <category>Perl</category>
    </item>
    <item>
      <trackback:ping>http://www.goldb.org/goldblog/Trackback.aspx?guid=415f5402-4f09-405d-bf06-f1105874bcb7</trackback:ping>
      <pingback:server>http://www.goldb.org/goldblog/pingback.aspx</pingback:server>
      <pingback:target>http://www.goldb.org/goldblog/PermaLink,guid,415f5402-4f09-405d-bf06-f1105874bcb7.aspx</pingback:target>
      <dc:creator>Corey Goldberg</dc:creator>
      <wfw:comment>http://www.goldb.org/goldblog/CommentView,guid,415f5402-4f09-405d-bf06-f1105874bcb7.aspx</wfw:comment>
      <wfw:commentRss>http://www.goldb.org/goldblog/SyndicationService.asmx/GetEntryCommentsRss?guid=415f5402-4f09-405d-bf06-f1105874bcb7</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">I've been waiting for <a href="http://dev.perl.org/perl6/">Perl
6</a> for <a href="http://www.perl.com/pub/a/2000/10/23/soto2000.html">quite a few</a> years
now...<br /><br />
I initially started hacking Perl in 1998 in my days as a software tester.  Perl
is a programming language that tends to be popular with testers... usually because
of its powerful text processing features (built-in regex's, dynamic/weak typing, simple/powerful
data structures, etc).  It is perfect for munging large data sets and slinging
text into whatever test configurations you need.  I have written plenty of <a href="http://www.webinject.org/dev.html">useful
software</a> in Perl.<br /><br />
But.. the Perl community has sort of stagnated and other languages are taking over
what was once its niche  (By stagnated I mean in terms of getting a finished
version out, certainly not in terms of work being done.. which there is <a href="http://dev.perl.org/perl6/list-summaries/">lots</a> of). 
We have been waiting on Perl 6 for many years now and a working implementation is
yet to be generally released.  Every year or so, we get a new term or acronym
to chew on (<a href="http://www.poniecode.org/">Parrot</a>, <a href="http://www.pugscode.org/">PONIE</a>, <a href="http://www.python.org/">PUGS</a>),
but day to day I write less and less Perl as other languages seem to be moving faster. 
I know there are lots of very bright and talented people working on Perl 6... and
I appreciate that.  But I get the feeling that it is concentrated in a few individuals. 
I wonder why Perl 6 development hasn't scaled like some other languages have? 
Other dynamic language communitues (i.e. <a href="http://www.ruby-lang.org">Python</a>/<a href="http://dev.perl.org/perl6/rfc/">Ruby</a>)
seem to be constantly embraced and pushed forward... and with that comes a healthy
community with diverse and active contributors.<br /><br /><br /><p></p></body>
      <title>Perl 6?  The Long Wait</title>
      <guid isPermaLink="false">http://www.goldb.org/goldblog/PermaLink,guid,415f5402-4f09-405d-bf06-f1105874bcb7.aspx</guid>
      <link>http://www.goldb.org/goldblog/2006/11/05/Perl6TheLongWait.aspx</link>
      <pubDate>Sun, 05 Nov 2006 16:59:03 GMT</pubDate>
      <description>I've been waiting for &lt;a href="http://dev.perl.org/perl6/"&gt;Perl 6&lt;/a&gt; for &lt;a href="http://www.perl.com/pub/a/2000/10/23/soto2000.html"&gt;quite
a few&lt;/a&gt; years now...&lt;br&gt;
&lt;br&gt;
I initially started hacking Perl in 1998 in my days as a software tester.&amp;nbsp; Perl
is a programming language that tends to be popular with testers... usually because
of its powerful text processing features (built-in regex's, dynamic/weak typing, simple/powerful
data structures, etc).&amp;nbsp; It is perfect for munging large data sets and slinging
text into whatever test configurations you need.&amp;nbsp; I have written plenty of &lt;a href="http://www.webinject.org/dev.html"&gt;useful
software&lt;/a&gt; in Perl.&lt;br&gt;
&lt;br&gt;
But.. the Perl community has sort of stagnated and other languages are taking over
what was once its niche&amp;nbsp; (By stagnated I mean in terms of getting a finished
version out, certainly not in terms of work being done.. which there is &lt;a href="http://dev.perl.org/perl6/list-summaries/"&gt;lots&lt;/a&gt; of).&amp;nbsp;
We have been waiting on Perl 6 for many years now and a working implementation is
yet to be generally released.&amp;nbsp; Every year or so, we get a new term or acronym
to chew on (&lt;a href="http://www.poniecode.org/"&gt;Parrot&lt;/a&gt;, &lt;a href="http://www.pugscode.org/"&gt;PONIE&lt;/a&gt;, &lt;a href="http://www.python.org/"&gt;PUGS&lt;/a&gt;),
but day to day I write less and less Perl as other languages seem to be moving faster.&amp;nbsp;
I know there are lots of very bright and talented people working on Perl 6... and
I appreciate that.&amp;nbsp; But I get the feeling that it is concentrated in a few individuals.&amp;nbsp;
I wonder why Perl 6 development hasn't scaled like some other languages have?&amp;nbsp;
Other dynamic language communitues (i.e. &lt;a href="http://www.ruby-lang.org"&gt;Python&lt;/a&gt;/&lt;a href="http://dev.perl.org/perl6/rfc/"&gt;Ruby&lt;/a&gt;)
seem to be constantly embraced and pushed forward... and with that comes a healthy
community with diverse and active contributors.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;</description>
      <comments>http://www.goldb.org/goldblog/CommentView,guid,415f5402-4f09-405d-bf06-f1105874bcb7.aspx</comments>
      <category>Perl</category>
    </item>
  </channel>
</rss>