<?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/"
	>

<channel>
	<title>bluefeet</title>
	<atom:link href="http://blog.bluefeet.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.bluefeet.net</link>
	<description>Yet another Perl Hacker weblog</description>
	<lastBuildDate>Thu, 10 Jun 2010 15:22:38 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Presentation: Tools of the CPAN Ninja</title>
		<link>http://blog.bluefeet.net/2010/06/presentation-tools-of-the-cpan-ninja/</link>
		<comments>http://blog.bluefeet.net/2010/06/presentation-tools-of-the-cpan-ninja/#comments</comments>
		<pubDate>Thu, 10 Jun 2010 15:22:38 +0000</pubDate>
		<dc:creator>bluefeet</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.bluefeet.net/?p=259</guid>
		<description><![CDATA[I wrote this for the TO.pm meeting on June 10th, 2010:
Tools of the CPAN Ninja
View more presentations from Aran Deltac.

]]></description>
			<content:encoded><![CDATA[<p>I wrote this for the <a href="http://thousand-oaks-perl.org">TO.pm</a> meeting on June 10th, 2010:</p>
<div style="width:425px" id="__ss_4465387"><strong style="display:block;margin:12px 0 4px"><a href="http://www.slideshare.net/bluefeet/tools-of-the-cpan-ninja" title="Tools of the CPAN Ninja">Tools of the CPAN Ninja</a></strong><object id="__sse4465387" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=cpan-100610101343-phpapp02&#038;stripped_title=tools-of-the-cpan-ninja" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed name="__sse4465387" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=cpan-100610101343-phpapp02&#038;stripped_title=tools-of-the-cpan-ninja" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object>
<div style="padding:5px 0 12px">View more <a href="http://www.slideshare.net/">presentations</a> from <a href="http://www.slideshare.net/bluefeet">Aran Deltac</a>.</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.bluefeet.net/2010/06/presentation-tools-of-the-cpan-ninja/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>BLOBs, Synonyms, and DBD::Oracle</title>
		<link>http://blog.bluefeet.net/2010/06/blobs-synonyms-and-dbdoracle/</link>
		<comments>http://blog.bluefeet.net/2010/06/blobs-synonyms-and-dbdoracle/#comments</comments>
		<pubDate>Thu, 03 Jun 2010 22:29:09 +0000</pubDate>
		<dc:creator>bluefeet</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[DBI]]></category>
		<category><![CDATA[Perl 5]]></category>

		<guid isPermaLink="false">http://blog.bluefeet.net/?p=252</guid>
		<description><![CDATA[INSERTing, UPDATEing, and SELECTing LOBs (CLOB/BLOB) in Oracle using Perl can be a PITA.  Case in point: 2 years ago a fellow coworker ended up writing some extremely complex code using ora_lob_write(), etc, when all he really needed to do was use bind_param() and declare that the blob column is a blob so that [...]]]></description>
			<content:encoded><![CDATA[<p>INSERTing, UPDATEing, and SELECTing LOBs (CLOB/BLOB) in Oracle using Perl can be a PITA.  Case in point: 2 years ago a fellow coworker ended up writing some extremely complex code using ora_lob_write(), etc, when all he really needed to do was use bind_param() and declare that the blob column is a blob so that DBD::Oracle would know to treat is specially.  At the time I believe he did try something like:</p>
<div class="codecolorer-container perl vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="perl codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$sth</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$dbh</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">prepare</span><span style="color: #009900;">&#40;</span><a href="http://perldoc.perl.org/functions/q.html"><span style="color: #000066;">q</span></a><span style="color: #009900;">&#91;</span><br />
&nbsp; &nbsp; INSERT INTO some_table <span style="color: #009900;">&#40;</span>color<span style="color: #339933;">,</span> blob_data<span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; VALUES <span style="color: #009900;">&#40;</span><span style="color: #339933;">?,</span> <span style="color: #339933;">?</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #0000ff;">$sth</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">bind_param</span><span style="color: #009900;">&#40;</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">'red'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #0000ff;">$sth</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">bind_param</span><span style="color: #009900;">&#40;</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$data_for_blob</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>ora_type <span style="color: #339933;">=&gt;</span> ORA_BLOB <span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #0000ff;">$sth</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">execute</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p>But then an error like &#8220;DBD::Oracle::st execute failed: ORA-04043: object some_table does not exist (DBD SUCCESS: OCIDescribeAny(view)/LOB refetch)&#8221; was raised.  Which made no sense since some_table is very much an object and any number of SQL operations work on it&#8230; when BLOBs are not involved.  In the end he ended up having to write code that was triple the size to get around this issue.</p>
<p>So, 2 years later and a little hair pulling, I come to figure out by luck that the problem is that the underlying DBD::Oracle code, that makes dealing with BLOBs simple, fails when you are using a synonym in your insert.  All we had to do is fully spell out the table name, and it works!</p>
<div class="codecolorer-container perl vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="perl codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$sth</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$dbh</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">prepare</span><span style="color: #009900;">&#40;</span><a href="http://perldoc.perl.org/functions/q.html"><span style="color: #000066;">q</span></a><span style="color: #009900;">&#91;</span><br />
&nbsp; &nbsp; INSERT INTO some_schema<span style="color: #339933;">.</span>some_table <span style="color: #009900;">&#40;</span>color<span style="color: #339933;">,</span> blob_data<span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; VALUES <span style="color: #009900;">&#40;</span><span style="color: #339933;">?,</span> <span style="color: #339933;">?</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #0000ff;">$sth</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">bind_param</span><span style="color: #009900;">&#40;</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">'red'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #0000ff;">$sth</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">bind_param</span><span style="color: #009900;">&#40;</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$data_for_blob</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>ora_type <span style="color: #339933;">=&gt;</span> ORA_BLOB <span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #0000ff;">$sth</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">execute</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p>Hopefully this helps others.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bluefeet.net/2010/06/blobs-synonyms-and-dbdoracle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Generating Constants in Perl</title>
		<link>http://blog.bluefeet.net/2010/05/generating-constants-in-perl/</link>
		<comments>http://blog.bluefeet.net/2010/05/generating-constants-in-perl/#comments</comments>
		<pubDate>Fri, 21 May 2010 23:29:35 +0000</pubDate>
		<dc:creator>bluefeet</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[CPAN]]></category>
		<category><![CDATA[Perl 5]]></category>

		<guid isPermaLink="false">http://blog.bluefeet.net/?p=240</guid>
		<description><![CDATA[The other day @ $work I was throwing together a module that creates constants based on a fairly static table in the database.  Of course I didn&#8217;t want to hard code the contants, I wanted them to be magically created by what was in the database.  For the sake of this example I [...]]]></description>
			<content:encoded><![CDATA[<p>The other day @ $work I was throwing together a module that creates constants based on a fairly static table in the database.  Of course I didn&#8217;t want to hard code the contants, I wanted them to be magically created by what was in the database.  For the sake of this example I had a table called &#8220;toy_categories&#8221; where each record has a unique ID (toy_category_id) and a name that can only be letters and underscores.  The data would look something like:</p>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">ID &nbsp;NAME<br />
-- &nbsp;--------------<br />
12 &nbsp;dolls<br />
&nbsp;7 &nbsp;action_figures<br />
92 &nbsp;education</div></div>
<p>And the resulting constants would look something like this:</p>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">TOY_CATEGORY_DOLLS = 12<br />
TOY_CATEGORY_ACTION_FIGURES = 7<br />
TOY_CATEGORY_EDUCATION = 92</div></div>
<p>If you read the core perl documents you might be lead to think that the <a href="http://perldoc.perl.org/constant.html">constant</a> pragma is the way to go.  This is not the case &#8211; just because a particular library is distributed with Perl does not mean its a good tool, instead it usually means that the library cannot be removed or substantially modified for backwards-compatibility reasons.  In my experience most core libraries are to be avoided &#8211; there are much better solutions on CPAN.</p>
<p>So, the CPAN solution to constants is <a href="http://search.cpan.org/perldoc?Readonly">Readonly</a>.  This module hooks in to Perl&#8217;s ability to mark a variable as read-only, much like how variables can be flagged as tainted or scalars as UTF.  Make sure you grab <a href="http://search.cpan.org/perldoc?Readonly::XS">Readonly::XS</a> as well to get the full benefit of read-only variables without the performance hit.</p>
<p>So, if you were to create a module for these constants you might do something like this:</p>
<div class="codecolorer-container perl vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="perl codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><a href="http://perldoc.perl.org/functions/package.html"><span style="color: #000066;">package</span></a> MyApp<span style="color: #339933;">::</span><span style="color: #006600;">Constants</span><span style="color: #339933;">::</span><span style="color: #006600;">ToyCategories</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">use</span> strict<span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">use</span> warnings<span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">use</span> Readonly<span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">use</span> Exporter <a href="http://perldoc.perl.org/functions/qw.html"><span style="color: #000066;">qw</span></a><span style="color: #009900;">&#40;</span> <a href="http://perldoc.perl.org/functions/import.html"><span style="color: #000066;">import</span></a> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #b1b100;">our</span> <span style="color: #0000ff;">@EXPORT</span> <span style="color: #339933;">=</span> <a href="http://perldoc.perl.org/functions/qw.html"><span style="color: #000066;">qw</span></a><span style="color: #009900;">&#40;</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">$TOY_CATEGORY_DOLLS</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">$TOY_CATEGORY_ACTION_FIGURES</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">$TOY_CATEGORY_EDUCATION</span><br />
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
Readonly <span style="color: #b1b100;">our</span> <span style="color: #0000ff;">$TOY_CATEGORY_DOLLS</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">12</span><span style="color: #339933;">;</span><br />
Readonly <span style="color: #b1b100;">our</span> <span style="color: #0000ff;">$TOY_CATEGORY_ACTION_FIGURES</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">7</span><span style="color: #339933;">;</span><br />
Readonly <span style="color: #b1b100;">our</span> <span style="color: #0000ff;">$TOY_CATEGORY_EDUCATION</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">92</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span></div></div>
<p>And then in some module you can access these constants:</p>
<div class="codecolorer-container perl vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="perl codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">use</span> MyApp<span style="color: #339933;">::</span><span style="color: #006600;">Constants</span><span style="color: #339933;">::</span><span style="color: #006600;">ToyCategories</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$toy</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">category_id</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">$TOY_CATEGORY_EDUCATION</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$response</span> <span style="color: #339933;">=</span> ask_question<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">'Are you an educator?'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<p>Now, like I said, I don&#8217;t want to hardcode the constants.  I want them to be dynamically created by records in my toy_categories table which resides in my database.  Its actually pretty simple to do this with some tricky evals:</p>
<div class="codecolorer-container perl vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="perl codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><a href="http://perldoc.perl.org/functions/package.html"><span style="color: #000066;">package</span></a> MyApp<span style="color: #339933;">::</span><span style="color: #006600;">Constants</span><span style="color: #339933;">::</span><span style="color: #006600;">ToyCategories</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">use</span> strict<span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">use</span> warnings<span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">use</span> Readonly<span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">use</span> Exporter<span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">use</span> Exporter <a href="http://perldoc.perl.org/functions/qw.html"><span style="color: #000066;">qw</span></a><span style="color: #009900;">&#40;</span> <a href="http://perldoc.perl.org/functions/import.html"><span style="color: #000066;">import</span></a> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #b1b100;">our</span> <span style="color: #0000ff;">@EXPORT</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$dbh</span> <span style="color: #339933;">=</span> code_that_returns_a_dbi_handle<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$sth</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$dbh</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">prepare</span><span style="color: #009900;">&#40;</span><a href="http://perldoc.perl.org/functions/q.html"><span style="color: #000066;">q</span></a><span style="color: #009900;">&#91;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; SELECT toy_category_id<span style="color: #339933;">,</span> name<br />
&nbsp; &nbsp; &nbsp; &nbsp; FROM toy_categories<br />
&nbsp; &nbsp; <span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">$sth</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">execute</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">$sth</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">bind_columns</span><span style="color: #009900;">&#40;</span> \<span style="color: #b1b100;">my</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">$id</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$name</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$sth</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">fetch</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; _export_variable<span style="color: #009900;">&#40;</span> <span style="color: #ff0000;">&quot;toy_category_$name&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">$id</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">sub</span> _export_constant <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$variable</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$value</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">@_</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #0000ff;">$variable</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">'$'</span> <span style="color: #339933;">.</span> <a href="http://perldoc.perl.org/functions/uc.html"><span style="color: #000066;">uc</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$variable</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$error</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$failed</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://perldoc.perl.org/functions/local.html"><span style="color: #000066;">local</span></a> <span style="color: #0000ff;">$@</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$failed</span> <span style="color: #339933;">=</span> <span style="color: #b1b100;">not</span> <a href="http://perldoc.perl.org/functions/eval.html"><span style="color: #000066;">eval</span></a><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Readonly our $variable =&gt; <span style="color: #000099; font-weight: bold;">\$</span>value&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$error</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$@</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$failed</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <a href="http://perldoc.perl.org/functions/die.html"><span style="color: #000066;">die</span></a> <span style="color: #ff0000;">&quot;Unable to create constant $variable: $error&quot;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span></div></div>
<p>What&#8217;s going on here?  Let&#8217;s start at the top:</p>
<div class="codecolorer-container perl vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="perl codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">use</span> Exporter <a href="http://perldoc.perl.org/functions/qw.html"><span style="color: #000066;">qw</span></a><span style="color: #009900;">&#40;</span> <a href="http://perldoc.perl.org/functions/import.html"><span style="color: #000066;">import</span></a> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p>This is the least intrusive way of using exporter and doesn&#8217;t pollute your namespace nearly as much as &#8216;use base qw( Exporter );&#8217; does and is friendlies to other modules.</p>
<div class="codecolorer-container perl vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="perl codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$dbh</span> <span style="color: #339933;">=</span> code_that_returns_a_dbi_handle<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p>Replace this with whatever you use to get a DBI database handle.  Take a look at <a href="http://search.cpan.org/perldoc?DBIx::Connector">DBIx::Connector</a> for a great alternative to doing this directly with DBI.</p>
<div class="codecolorer-container perl vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="perl codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$sth</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$dbh</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">prepare</span><span style="color: #009900;">&#40;</span><a href="http://perldoc.perl.org/functions/q.html"><span style="color: #000066;">q</span></a><span style="color: #009900;">&#91;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; SELECT toy_category_id<span style="color: #339933;">,</span> name<br />
&nbsp; &nbsp; &nbsp; &nbsp; FROM toy_categories<br />
&nbsp; &nbsp; <span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">$sth</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">execute</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">$sth</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">bind_columns</span><span style="color: #009900;">&#40;</span> \<span style="color: #b1b100;">my</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">$id</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$name</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$sth</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">fetch</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">...</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span></div></div>
<p>I&#8217;m a big fan of writing my DBI selects in this fashion with bind_columns() because it tends to be the fastest way to get the data (versus fetchrow_hashref, etc) and tends to lead to the simplest code within the while loop since it just needs to use $id and $name versus $row->{$id} and $row->{name} (for example).</p>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; &nbsp; &nbsp; _export_variable( &quot;toy_category_$name&quot; =&gt; $id );</div></div>
<p>While all of the code within _export_variable() could just be inlined right in the spot, that&#8217;s bad design.  If you can get a piece of your code generalized and moved to a subroutine, do it.</p>
<div class="codecolorer-container perl vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="perl codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; <span style="color: #0000ff;">$variable</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">'$'</span> <span style="color: #339933;">.</span> <a href="http://perldoc.perl.org/functions/uc.html"><span style="color: #000066;">uc</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$variable</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p>Constants should always, due to convention, be uppercase.  It is very important that you code to popular conventions because other people will most likely be working on your code later and if you come from a common expectation of how various things are done they will have an easier time ramping up to your code.  I try to code to the Modern Perl / CPAN conventions.</p>
<div class="codecolorer-container perl vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="perl codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$error</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$failed</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://perldoc.perl.org/functions/local.html"><span style="color: #000066;">local</span></a> <span style="color: #0000ff;">$@</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$failed</span> <span style="color: #339933;">=</span> <span style="color: #b1b100;">not</span> <a href="http://perldoc.perl.org/functions/eval.html"><span style="color: #000066;">eval</span></a> <span style="color: #339933;">...;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$error</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$@</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$failed</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #339933;">...</span> <span style="color: #009900;">&#125;</span></div></div>
<p>This bit of code was taken from <a href="http://blog.woobling.org/2009/09/trytiny.html">nothingmuch&#8217;s blog entry</a> where he announces <a href="http://search.cpan.org/perldoc?Try::Tiny">Try::Tiny</a> which provides a safe way to handle eval errors.  Read up there if you want to understand why the code was written this way.</p>
<div class="codecolorer-container perl vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="perl codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$failed</span> <span style="color: #339933;">=</span> <span style="color: #b1b100;">not</span> <a href="http://perldoc.perl.org/functions/eval.html"><span style="color: #000066;">eval</span></a><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Readonly our $variable =&gt; <span style="color: #000099; font-weight: bold;">\$</span>value&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p>While this code is several blocks deep in scope, this constant will exist in the package&#8217;s scope since it is being declared with &#8216;our&#8217;.</p>
<p>That&#8217;s it.  After this was implemented I thought it was so useful, simple, but requiring the knowledge of a few tricks, that I&#8217;d share it with ya&#8217;all.  Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bluefeet.net/2010/05/generating-constants-in-perl/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>YAPC::NA 2010 Talks are Being Approved</title>
		<link>http://blog.bluefeet.net/2010/04/yapcna-2010-talks-being-approved/</link>
		<comments>http://blog.bluefeet.net/2010/04/yapcna-2010-talks-being-approved/#comments</comments>
		<pubDate>Sun, 18 Apr 2010 06:36:20 +0000</pubDate>
		<dc:creator>bluefeet</dc:creator>
				<category><![CDATA[Announcements]]></category>
		<category><![CDATA[perl]]></category>

		<guid isPermaLink="false">http://blog.bluefeet.net/?p=235</guid>
		<description><![CDATA[I just got my approval for the two proposals I had submitted for this coming YAPC::NA 2010!  I&#8217;m very excited.  This will be my first time doing any sort of talk at a YAPC.  I&#8217;ve been wanting to do this for years and I am very grateful that the organizers of the [...]]]></description>
			<content:encoded><![CDATA[<p>I just got my approval for the two proposals I had submitted for this coming <a href="http://conferences.mongueurs.net/yn2010/">YAPC::NA 2010</a>!  I&#8217;m very excited.  This will be my first time doing any sort of talk at a YAPC.  I&#8217;ve been wanting to do this for years and I am very grateful that the organizers of the conference considered me.  Over the last few years I&#8217;ve been trying to hone my presentation skills by presenting various topics almost monthly at the <a href="http://thousand-oaks-perl.org">Thousand Oaks Perl Mongers</a> and <a href="http://losangeles.pm.org/">Los Angeles Perl Mongers</a>.</p>
<p>The first talk is a five-minute lighting talk about how to clone yourself in Perl.  For those that are unaware: lighting talks are a great YAPC tradition where around a dozen speakers will present 5-minute or less talks.  These talks range from very advanced computer science topics, down to the silly, and sometimes bizarre.</p>
<p>The other talk I&#8217;m doing is a 40-minute lecture/discussion showing examples of writing concise code.  This will be an extended version of the similar presentation that I&#8217;ve given at mongers.  I&#8217;ll be delving in to real-world cases where writing code in a more concise manner, reduces <a href="http://petdance.com/perl/technical-debt/">technical dept</a>, leads to more robust code, and a whole lot more.</p>
<p>See you at YAPC!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bluefeet.net/2010/04/yapcna-2010-talks-being-approved/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Cassandra Presentation</title>
		<link>http://blog.bluefeet.net/2010/04/cassandra-presentation/</link>
		<comments>http://blog.bluefeet.net/2010/04/cassandra-presentation/#comments</comments>
		<pubDate>Fri, 16 Apr 2010 02:06:19 +0000</pubDate>
		<dc:creator>bluefeet</dc:creator>
				<category><![CDATA[Announcements]]></category>
		<category><![CDATA[Cassandra]]></category>
		<category><![CDATA[databases]]></category>
		<category><![CDATA[Thrift]]></category>

		<guid isPermaLink="false">http://blog.bluefeet.net/?p=232</guid>
		<description><![CDATA[I wrote this for the TO.pm meeting on April 14th, 2010:
Introduction to Apache Cassandra
View more presentations from bluefeet.

]]></description>
			<content:encoded><![CDATA[<p>I wrote this for the <a href="http://thousand-oaks-perl.org">TO.pm</a> meeting on April 14th, 2010:</p>
<div style="width:425px" id="__ss_3739718"><strong style="display:block;margin:12px 0 4px"><a href="http://www.slideshare.net/bluefeet/introduction-to-apache-cassandra" title="Introduction to Apache Cassandra">Introduction to Apache Cassandra</a></strong><object width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=cassandra-100415164815-phpapp02&#038;stripped_title=introduction-to-apache-cassandra" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=cassandra-100415164815-phpapp02&#038;stripped_title=introduction-to-apache-cassandra" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object>
<div style="padding:5px 0 12px">View more <a href="http://www.slideshare.net/">presentations</a> from <a href="http://www.slideshare.net/bluefeet">bluefeet</a>.</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.bluefeet.net/2010/04/cassandra-presentation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache Cassandra and the Thrift API on CPAN</title>
		<link>http://blog.bluefeet.net/2010/04/apache-cassandra-and-the-thrift-api-on-cpan/</link>
		<comments>http://blog.bluefeet.net/2010/04/apache-cassandra-and-the-thrift-api-on-cpan/#comments</comments>
		<pubDate>Tue, 13 Apr 2010 00:25:13 +0000</pubDate>
		<dc:creator>bluefeet</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Cassandra]]></category>
		<category><![CDATA[CPAN]]></category>
		<category><![CDATA[databases]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[Perl 5]]></category>
		<category><![CDATA[Thrift]]></category>

		<guid isPermaLink="false">http://blog.bluefeet.net/?p=224</guid>
		<description><![CDATA[I&#8217;m currently playing around with a project that uses Apache Cassandra.  The Cassandra website states:
&#8220;The Apache Cassandra Project develops a highly scalable second-generation distributed database, bringing together  Dynamo&#8217;s fully distributed design and Bigtable&#8217;s ColumnFamily-based data model.&#8221;
So, from what I&#8217;ve experienced so far this is either a distributed Berkely DB, or a persistent Memcached, [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m currently playing around with a project that uses <a href="http://cassandra.apache.org/">Apache Cassandra</a>.  The Cassandra website states:</p>
<p><em>&#8220;The Apache Cassandra Project develops a highly scalable second-generation distributed database, bringing together  Dynamo&#8217;s fully distributed design and Bigtable&#8217;s ColumnFamily-based data model.&#8221;</em></p>
<p>So, from what I&#8217;ve experienced so far this is either a distributed Berkely DB, or a persistent Memcached, depending on which concept you are more familiar with (I know, that&#8217;s incredibly over simplified).</p>
<p>Cassandra was developed by Facebook and was made open source several years ago.  It uses the <a href="http://incubator.apache.org/thrift/">Thrift API</a> to communicate, which was also developed by Facebook.  Supposedly there are some steps being taken to move Cassandra on to a different API, but Thrift is the defacto for now.</p>
<p>There are two modules on CPAN that deal with Cassandra.  <a href="http://search.cpan.org/perldoc?Net::Cassandra">Net::Cassandra</a> is the original, and in my opinion, the superior/simpler/easier module.  <a href="http://search.cpan.org/perldoc?Net::Cassandra::Easy">Net::Cassandra::Easy</a> is a later implementation that really isn&#8217;t any simpler from what I can tell and neither seems any more or less tied to the intricacies of the Thrift API despite Net::Cassandra::Easy&#8217;s accusations of Net::Cassandra.  Both implement the Thrift API under the scenes in their own way, and both are lacking in features.</p>
<p>Now, the Thrift API itself is distributed with a perl library called simply &#8220;Thrift&#8221;.  This library is very new and it shows.  It needs a lot of work, a lot of automated tests, and IMO should be on CPAN.  I consider it a fail when a project decides to distribute Perl libraries independently from CPAN.  This leads to very little exposure &#8211; I was lucky I found the perl library in the Thrift tarball, I doubt others have been as lucky.</p>
<p>So, I&#8217;d like to make a Thrift driver library and put it on CPAN.  Then, a truly Thrift independent Cassandra client library can be written that uses the Thrift library behind the scenes, but is not directly tied in with it.  Later, when Cassandra decides to change their API library, the Cassandra library can be changed to use a new driver.</p>
<p>An additional benefit to this is if any Cassandra features are not yet available via the Cassandra module, then the perl developer can easily drop down to the Thrift driver and directly write Thrift queries.</p>
<p>Has anyone thought of this, or perhaps begun working on something like this?  If not, I&#8217;d like to do it and I&#8217;d love to hear any suggestions and thoughts people have.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bluefeet.net/2010/04/apache-cassandra-and-the-thrift-api-on-cpan/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Robust DBI Transaction and Connection Handling</title>
		<link>http://blog.bluefeet.net/2010/01/robust-dbi-transaction-and-connection-handling/</link>
		<comments>http://blog.bluefeet.net/2010/01/robust-dbi-transaction-and-connection-handling/#comments</comments>
		<pubDate>Sun, 24 Jan 2010 05:27:25 +0000</pubDate>
		<dc:creator>bluefeet</dc:creator>
				<category><![CDATA[Thoughts]]></category>
		<category><![CDATA[databases]]></category>
		<category><![CDATA[DBIC]]></category>
		<category><![CDATA[dbix-class]]></category>
		<category><![CDATA[DBIx::Class]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[Perl 5]]></category>

		<guid isPermaLink="false">http://blog.bluefeet.net/?p=210</guid>
		<description><![CDATA[Edit: It turns out there is already a module on CPAN that does exactly what I talked about here.  Its called DBIx::Connector.  I haven&#8217;t tried it yet, but it looks like the guy that wrote it designed it with input from the DBIC guys.
I&#8217;m a big fan of DBIx::Class.  Among DBIC&#8217;s many [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p><b>Edit:</b> It turns out there is already a module on CPAN that does exactly what I talked about here.  Its called <a href="http://search.cpan.org/perldoc?DBIx::Connector">DBIx::Connector</a>.  I haven&#8217;t tried it yet, but it looks like the guy that wrote it designed it with input from the DBIC guys.</p></blockquote>
<p>I&#8217;m a big fan of <a href="http://search.cpan.org/perldoc?DBIx::Class">DBIx::Class</a>.  Among DBIC&#8217;s many great features is its superb transaction and connection handling via <a href="http://search.cpan.org/perldoc?DBIx::Class::Storage::DBI">DBIx::Class::Storage::DBI</a>.  When I&#8217;m using raw DBI I feel like I&#8217;m missing these core components.  I should always be able to expect robust transaction and connection handling.</p>
<p>I started playing around with creating a new CPAN module (something like DBIx::Robust, DBIx::Transaction, etc&#8230;) but each time I dove in to it I kept coming to the conclusion that DBIC&#8217;s DBI storage drivers provide everything I need and I would just be shooting myself in the foot by either porting DBIx::Class::Storage::DBI to a DBIC independent API or by writing it from scratch.</p>
<p>Before I go any further, let me show you how attractive and awesome DBIC&#8217;s storage layer is:</p>
<ul>
<li>Transactions may be nested, even without savepoints.</li>
<li>Transaction savepoints can automatically be tracked allowing for reliable and incremental rollbacks.</li>
<li>The appropriate DateTime::Format class is automatically determined based on the type of database.</li>
<li>All database calls efficiently pass through a layer that detects stale connections that will attempt to re-connect to a database.</li>
</ul>
<p><a href="http://images.google.com/images?gbv=2&#038;q=kung+fu+panda+opening&#038;btnG=Search&#038;start=0"><i>&#8220;There is no charge for awesomeness, or attractiveness.&#8221;</i></a></p>
<p>The DBIx::Class::Storage::DBI pod illustrates all this in a round-about way: <i>&#8220;If you set AutoCommit => 0 in your connect info, then you are always in an assumed transaction between commits, and you&#8217;re telling us you&#8217;d like to manage that manually. A lot of the magic protections offered by this module will go away. We can&#8217;t protect you from exceptions due to database disconnects because we don&#8217;t know anything about how to restart your transactions. You&#8217;re on your own for handling all sorts of exceptional cases if you choose the AutoCommit => 0 path, just as you would be with raw DBI.&#8221;</i></p>
<p>This stuff is really powerful, and we should never have to work with databases in Perl without it.  But, currently, it is only meant to work under DBIC, which is a shame.  I&#8217;m betting that DBIx::Class::Storage::DBI could be used directly, bypassing DBIC completely.  There is some DBIC stuff layered in there, but that should be ignorable.</p>
<p>What do the rest of you think?  Has anyone considered moving this logic out in to a generic distribution that isn&#8217;t DBIC specific?  Is there merit in what I&#8217;m talking about?  Does anyone use DBIx::Class::Storage::DBI directly, bypassing DBIC?</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bluefeet.net/2010/01/robust-dbi-transaction-and-connection-handling/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>use HTML::FormHandler;</title>
		<link>http://blog.bluefeet.net/2009/10/use-htmlformhandler/</link>
		<comments>http://blog.bluefeet.net/2009/10/use-htmlformhandler/#comments</comments>
		<pubDate>Mon, 12 Oct 2009 16:00:45 +0000</pubDate>
		<dc:creator>bluefeet</dc:creator>
				<category><![CDATA[Reviews]]></category>
		<category><![CDATA[CPAN]]></category>
		<category><![CDATA[Moose]]></category>
		<category><![CDATA[Perl 5]]></category>

		<guid isPermaLink="false">http://blog.bluefeet.net/?p=206</guid>
		<description><![CDATA[I&#8217;ve been meaning to give HTML::FormHandler a try for quite some time now.  Over the weekend I converted a form from some home-grown form validation and html generation to use HTML::FormHandler instead.  HTML::FormHandler was inspired by, and quasi-forked from, Form::Processor.  There are many options for processing forms, such as FormValidator::Simple (Catalyst&#8217;s default) [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been meaning to give <a href="http://search.cpan.org/perldoc?HTML::FormHandler">HTML::FormHandler</a> a try for quite some time now.  Over the weekend I converted a form from some home-grown form validation and html generation to use HTML::FormHandler instead.  HTML::FormHandler was inspired by, and quasi-forked from, <a href="http://search.cpan.org/perldoc?Form::Processor">Form::Processor</a>.  There are many options for processing forms, such as <a href="http://search.cpan.org/perldoc?FormValidator::Simple">FormValidator::Simple</a> (Catalyst&#8217;s default) and <a href="http://search.cpan.org/perldoc?Data::FormValidator">Data::FormValidator</a>, to name a few.</p>
<p>Up until now I&#8217;ve always thought that the existing form handling/validating modules on CPAN were incredibly lacking.  They all have these crazy and inconsistent APIs that in the end limit what you are able to do.  I don&#8217;t expect a form validation API to handle every possible situation, but I do expect it to provide a consistent API that is well documented and allows me to easily extend if I need additional functionality.  Plus none of them use Moose (AFAIK), which isn&#8217;t just me being a Moose evangelist, its also practical because Moose provides mechanisms to extend functionality via roles and to provide reusable validation with <a href="http://search.cpan.org/perldoc?MooseX::Types">MooseX::Types</a>.</p>
<p>HTML::FormHandler solves these issues.  HTML::FormHandler can be a complete end-to-end solution for declaring form fields and types, applying server-side validation, generating the HTML for a form, and applying form submits to the database.  Almost everything and the kitchen sink is there, except client-side form validation, which can be added separately of course.  Normally a &#8220;do everything&#8221; package scares me, especially for something like form validation.  But, Gerda Shank (the author of HTML::FormHandler) did a great job splitting out the various pieces of HTML::FormHandler so that any piece of the form handling process can be subverted to your own needs, and there is <a href="http://search.cpan.org/perldoc?HTML::FormHandler::Manual">copious amounts of documentation</a> explaining how to do so.</p>
<p>The <a href="http://search.cpan.org/perldoc?HTML::FormHandler::Manual::Intro">HTML::FormHandler::Manual::Intro</a> does a great job introducing HTML::FormHandler.</p>
<p>There are a few downsides to this module&#8217;s current state.  It is relatively new and is still stabilizing.  For example, just recently the results of form validation were separated from the form object itself.  This is a huge fundamental change, but a necessary one.  Also, the concept of widgets was recently introduced.  Widgets are a great way to extend and customize the display of form fields, and the form as a whole.  But, this was just introduced and is still experimental, and has some rough edges.  Despite this, the widget design is very promising and I ended up using it myself (thanks to <a href="http://search.cpan.org/perldoc?HTML::FormHandler::Manual::Rendering">HTML::FormHandler::Manual::Rendering</a>) as my preferred rendering method.</p>
<p>Enjoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bluefeet.net/2009/10/use-htmlformhandler/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Top 10 Reasons to use Perl</title>
		<link>http://blog.bluefeet.net/2009/09/top-10-reasons-to-use-perl/</link>
		<comments>http://blog.bluefeet.net/2009/09/top-10-reasons-to-use-perl/#comments</comments>
		<pubDate>Thu, 10 Sep 2009 05:34:28 +0000</pubDate>
		<dc:creator>bluefeet</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Beer]]></category>
		<category><![CDATA[Fohawks]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[Moose]]></category>
		<category><![CDATA[Perl 5]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Ryan Seacrest]]></category>

		<guid isPermaLink="false">http://blog.bluefeet.net/?p=200</guid>
		<description><![CDATA[You should use Perl because&#8230;
10. Real Perl coders don&#8217;t have fohawks.
9. Perl has nothing to do with Ryan Seacrest.
8. Beer improves Perl.
7. It comes with a 20-sided die for all that TIMTOWTDI.
6. It has nothing to do with PHP.
5. Captain Picard writes perl.
4. There is no better place to get Moo seX.
3. It grows on [...]]]></description>
			<content:encoded><![CDATA[<p>You should use Perl because&#8230;</p>
<p>10. Real Perl coders don&#8217;t have <a href="http://images.google.com/images?q=ruby+rhod">fohawks</a>.<br />
9. Perl has nothing to do with <a href="http://www.ryanseacrest.com/">Ryan Seacrest</a>.<br />
8. Beer <a href="http://xkcd.com/323/">improves</a> Perl.<br />
7. It comes with a 20-sided die for all <a href="http://dictionary.reference.com/browse/that">that</a> TIMTOWTDI.<br />
6. It has nothing to do with <a href="http://www.php.com/">PHP</a>.<br />
5. <a href="http://blob.perl.org/books/impatient-perl/iperl.html#12_Procedural_Perl">Captain Picard</a> writes perl.<br />
4. There is no better place to get <a href="http://www.thefrisky.com/post/246-man-arrested-twice-for-having-sex-with-his-cow-and-other-bizarre-crimes/">Moo seX</a>.<br />
3. It <a href="http://www.scmrrs.org/">grows</a> on you.<br />
2. <a href="http://users.wfu.edu/ellwjd5/images/Atomic%20Bomb.gif">IE8</a> was not written in Perl.</p>
<p>&#8230; drum roll &#8230;</p>
<p>1. You can <a href="http://www.yapceurope.org/2001/proceedings/26/fractalcamel/camel_00.html">write this</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bluefeet.net/2009/09/top-10-reasons-to-use-perl/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>IE8, another screwed up version.</title>
		<link>http://blog.bluefeet.net/2009/09/ie8-another-screwed-up-version/</link>
		<comments>http://blog.bluefeet.net/2009/09/ie8-another-screwed-up-version/#comments</comments>
		<pubDate>Tue, 01 Sep 2009 18:32:03 +0000</pubDate>
		<dc:creator>bluefeet</dc:creator>
				<category><![CDATA[Reviews]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://blog.bluefeet.net/?p=187</guid>
		<description><![CDATA[I was really hoping that Internet Explorer version 8 (IE8) would finally be the version of IE where Microsoft stepped up to the plate and produced a fast browser, with few bugs, less Microsoft-only features, and a good and modern UI.
I&#8217;m the kind of guy that holds judgment for a very long time, sometimes too [...]]]></description>
			<content:encoded><![CDATA[<p>I was really hoping that Internet Explorer version 8 (IE8) would finally be the version of IE where Microsoft stepped up to the plate and produced a fast browser, with few bugs, less Microsoft-only features, and a good and modern UI.</p>
<p>I&#8217;m the kind of guy that holds judgment for a very long time, sometimes too long.  So it comes with great sadness that I announce that IE8 is not the browser I was hoping for.  It is riddled with bugs, the rendering engine crashes on many web sites, and it is SLOW.  Its the slowest browser of them all as far as I can tell.  It renders many web-2.0&#8242;ish sites with teeth-gritting sluggishness.  Once rendered, javascript animations tend to be jumpy as well.  I&#8217;ve found several cases where the event engine is even more screwed up than it was in IE7.</p>
<p>If you&#8217;re a web developer and IE8 is causing the same pain for you as it has for me, consider adding this to your HTML*:</p>
<div class="codecolorer-container html4strict vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/meta.html"><span style="color: #000000; font-weight: bold;">meta</span></a> <span style="color: #000066;">http-equiv</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;X-UA-Compatible&quot;</span> <span style="color: #000066;">content</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;IE=EmulateIE7&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span></div></div>
<p><small>* This should be the very first tag after the opening &lt;head&gt; tag.</small></p>
<p>This will force IE8 to run in IE7 compatibility mode.  When in IE7 compatibility mode IE8 will not crash nearly as often and will render your HTML/CSS/JS much more predictably and act more similar to how Chrome and FireFox behave.</p>
<p>I don&#8217;t understand why Microsoft keeps doing this.  They have all the power in the world to <b>WIN</b> the browser war, but they are just going to keep failing with crap software like this and loose one more market to Google.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bluefeet.net/2009/09/ie8-another-screwed-up-version/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic page generated in 0.303 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2010-07-29 04:35:14 -->
