<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Perl Hacks</title>
	
	<link>http://perlhacks.com</link>
	<description>Just another Perl Hacker's blog</description>
	<lastBuildDate>Mon, 30 Jan 2012 14:37:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/PerlHacks" /><feedburner:info uri="perlhacks" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license><feedburner:emailServiceId>PerlHacks</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>Yet More Modern Perl in Linux Format</title>
		<link>http://feedproxy.google.com/~r/PerlHacks/~3/_TR8mmjXyxs/</link>
		<comments>http://perlhacks.com/2012/01/yet-more-modern-perl-in-linux-format/#comments</comments>
		<pubDate>Mon, 30 Jan 2012 14:37:11 +0000</pubDate>
		<dc:creator>Dave Cross</dc:creator>
				<category><![CDATA[Marketing]]></category>
		<category><![CDATA[articles]]></category>
		<category><![CDATA[linux format]]></category>
		<category><![CDATA[lxf]]></category>
		<category><![CDATA[modern perl]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://perlhacks.com/?p=409</guid>
		<description><![CDATA[Over the weekend the postman bought me my subscribption copy of Linux Format issue 155. This contains the third (and final) part of my Modern Perl tutorial. In this part we&#8217;re adding features to the Dancer web application that we started in issue 153. This series has concentrated on web applications (with Dancer) and database [...]]]></description>
			<content:encoded><![CDATA[<div class="plus-one-wrap"><g:plusone size="small" href="http://perlhacks.com/2012/01/yet-more-modern-perl-in-linux-format/"></g:plusone></div><p>Over the weekend the postman bought me my subscribption copy of <a href="http://linuxformat.com/">Linux Format</a> issue 155. This contains the third (and final) part of my Modern Perl tutorial. In this part we&#8217;re adding features to the <a href="http://perldancer.org/">Dancer</a> web application that we started in issue 153.</p>
<p>This series has concentrated on web applications (with Dancer) and database access (with <a href="http://www.dbix-class.org/">DBIx::Class</a>). I&#8217;ve already got provisional agreement for another short series later in the year &#8211; where I plan to cover OO programming using Moose.</p>
<p>The new issue will be in the shops later this week.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://perlhacks.com/2011/12/more-modern-perl-in-linux-format/" rel="bookmark" class="crp_title">More Modern Perl in Linux Format</a></li><li><a href="http://perlhacks.com/2011/10/modern-perl-in-linux-format/" rel="bookmark" class="crp_title">Modern Perl in Linux Format</a></li><li><a href="http://perlhacks.com/2012/01/free-training-competition-in-linux-format/" rel="bookmark" class="crp_title">Free Training Competition in Linux Format</a></li><li><a href="http://perlhacks.com/2010/09/marketing-perl-1/" rel="bookmark" class="crp_title">Marketing Perl</a></li><li><a href="http://perlhacks.com/2011/04/an-open-letter-to-linux-format/" rel="bookmark" class="crp_title">An Open Letter to Linux Format</a></li></ul></div><img src="http://feeds.feedburner.com/~r/PerlHacks/~4/_TR8mmjXyxs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://perlhacks.com/2012/01/yet-more-modern-perl-in-linux-format/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://perlhacks.com/2012/01/yet-more-modern-perl-in-linux-format/</feedburner:origLink></item>
		<item>
		<title>Free Training Competition in Linux Format</title>
		<link>http://feedproxy.google.com/~r/PerlHacks/~3/nLY6KFgIBQw/</link>
		<comments>http://perlhacks.com/2012/01/free-training-competition-in-linux-format/#comments</comments>
		<pubDate>Fri, 06 Jan 2012 15:03:22 +0000</pubDate>
		<dc:creator>Dave Cross</dc:creator>
				<category><![CDATA[Training]]></category>
		<category><![CDATA[competition]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[linux format]]></category>
		<category><![CDATA[oreilly]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[public]]></category>
		<category><![CDATA[training]]></category>

		<guid isPermaLink="false">http://perlhacks.com/?p=405</guid>
		<description><![CDATA[I&#8217;ve mentioned before that I&#8217;m running some public training courses in London next month. But how do you fancy coming along to those courses for free? Those lovely people at O&#8217;Reilly have put an advert for the courses in the new issue of Linux Format which hits the shops about now. That&#8217;s issue 154 and [...]]]></description>
			<content:encoded><![CDATA[<div class="plus-one-wrap"><g:plusone size="small" href="http://perlhacks.com/2012/01/free-training-competition-in-linux-format/"></g:plusone></div><p>I&#8217;ve <a href="http://perlhacks.com/2011/12/public-training-courses-in-february/">mentioned before</a> that I&#8217;m running some <a href="http://mag-sol.com/train/public">public training courses</a> in London next month. But how do you fancy coming along to those courses for free?</p>
<p>Those <a href="http://www.josetteorama.com/training/from-perl-dabber-to-perl-expert-the-path-to-expertise/">lovely people at O&#8217;Reilly</a> have put an advert for the courses in the new issue of <a href="http://www.linuxformat.com/">Linux Format</a> which hits the shops about now. That&#8217;s issue 154 and the advert is on page 54. The advert contains details of a competition where two people can win free places on the two courses &#8211; one person on each course.</p>
<p>There are also four runner-up prizes which are copies of the <a href="http://shop.oreilly.com/product/9780596004927.do">new edition of the Camel book</a>.</p>
<p>All you need to do is&#8230; well to find that out you&#8217;ll need to buy the magazine. Ok, so entry isn&#8217;t 100% free &#8211; you&#8217;ll need to pay £6.49 for the magazine.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://perlhacks.com/2011/12/public-training-courses-in-february/" rel="bookmark" class="crp_title">Public Training Courses in February</a></li><li><a href="http://perlhacks.com/2010/03/plug-plug-plug/" rel="bookmark" class="crp_title">Plug Plug Plug</a></li><li><a href="http://perlhacks.com/2009/10/learn-perl-in-london/" rel="bookmark" class="crp_title">Learn Perl in London</a></li><li><a href="http://perlhacks.com/2010/01/market-research/" rel="bookmark" class="crp_title">Market Research</a></li><li><a href="http://perlhacks.com/2011/10/modern-perl-in-linux-format/" rel="bookmark" class="crp_title">Modern Perl in Linux Format</a></li></ul></div><img src="http://feeds.feedburner.com/~r/PerlHacks/~4/nLY6KFgIBQw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://perlhacks.com/2012/01/free-training-competition-in-linux-format/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://perlhacks.com/2012/01/free-training-competition-in-linux-format/</feedburner:origLink></item>
		<item>
		<title>The Perl Community – A Modest Proposal</title>
		<link>http://feedproxy.google.com/~r/PerlHacks/~3/IVzccwGtDUo/</link>
		<comments>http://perlhacks.com/2012/01/the-perl-community-a-modest-proposal/#comments</comments>
		<pubDate>Wed, 04 Jan 2012 09:48:29 +0000</pubDate>
		<dc:creator>Dave Cross</dc:creator>
				<category><![CDATA[Speaking]]></category>
		<category><![CDATA[community]]></category>
		<category><![CDATA[london]]></category>
		<category><![CDATA[lpw]]></category>
		<category><![CDATA[lpw2011]]></category>
		<category><![CDATA[perl masons]]></category>
		<category><![CDATA[speaking]]></category>

		<guid isPermaLink="false">http://perlhacks.com/?p=399</guid>
		<description><![CDATA[Here&#8217;s a video of the lightning talk that I gave at the London Perl Workshop in November last year. This video (along with many other videos from the workshop) is also available at Presenting Perl. Related Posts:Modern Core Perl SlidesModern Core PerlModern Core Perl at the LPWA Brief History of the LPWLondon Perl Workshop]]></description>
			<content:encoded><![CDATA[<div class="plus-one-wrap"><g:plusone size="small" href="http://perlhacks.com/2012/01/the-perl-community-a-modest-proposal/"></g:plusone></div><p><iframe src="http://www.youtube.com/embed/fAK035TthqM" frameborder="0" width="560" height="315"></iframe></p>
<p>Here&#8217;s a <a href="http://www.youtube.com/watch?v=fAK035TthqM">video of the lightning talk</a> that I gave at the <a href="http://conferences.yapceurope.org/lpw2011/">London Perl Workshop</a> in November last year.</p>
<p>This video (along with many other videos from the workshop) is also available at <a href="http://www.presentingperl.org/lpw2011/">Presenting Perl</a>.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://perlhacks.com/2011/11/modern-core-perl-slides/" rel="bookmark" class="crp_title">Modern Core Perl Slides</a></li><li><a href="http://perlhacks.com/2011/10/modern-core-perl/" rel="bookmark" class="crp_title">Modern Core Perl</a></li><li><a href="http://perlhacks.com/2011/09/modern-core-perl-at-the-lwp/" rel="bookmark" class="crp_title">Modern Core Perl at the LPW</a></li><li><a href="http://perlhacks.com/2011/11/a-brief-history-of-the-lpw/" rel="bookmark" class="crp_title">A Brief History of the LPW</a></li><li><a href="http://perlhacks.com/2009/11/london-perl-workshop/" rel="bookmark" class="crp_title">London Perl Workshop</a></li></ul></div><img src="http://feeds.feedburner.com/~r/PerlHacks/~4/IVzccwGtDUo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://perlhacks.com/2012/01/the-perl-community-a-modest-proposal/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://perlhacks.com/2012/01/the-perl-community-a-modest-proposal/</feedburner:origLink></item>
		<item>
		<title>Public Training Courses in February</title>
		<link>http://feedproxy.google.com/~r/PerlHacks/~3/QelaWC1XKbk/</link>
		<comments>http://perlhacks.com/2011/12/public-training-courses-in-february/#comments</comments>
		<pubDate>Tue, 20 Dec 2011 14:08:11 +0000</pubDate>
		<dc:creator>Dave Cross</dc:creator>
				<category><![CDATA[Training]]></category>
		<category><![CDATA[2012]]></category>
		<category><![CDATA[advanced]]></category>
		<category><![CDATA[february]]></category>
		<category><![CDATA[intermediate]]></category>
		<category><![CDATA[london]]></category>
		<category><![CDATA[public courses]]></category>
		<category><![CDATA[training]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://perlhacks.com/?p=394</guid>
		<description><![CDATA[I&#8217;ll be running some public training courses in London in February. There will be two two-day courses (which include practical sessions). The intermediate course will be on Feb 21/22 and the advanced course will be running on Feb 23/24. The courses will be held at the Imperial Hotel in Russell Square. For more details (including [...]]]></description>
			<content:encoded><![CDATA[<div class="plus-one-wrap"><g:plusone size="small" href="http://perlhacks.com/2011/12/public-training-courses-in-february/"></g:plusone></div><p>I&#8217;ll be running some public training courses in London in February. There will be two two-day courses (which include practical sessions). The intermediate course will be on Feb 21/22 and the advanced course will be running on Feb 23/24. The courses will be held at the Imperial Hotel in Russell Square.</p>
<p>For more details (including the syllabus and prices) please see my <a href="http://mag-sol.com/train/public/">training page</a>.</p>
<p>There are plenty of unfilled Perl jobs in London currently. I&#8217;m constantly getting recruiters phoning or emailing me asking for help finding suitable candidates. If you&#8217;ve done a bit of Perl in the past, but left it for other technologies, now would be a good time to rekindle your interest and these would be good courses to take (but, of course, I would say that, wouldn&#8217;t I!)</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://perlhacks.com/2010/03/plug-plug-plug/" rel="bookmark" class="crp_title">Plug Plug Plug</a></li><li><a href="http://perlhacks.com/2009/10/learn-perl-in-london/" rel="bookmark" class="crp_title">Learn Perl in London</a></li><li><a href="http://perlhacks.com/2012/01/free-training-competition-in-linux-format/" rel="bookmark" class="crp_title">Free Training Competition in Linux Format</a></li><li><a href="http://perlhacks.com/2010/01/market-research/" rel="bookmark" class="crp_title">Market Research</a></li><li><a href="http://perlhacks.com/2009/09/speaking-and-training-and-stuff/" rel="bookmark" class="crp_title">Speaking and Training and Stuff</a></li></ul></div><img src="http://feeds.feedburner.com/~r/PerlHacks/~4/QelaWC1XKbk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://perlhacks.com/2011/12/public-training-courses-in-february/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://perlhacks.com/2011/12/public-training-courses-in-february/</feedburner:origLink></item>
		<item>
		<title>More Modern Perl in Linux Format</title>
		<link>http://feedproxy.google.com/~r/PerlHacks/~3/gBg6qraU6Cg/</link>
		<comments>http://perlhacks.com/2011/12/more-modern-perl-in-linux-format/#comments</comments>
		<pubDate>Sun, 04 Dec 2011 10:24:13 +0000</pubDate>
		<dc:creator>Dave Cross</dc:creator>
				<category><![CDATA[Marketing]]></category>
		<category><![CDATA[dancer]]></category>
		<category><![CDATA[linux format]]></category>
		<category><![CDATA[lxf]]></category>
		<category><![CDATA[magazines]]></category>
		<category><![CDATA[marketing]]></category>
		<category><![CDATA[modern perl]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://perlhacks.com/?p=386</guid>
		<description><![CDATA[Yesterday&#8217;s post bought my subscription copy of Linux Format issue 153. This issue contains the second article in my short series about Modern Perl. In this article we take the simple DBIx::Class application that we wrote last time and put a web front end on it using Dancer. Over the next few days I&#8217;ll be [...]]]></description>
			<content:encoded><![CDATA[<div class="plus-one-wrap"><g:plusone size="small" href="http://perlhacks.com/2011/12/more-modern-perl-in-linux-format/"></g:plusone></div><p><a href="http://perlhacks.com/wp-content/uploads/2011/12/153.jpg"><img src="http://perlhacks.com/wp-content/uploads/2011/12/153.jpg" alt="" title="Linux Format #153" width="148" height="210" class="alignleft size-full wp-image-387" /></a> Yesterday&#8217;s post bought my subscription copy of <a href="http://www.linuxformat.com/">Linux Format</a> issue 153. This issue contains the second article in my short series about Modern Perl. In this article we take the simple DBIx::Class application that we wrote last time and put a web front end on it using Dancer.</p>
<p>Over the next few days I&#8217;ll be writing the third (and final) article in the series. This will involve adding more features to the web app.</p>
<p>If the series is successful (and please let LXF know if you liked it) then perhaps I&#8217;ll be asked back to write more next year.</p>
<p>LXF 153 should be appearing in all good newsagents next week.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://perlhacks.com/2011/10/modern-perl-in-linux-format/" rel="bookmark" class="crp_title">Modern Perl in Linux Format</a></li><li><a href="http://perlhacks.com/2012/01/yet-more-modern-perl-in-linux-format/" rel="bookmark" class="crp_title">Yet More Modern Perl in Linux Format</a></li><li><a href="http://perlhacks.com/2011/03/perl-vogue-t-shirts/" rel="bookmark" class="crp_title">Perl Vogue T-Shirts</a></li><li><a href="http://perlhacks.com/2011/04/an-open-letter-to-linux-format/" rel="bookmark" class="crp_title">An Open Letter to Linux Format</a></li><li><a href="http://perlhacks.com/2012/01/free-training-competition-in-linux-format/" rel="bookmark" class="crp_title">Free Training Competition in Linux Format</a></li></ul></div><img src="http://feeds.feedburner.com/~r/PerlHacks/~4/gBg6qraU6Cg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://perlhacks.com/2011/12/more-modern-perl-in-linux-format/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://perlhacks.com/2011/12/more-modern-perl-in-linux-format/</feedburner:origLink></item>
		<item>
		<title>London Perl Workshop Review</title>
		<link>http://feedproxy.google.com/~r/PerlHacks/~3/DuXJgkYhtzk/</link>
		<comments>http://perlhacks.com/2011/11/london-perl-workshop-review/#comments</comments>
		<pubDate>Tue, 29 Nov 2011 14:01:19 +0000</pubDate>
		<dc:creator>Dave Cross</dc:creator>
				<category><![CDATA[Conferences]]></category>
		<category><![CDATA[london perl workshop]]></category>
		<category><![CDATA[lpw]]></category>
		<category><![CDATA[lpw2011]]></category>

		<guid isPermaLink="false">http://perlhacks.com/?p=380</guid>
		<description><![CDATA[Unfortunately O&#8217;Reilly&#8217;s Josette Garcia couldn&#8217;t be at the London Perl Workshop, so she asked if I could write something about it for her blog. It took me longer than it should have done, but my post has just been published over at Josetteorama. Hopefully Josette will be back at next year&#8217;s event. She was much [...]]]></description>
			<content:encoded><![CDATA[<div class="plus-one-wrap"><g:plusone size="small" href="http://perlhacks.com/2011/11/london-perl-workshop-review/"></g:plusone></div><p>Unfortunately O&#8217;Reilly&#8217;s Josette Garcia couldn&#8217;t be at the London Perl Workshop, so she asked if I could write something about it for her blog.</p>
<p>It took me longer than it should have done, but <a href="http://www.josetteorama.com/perl/london-perl-workshop/">my post has just been published over at Josetteorama</a>.</p>
<p>Hopefully Josette will be back at next year&#8217;s event. She was much missed (although, of course, Alice did a fine job of making up for Josette&#8217;s absence).</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://perlhacks.com/2011/07/yapceurope-preview/" rel="bookmark" class="crp_title">YAPC::Europe Preview</a></li><li><a href="http://perlhacks.com/2009/11/london-perl-workshop/" rel="bookmark" class="crp_title">London Perl Workshop</a></li><li><a href="http://perlhacks.com/2011/11/a-brief-history-of-the-lpw/" rel="bookmark" class="crp_title">A Brief History of the LPW</a></li><li><a href="http://perlhacks.com/2011/10/modern-core-perl/" rel="bookmark" class="crp_title">Modern Core Perl</a></li><li><a href="http://perlhacks.com/2012/01/the-perl-community-a-modest-proposal/" rel="bookmark" class="crp_title">The Perl Community &#8211; A Modest Proposal</a></li></ul></div><img src="http://feeds.feedburner.com/~r/PerlHacks/~4/DuXJgkYhtzk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://perlhacks.com/2011/11/london-perl-workshop-review/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://perlhacks.com/2011/11/london-perl-workshop-review/</feedburner:origLink></item>
		<item>
		<title>Programming Like It’s 1999</title>
		<link>http://feedproxy.google.com/~r/PerlHacks/~3/9ZJ4_7hukms/</link>
		<comments>http://perlhacks.com/2011/11/programming-like-its-1999/#comments</comments>
		<pubDate>Tue, 22 Nov 2011 19:28:10 +0000</pubDate>
		<dc:creator>Dave Cross</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[imdb]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://perlhacks.com/?p=370</guid>
		<description><![CDATA[This article was published yesterday. It shows a way to extract data about a film from IMDB and put it into a local database. Actually, it doesn&#8217;t even do that. It produces SQL that you can then run to insert the data. It&#8217;s all rather nasty stuff and indicative of the fact that most people [...]]]></description>
			<content:encoded><![CDATA[<div class="plus-one-wrap"><g:plusone size="small" href="http://perlhacks.com/2011/11/programming-like-its-1999/"></g:plusone></div><p><a href="http://bobbelderbos.com/2011/11/movie-database-imdb-api-perl/">This article</a> was published yesterday. It shows a way to extract data about a film from IMDB and put it into a local database. Actually, it doesn&#8217;t even do that. It produces SQL that you can then run to insert the data.</p>
<p>It&#8217;s all rather nasty stuff and indicative of the fact that most people using Perl are still using idioms that would have made us shudder ten years ago.</p>
<p>There were a few things that I didn&#8217;t like about the code. The use of <code>curl</code> to grab data from the web site, the indirect object syntax when creating the XML::Simple object and, in particular, the huge amount of repetitive code used to create the SQL statements.</p>
<p>So I did what anyone would do in my situation. I rewrote it. Here&#8217;s my version.</p>
<pre>
#!/usr/bin/perl

use strict;
use warnings;

use XML::Simple;
use LWP::Simple;

@ARGV or die "Please provide movie title in quotes\n";

my $movie = shift;
$movie =~ s/\s/+/g;

my $movieData = get "http://www.imdbapi.com/?r=XML&#038;t=$movie";
my $data = XMLin( $movieData );

my @fields = qw[released rating director genre writer runtime plot id
                title votes poster year rated actors];

my %film = %{$data->{movie}};

foreach (@fields) {
  $film{$_} =~ s/'/\\'/g;
}

my $tstamp = time();

my $sql = 'INSERT INTO movie_collection (';
$sql .= join ', ', @fields;
$sql .= ') VALUES (';
$sql .= join ', ', map { qq['$film{$_}'] } @fields;
$sql .= ",'" . time . "');\n";

print $sql;
</pre>
<p>I haven&#8217;t actually changed that much. I&#8217;ve tidied up a bit. Switched to using LWP::Simple, removed some unnecessary escaping, things like that. I have made two pretty big changes. I&#8217;ve got rid of all of the nasty variables containing data about a film. A film is a single object and therefore should be stored in a single variable. And, happily enough, the $data you get back from <code>XMLin</code> contains a hash that does the trick perfectly.</p>
<p>The second change I made was to rejig the way that the SQL is created. By using an array that contains the names of all of the columns in the table, I can generate the SQL programmatically without all of that repetitive code. I&#8217;ve even made the SQL a little safer by explicitly listing the columns that we are inserting data into (this has the side effect of no longer needing to insert a NULL into the id column).</p>
<p>Of course, this would just be a first step. The whole idea of generating SQL to run against the database is ugly. You&#8217;d really want to use <a href="https://metacpan.org/module/DBIx::Class">DBIx::Class</a> (or, at the very least, <a href="https://metacpan.org/module/DBI">DBI</a>) to insert the data directly into the database. And why mess around with raw XML when you can us something like <a href="https://metacpan.org/module/IMDB::Film">IMDB::Film</a> to do it?</p>
<p>At that point in my thought process I had an epiphany. You don&#8217;t need the database at all. The IMDB data changes all the time. Why take a local copy? Why not just use the web service directly with IMDB::Film (or perhaps <a href="https://metacpan.org/module/WebService::IMDB">WebService::IMDB</a> &#8211; I haven&#8217;t used either of them so I have no strong opinions on this).</p>
<p>In general, I think that the original code was too complicated. Which made it hard to maintain. My version is better (but I am, of course, biased) but it can be made even better by using more from <a href="http://metacpan.org/">CPAN</a>.</p>
<p>CPAN is Perl&#8217;s killer app. If you&#8217;re not using CPAN then you&#8217;re not using half the power of Perl.</p>
<p>What do you think? How would you write this program?</p>
<p><strong>Update:</strong> A few people have mentioned the fact that I&#8217;m directly interpolating random data into my SQL statements &#8211; which is generally seen as a bad thing as it opens the door to <a href="http://en.wikipedia.org/wiki/SQL_injection">SQL injection</a> attacks. In my defence, I&#8217;d like to make a couple of points.</p>
<p>Firstly, the data I&#8217;m using isn&#8217;t just any old data. It&#8217;s data that is returned from the IMDB API. So it would be hard to use this for a malicious attack on the system (at least until Hollywood makes a film about the life of <a href="http://xkcd.com/327/">Bobby Tables</a>).</p>
<p>Secondly, I am cleaning the data before using it. I&#8217;m escaping any single quotes in the input data. I think that removes the possibility of attack. I could be wrong though, if that&#8217;s the case, please let me know what I&#8217;m missing.</p>
<p>But, in general, I agree that this approach is dangerous. This is one of the major advantages of using DBI. By using <a href="https://metacpan.org/module/DBI#Placeholders-and-Bind-Values">bound parameters</a> in your SQL statements you can remove possibility of SQL injection attacks.</p>
<p><strong>Update 2:</strong> You can, of course, rely on Zefram to point out the issues here. <a href="http://perlhacks.com/2011/11/programming-like-its-1999/#comment-2995">His comment</a> is well worth reading.</p>
<p>Other people (on IRC) raised the potential of other Unicode characters that databases treat as quote characters but that aren&#8217;t covered by my substitution.</p>
<p><strong>Update 3:</strong> <a href="http://perlhacks.com/code/getMovieData">Here&#8217;s a local copy of the original code.</a></p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://perlhacks.com/2010/02/building-rpms-from-cpan-distributions/" rel="bookmark" class="crp_title">Building RPMs from CPAN Distributions</a></li><li><a href="http://perlhacks.com/2011/04/an-open-letter-to-linux-format/" rel="bookmark" class="crp_title">An Open Letter to Linux Format</a></li><li><a href="http://perlhacks.com/2009/10/perlanet_update/" rel="bookmark" class="crp_title">Perlanet Update</a></li><li><a href="http://perlhacks.com/2009/06/what-is-wrong-with-this-picture/" rel="bookmark" class="crp_title">What is Wrong With this Picture?</a></li><li><a href="http://perlhacks.com/2009/12/perlanet-improvements/" rel="bookmark" class="crp_title">Perlanet Improvements</a></li></ul></div><img src="http://feeds.feedburner.com/~r/PerlHacks/~4/9ZJ4_7hukms" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://perlhacks.com/2011/11/programming-like-its-1999/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		<feedburner:origLink>http://perlhacks.com/2011/11/programming-like-its-1999/</feedburner:origLink></item>
		<item>
		<title>Saint Pierre and Miquelon</title>
		<link>http://feedproxy.google.com/~r/PerlHacks/~3/Lg7pQLCrrs0/</link>
		<comments>http://perlhacks.com/2011/11/saint-pierre-and-miquelon/#comments</comments>
		<pubDate>Mon, 21 Nov 2011 17:45:49 +0000</pubDate>
		<dc:creator>Dave Cross</dc:creator>
				<category><![CDATA[Community]]></category>
		<category><![CDATA[.pm]]></category>
		<category><![CDATA[afnic]]></category>
		<category><![CDATA[cctld]]></category>
		<category><![CDATA[domains]]></category>
		<category><![CDATA[perl mongers]]></category>
		<category><![CDATA[saint pierre and miquelon]]></category>

		<guid isPermaLink="false">http://perlhacks.com/?p=366</guid>
		<description><![CDATA[Does Saint Pierre and Miquelon mean anything to you? It&#8217;s a small French-owned territory just off the coast of Newfoundland. Why would this be of any interest on a Perl blog? Well, it&#8217;s a French territory with it&#8217;s own ccTLD. And that ccTLD is .pm. Ever since Perl Mongers started we&#8217;ve looked longingly at that [...]]]></description>
			<content:encoded><![CDATA[<div class="plus-one-wrap"><g:plusone size="small" href="http://perlhacks.com/2011/11/saint-pierre-and-miquelon/"></g:plusone></div><p>Does <a href="http://en.wikipedia.org/wiki/Saint_Pierre_and_Miquelon">Saint Pierre and Miquelon</a> mean anything to you? It&#8217;s a small French-owned territory just off the coast of Newfoundland.</p>
<p>Why would this be of any interest on a Perl blog? Well, it&#8217;s a French territory with it&#8217;s own <a href="http://en.wikipedia.org/wiki/CcTLD">ccTLD</a>. And that ccTLD is .pm.</p>
<p>Ever since Perl Mongers started we&#8217;ve looked longingly at that TLD, thinking how cool it would be to own a .pm domain. But domain registration in .pm is run by the French registry, <a href="http://en.wikipedia.org/wiki/AFNIC">AFNIC</a> and for at least the last thirteen years they have refused all registrations under that domain. This made many Perl Mongers very sad.</p>
<p>But that is about to change. It appears that from 6th December, AFNIC are <a href="http://www.afnic.fr/en/about-afnic/news/general-news/5060/show/6-december-2011-opening-to-europe-of-the-fr-and-other-tlds-operated-by-afnic-2.html">going to open registrations</a> under a number of their previously suspended domains &#8211; including .pm. I think you&#8217;ll need to be in the EU in order to register a .pm domain, but I don&#8217;t think that will be a huge problem.</p>
<p>And it&#8217;s not just for Perl Monger groups. You&#8217;ll also be able to have domains for your favourite Perl modules too (or, at least, the ones without &#8216;::&#8217; in their names).</p>
<p>Which .pm domains do you have your eye on? And what are you going to do with it.</p>
<p>Maybe one year we should have YAPC::NA in Saint Pierre and Miquelon and YAPC::EU in Poland.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://perlhacks.com/2011/06/doomed-domains/" rel="bookmark" class="crp_title">Doomed Domains</a></li><li><a href="http://perlhacks.com/2009/05/a-perl-programming-blog/" rel="bookmark" class="crp_title">A Perl Programming Blog</a></li><li><a href="http://perlhacks.com/2011/07/moving-stuff-around/" rel="bookmark" class="crp_title">Moving Stuff Around</a></li><li><a href="http://perlhacks.com/2009/11/socialable-mongers/" rel="bookmark" class="crp_title">Socialable Mongers</a></li><li><a href="http://perlhacks.com/2010/02/fosdem/" rel="bookmark" class="crp_title">FOSDEM</a></li></ul></div><img src="http://feeds.feedburner.com/~r/PerlHacks/~4/Lg7pQLCrrs0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://perlhacks.com/2011/11/saint-pierre-and-miquelon/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://perlhacks.com/2011/11/saint-pierre-and-miquelon/</feedburner:origLink></item>
		<item>
		<title>A Brief History of the LPW</title>
		<link>http://feedproxy.google.com/~r/PerlHacks/~3/vH3seBQzTUg/</link>
		<comments>http://perlhacks.com/2011/11/a-brief-history-of-the-lpw/#comments</comments>
		<pubDate>Tue, 15 Nov 2011 11:53:20 +0000</pubDate>
		<dc:creator>Dave Cross</dc:creator>
				<category><![CDATA[Conferences]]></category>
		<category><![CDATA[conferences]]></category>
		<category><![CDATA[london perl workshop]]></category>
		<category><![CDATA[lpw]]></category>

		<guid isPermaLink="false">http://perlhacks.com/?p=360</guid>
		<description><![CDATA[In his opening remarks on Saturday, Mark Keating suggested that we might be at the tenth London Perl Workshop. That seemed unlikely to me, so I&#8217;ve done a little research. And it seems that I was right. The first LPW was in 2004, which makes this year&#8217;s the eighth. In a way, I&#8217;m happy that [...]]]></description>
			<content:encoded><![CDATA[<div class="plus-one-wrap"><g:plusone size="small" href="http://perlhacks.com/2011/11/a-brief-history-of-the-lpw/"></g:plusone></div><p>In his opening remarks on Saturday, <a href="http://mdk.me/">Mark Keating</a> suggested that we might be at the tenth London Perl Workshop. That seemed unlikely to me, so I&#8217;ve done a little research.</p>
<p>And it seems that I was right. The first LPW was in 2004, which makes this year&#8217;s the eighth. In a way, I&#8217;m happy that it wasn&#8217;t the tenth, as we now have two years to ensure that the tenth LPW is celebrated appropriately.</p>
<p>Here&#8217;s a list of the LPWs so far. I&#8217;ve also included details of the talks I gave at each workshop &#8211; mainly so that I can disprove Mark when he claims that I always show up and run training.</p>
<p>It seems that the web sites for some of the earlier workshops have fallen off the internet. This makes me a little sad. If I&#8217;m wrong and it&#8217;s just that Google can&#8217;t find them, then please let me know.</p>
<p>1st LPW &#8211; 11 Dec 2004<br />
<a href="http://lanyrd.com/2004/london-perl-workshop/">Lanyrd link</a><br />
At Imperial College. I gave a 20 minute talk about OO Perl.</p>
<p>2nd LPW &#8211; 26 Nov 2005<br />
<a href="http://lanyrd.com/2005/london-perl-workshop/">Lanyrd link</a><br />
At City University. I gave a 20 minute talk on Databases and Perl.</p>
<p>3rd LPW &#8211; 9 Dec 2006<br />
<a href="http://lanyrd.com/2006/london-perl-workshop/">Lanyrd link</a><br />
I think this was the first LPW at its current home of the University of Westminster. I can&#8217;t be sure as I wasn&#8217;t there. I have a good excuse though &#8211; I was on holiday celebrating my tenth wedding anniversary.</p>
<p><a href="http://conferences.yapceurope.org/lpw2007/">4th LPW</a> &#8211; 1 Dec 2007<br />
<a href="http://lanyrd.com/2007/london-perl-workshop/">Lanyrd link</a><br />
At the University of Westminster. I gave a training course on <a href="http://www.slideshare.net/davorg/lpw-begin">Beginning Perl</a>.</p>
<p><a href="http://conferences.yapceurope.org/lpw2008/">5th LPW</a> &#8211; 29 Nov 2008<br />
<a href="http://lanyrd.com/2008/london-perl-workshop/">Lanyrd link</a><br />
At the University of Westminster. I gave the keynote (<a href="http://www.slideshare.net/davorg/ye-complete-history-of-ye-perle-mongers-of-london-towne-parte-one-presentation">a history of london.pm</a> as it was our tenth anniversary) and a training course on <a href="http://www.slideshare.net/davorg/webintro-presentation">Web Programming</a>.</p>
<p><a href="http://conferences.yapceurope.org/lpw2009/">6th LPW</a> &#8211; 5 Dec 2009<br />
<a href="http://lanyrd.com/2009/london-perl-workshop/">Lanyrd link</a><br />
At the University of Westminster. I gave the keynote (about <a href="http://www.slideshare.net/davorg/the-m-word">marketing Perl</a>) and a training course called &#8220;<a href="http://www.slideshare.net/davorg/the-professional-programmer">The Professional Programmer</a>&#8220;.</p>
<p><a href="http://conferences.yapceurope.org/lpw2010/">7th LPW</a> &#8211; 4th Dec 2010<br />
<a href="http://lanyrd.com/2010/london-perl-workshop/">Lanyrd link</a><br />
At the University of Westminster (although not in the usual building). I gave a training course on <a href="http://www.slideshare.net/davorg/modern-web-programming-with-perl">Modern Web</a> programming (i.e. Plack) and a talk on <a href="http://www.slideshare.net/davorg/evolving-software-with-moose">Roles and Traits in Moose</a>.</p>
<p><a href="http://conferences.yapceurope.org/lpw2011/schedule">8th LPW</a> &#8211; 12 Nov 2011<br />
<a href="http://lanyrd.com/2011/london-perl-workshop/">Lanyrd link</a><br />
At the University of Westminster. I gave a training course on <a href="http://cdn.slidesharecdn.com/modern-core-perl-111113094055-phpapp02-thumbnail-2">Modern Core Perl</a>.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://perlhacks.com/2009/11/london-perl-workshop/" rel="bookmark" class="crp_title">London Perl Workshop</a></li><li><a href="http://perlhacks.com/2010/12/modern-perl-web-development/" rel="bookmark" class="crp_title">Modern Perl Web Development</a></li><li><a href="http://perlhacks.com/2009/09/speaking-and-training-and-stuff/" rel="bookmark" class="crp_title">Speaking and Training and Stuff</a></li><li><a href="http://perlhacks.com/2011/09/modern-core-perl-at-the-lwp/" rel="bookmark" class="crp_title">Modern Core Perl at the LPW</a></li><li><a href="http://perlhacks.com/2011/10/modern-core-perl/" rel="bookmark" class="crp_title">Modern Core Perl</a></li></ul></div><img src="http://feeds.feedburner.com/~r/PerlHacks/~4/vH3seBQzTUg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://perlhacks.com/2011/11/a-brief-history-of-the-lpw/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://perlhacks.com/2011/11/a-brief-history-of-the-lpw/</feedburner:origLink></item>
		<item>
		<title>Modern Core Perl Slides</title>
		<link>http://feedproxy.google.com/~r/PerlHacks/~3/fWFTjdPzPMc/</link>
		<comments>http://perlhacks.com/2011/11/modern-core-perl-slides/#comments</comments>
		<pubDate>Sun, 13 Nov 2011 17:50:32 +0000</pubDate>
		<dc:creator>Dave Cross</dc:creator>
				<category><![CDATA[Speaking]]></category>
		<category><![CDATA[london]]></category>
		<category><![CDATA[london perl workshop]]></category>
		<category><![CDATA[lpw]]></category>
		<category><![CDATA[lpw2011]]></category>
		<category><![CDATA[modern core perl]]></category>
		<category><![CDATA[speaking]]></category>

		<guid isPermaLink="false">http://perlhacks.com/?p=355</guid>
		<description><![CDATA[Here are the slides from the Modern Core Perl talk that I gave at the LPW yesterday. Modern Core Perl View more presentations from Dave Cross A great day at the workshop as always. And what a lot of people there were! Thanks to everyone who organised, spoke or attended. Related Posts:Modern Perl Web DevelopmentEvolving [...]]]></description>
			<content:encoded><![CDATA[<div class="plus-one-wrap"><g:plusone size="small" href="http://perlhacks.com/2011/11/modern-core-perl-slides/"></g:plusone></div><p>Here are the slides from the Modern Core Perl talk that I gave at the LPW yesterday.</p>
<div style="width:425px" id="__ss_10140689"> <strong style="display:block;margin:12px 0 4px"><a href="http://www.slideshare.net/davorg/modern-core-perl" title="Modern Core Perl" target="_blank">Modern Core Perl</a></strong> <iframe src="http://www.slideshare.net/slideshow/embed_code/10140689" width="425" height="355" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>
<div style="padding:5px 0 12px"> View more <a href="http://www.slideshare.net/" target="_blank">presentations</a> from <a href="http://www.slideshare.net/davorg" target="_blank">Dave Cross</a> </div>
</p></div>
<p>A great day at the workshop as always. And what a lot of people there were! Thanks to everyone who organised, spoke or attended.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://perlhacks.com/2010/12/modern-perl-web-development/" rel="bookmark" class="crp_title">Modern Perl Web Development</a></li><li><a href="http://perlhacks.com/2010/10/evolving-software-with-moose/" rel="bookmark" class="crp_title">Evolving Software with Moose</a></li><li><a href="http://perlhacks.com/2010/09/modern-perl-at-opentech-1/" rel="bookmark" class="crp_title">Modern Perl at OpenTech</a></li><li><a href="http://perlhacks.com/2009/12/the-m-word/" rel="bookmark" class="crp_title">The “M” Word</a></li><li><a href="http://perlhacks.com/2010/08/perl-vogue/" rel="bookmark" class="crp_title">Perl Vogue</a></li></ul></div><img src="http://feeds.feedburner.com/~r/PerlHacks/~4/fWFTjdPzPMc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://perlhacks.com/2011/11/modern-core-perl-slides/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://perlhacks.com/2011/11/modern-core-perl-slides/</feedburner:origLink></item>
	</channel>
</rss><!-- Dynamic page generated in 0.337 seconds. --><!-- File not cached! Super Cache Couldn't write to: wp-content/cache/wp-cache-b292ba8319b0c62d3d961e9abf226a19.html -->

