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

<channel>
	<title>The Dumping Ground</title>
	<atom:link href="http://colinnewell.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://colinnewell.wordpress.com</link>
	<description>Nothing's too trivial</description>
	<lastBuildDate>Thu, 26 Jan 2012 21:46:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='colinnewell.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>The Dumping Ground</title>
		<link>http://colinnewell.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://colinnewell.wordpress.com/osd.xml" title="The Dumping Ground" />
	<atom:link rel='hub' href='http://colinnewell.wordpress.com/?pushpress=hub'/>
		<item>
		<title>POST testing JSON REST API&#8217;s with WWW::Mechanize</title>
		<link>http://colinnewell.wordpress.com/2012/01/26/610/</link>
		<comments>http://colinnewell.wordpress.com/2012/01/26/610/#comments</comments>
		<pubDate>Thu, 26 Jan 2012 21:44:09 +0000</pubDate>
		<dc:creator>colinnewell</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[perl5]]></category>

		<guid isPermaLink="false">http://colinnewell.wordpress.com/?p=610</guid>
		<description><![CDATA[Having just read the article on POST and PUT in REST API’s I realised I’d goofed a couple of my operations on one of my API’s. I have tests and this is Perl so how hard can it be to convert over? With Catalyst::Action::REST indeed it is pretty simple to convert my calls, in fact [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=colinnewell.wordpress.com&amp;blog=1215813&amp;post=610&amp;subd=colinnewell&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Having just read the <a href="http://jcalcote.wordpress.com/2008/10/16/put-or-post-the-rest-of-the-story/">article</a> on POST and PUT in REST API’s I realised I’d goofed a couple of my operations on one of my API’s.</p>
<p>I have tests and this is Perl so how hard can it be to convert over?  With <a href="http://search.cpan.org/dist/Catalyst-Action-REST/">Catalyst::Action::REST</a> indeed it is pretty simple to convert my calls, in fact it’s a case of changing the word PUT to POST in some of my function names.  It’s the tests where things got interesting.  I’m using <a href="http://search.cpan.org/perldoc?Test::WWW::Mechanize">Test::WWW::Mechanize</a> variants to do my testing because it’s nice and simple.  Unfortunately switching from <code>put_ok</code> to <code>post_ok</code> didn’t produce the desired results.  When it came to the API it wasn’t reading the data at all.  A bit of digging revealed that the <code>post_ok</code> call encoded the parameters in the <code>application/x-www-form-urlencoded</code> style before posting, where as the <code>put_ok</code> call just passed the json through raw.  </p>
<p>Some digging into the <code>Catalyst::Action::REST</code> module revealed that they may well have had a similar issue because they created a little helper module called <code>Test::Rest</code> (not to be confused with <code>Test::Rest</code> on CPAN) which created the requests by hand for use in the test suite.  Of course they may have simply been avoiding dependencies, and just been lucky to avoid the magic.</p>
<p>I didn’t manage to figure out a way to turn it off so in the end I did a similar thing.  The fix for my test suite was to create a simple sub like this that rolled my own POST request with out any magic, then to call <code>$mech-&gt;request</code> to simply pass the request through like I was already doing with the DELETE’s.  It’s basically a dumbed down version of a method from the <code>Test::Rest</code> from <code>Catalyst::Action::REST</code>.</p>
<p><pre class="brush: perl;">
use HTTP::Request;

sub construct_post
{
    my $url = shift;
    my $data = shift;

    my $req = HTTP::Request-&gt;new( &quot;POST&quot; =&gt; $url );
    $req-&gt;content_type( 'application/json' );
    $req-&gt;content_length(
        do { use bytes; length( $data ) }
    );
    $req-&gt;content( $data );
    return $req;
}
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/colinnewell.wordpress.com/610/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/colinnewell.wordpress.com/610/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/colinnewell.wordpress.com/610/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/colinnewell.wordpress.com/610/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/colinnewell.wordpress.com/610/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/colinnewell.wordpress.com/610/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/colinnewell.wordpress.com/610/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/colinnewell.wordpress.com/610/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/colinnewell.wordpress.com/610/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/colinnewell.wordpress.com/610/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/colinnewell.wordpress.com/610/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/colinnewell.wordpress.com/610/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/colinnewell.wordpress.com/610/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/colinnewell.wordpress.com/610/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=colinnewell.wordpress.com&amp;blog=1215813&amp;post=610&amp;subd=colinnewell&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://colinnewell.wordpress.com/2012/01/26/610/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1bae18aebc08108ae3c9b58f45407e0d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">colinnewell</media:title>
		</media:content>
	</item>
		<item>
		<title>Catalyst and Plack testing</title>
		<link>http://colinnewell.wordpress.com/2012/01/21/catalyst-and-plack-testing/</link>
		<comments>http://colinnewell.wordpress.com/2012/01/21/catalyst-and-plack-testing/#comments</comments>
		<pubDate>Sat, 21 Jan 2012 15:38:10 +0000</pubDate>
		<dc:creator>colinnewell</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[catalyst]]></category>
		<category><![CDATA[perl5]]></category>
		<category><![CDATA[plack]]></category>

		<guid isPermaLink="false">http://colinnewell.wordpress.com/?p=605</guid>
		<description><![CDATA[Since Catalyst has switched to Plack for it’s underlying engine it’s opened up lots of funky new possibilities. You can move parts of your infrastructure outside of your catalyst app, while still making use of the catalyst configuration, and still keeping it in the code for the project. When it comes to testing it does [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=colinnewell.wordpress.com&amp;blog=1215813&amp;post=605&amp;subd=colinnewell&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Since Catalyst has switched to Plack for it’s underlying engine it’s opened up lots of funky new possibilities.  You can move parts of your infrastructure outside of your catalyst app, while still making use of the catalyst configuration, and still keeping it in the code for the project.  </p>
<p>When it comes to testing it does not appear that the <a href="http://search.cpan.org/perldoc?Catalyst::Test">Catalyst::Test</a> and <a href="http://search.cpan.org/perldoc?Test::WWW::Mechanize::Catalyst">Test::WWW::Mechanize::Catalyst</a> modules automatically pick up your .psgi file when building the test server.  This might be a feature for some tests, but sometimes you’ll definitely want to test the whole lot together.  Luckily that’s fairly simple.  When it comes to replacing Test::WWW::Mechanize::Catalyst you can switch to <a href="http://search.cpan.org/perldoc?Test::WWW::Mechanize::PSGI">PSGI</a> instead of Catalyst.  Probably the closest thing to Catalyst::Test is <a href="http://search.cpan.org/perldoc?Plack::Test">Plack::Test</a>.  Both test modules require you to provide a $app object which <a href="http://search.cpan.org/perldoc?Plack::Util">Plack::Util</a> makes it easy to load from your existing .psgi file.</p>
<p>Here’s a really simple test converted over to use a .psgi file.</p>
<p><pre class="brush: perl;">
use Test::Most;
use Test::WWW::Mechanize::PSGI;
use Plack::Util;

my $app = Plack::Util::load_psgi 'app.psgi';
my $mech = Test::WWW::Mechanize::PSGI-&gt;new( app =&gt; $app );

$mech-&gt;get_ok('/');

done_testing();
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/colinnewell.wordpress.com/605/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/colinnewell.wordpress.com/605/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/colinnewell.wordpress.com/605/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/colinnewell.wordpress.com/605/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/colinnewell.wordpress.com/605/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/colinnewell.wordpress.com/605/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/colinnewell.wordpress.com/605/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/colinnewell.wordpress.com/605/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/colinnewell.wordpress.com/605/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/colinnewell.wordpress.com/605/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/colinnewell.wordpress.com/605/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/colinnewell.wordpress.com/605/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/colinnewell.wordpress.com/605/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/colinnewell.wordpress.com/605/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=colinnewell.wordpress.com&amp;blog=1215813&amp;post=605&amp;subd=colinnewell&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://colinnewell.wordpress.com/2012/01/21/catalyst-and-plack-testing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1bae18aebc08108ae3c9b58f45407e0d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">colinnewell</media:title>
		</media:content>
	</item>
		<item>
		<title>Adding new reports to OpenERP</title>
		<link>http://colinnewell.wordpress.com/2012/01/04/adding-new-reports-to-openerp/</link>
		<comments>http://colinnewell.wordpress.com/2012/01/04/adding-new-reports-to-openerp/#comments</comments>
		<pubDate>Wed, 04 Jan 2012 20:12:16 +0000</pubDate>
		<dc:creator>colinnewell</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[openerp]]></category>

		<guid isPermaLink="false">http://colinnewell.wordpress.com/?p=590</guid>
		<description><![CDATA[Creating new modules for Open ERP is pretty simple. Here is how to package up some new reports into a module. In this example I’ve created another report to use with sales orders. This is based on the sales order report so in actual fact I use some of the code and xml from that [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=colinnewell.wordpress.com&amp;blog=1215813&amp;post=590&amp;subd=colinnewell&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Creating new modules for Open ERP is pretty simple.  Here is how to package up some new reports into a module.</p>
<p>In this example I’ve created another report to use with sales orders.  This is based on the sales order report so in actual fact I use some of the code and xml from that original report to build it up, then tweak them to produce the collection docket I want.  I&#8217;m not actually going to reproduce the report here, since that&#8217;s a trivial thing to customise.  The interesting thing is really how the module is packaged together and how to spot mistakes in the packaging.</p>
<h3>The files/folders in the zip</h3>
<p><pre class="brush: plain;">
module/__openerp__.py                # this contains the module info
module/report/collection_docket.rml  # the report
module/report/sale_order.py          # sets up the report parser
module/report/__init__.py            # just loads the code
module/reports.xml                   # registers the report
module/__init__.py                   # loads the code
</pre></p>
<h3>__openerp__.py</h3>
<p><pre class="brush: python;">
{
   'name': 'Extra Sales Reports',
   'version': '0.01',
   'category': 'Extra reports for sales',
   'description': &quot;&quot;&quot;
   The extra sales reports needed for our project,

   * Reports
     - Collection Docket

   &quot;&quot;&quot;,
   'author': 'OpusVL',
   'website': 'http://www.opusvl.com',
   'depends': ['stock', 'procurement', 'board', 'sale'],
   'init_xml': [],
   'update_xml': [
       'reports.xml',
   ],
   'demo_xml': [],
   'test': [],
   'installable': True,
   'active': False,
}
</pre></p>
<h3>__init.py__</h3>
<p><pre class="brush: python;">
import report
</pre></p>
<h3>reports.xml</h3>
<p><pre class="brush: xml;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;openerp&gt;
    &lt;data&gt;
        &lt;report auto=&quot;False&quot; id=&quot;collection_docket&quot; model=&quot;sale.order&quot; name=&quot;sale.collection_docket&quot; rml=&quot;module/report/collection_docket.rml&quot; string=&quot;Collection Docket&quot; /&gt;
    &lt;/data&gt;
&lt;/openerp&gt;
</pre></p>
<h3>report/__init__.py</h3>
<p><pre class="brush: python;">
import sale_order
report/sale_order.py
from report import report_sxw
import time


# this bit is basically a copy of the stuff
# in the regular sale order module.
# I can't just import that code because it causes
# the sale.order report to get registered again
# causing it to complain.
# otherwise I’d do this - from addons.sale.report import order 
class order(report_sxw.rml_parse):
    def __init__(self, cr, uid, name, context=None):
        super(order, self).__init__(cr, uid, name, context=context)
        self.localcontext.update({
            'time': time,
        })


report_sxw.report_sxw('report.sale.collection_docket', 'sale.order', 'addons/module/report/collection_docket.rml', parser=order, header=&quot;external&quot;)
</pre></p>
<h3>report/collection_docket.rml</h3>
<p><pre class="brush: xml;">
&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;document filename=&quot;Sale Order.pdf&quot;&gt;
... this is a copy of the addons/sale/report/sale_order.rml customised as necessary.
</pre></p>
<p>The module is then zipped up for distribution in a regular .zip file.  This can either be imported directly into OpenERP or it can be unzipped manually into the addons directory.</p>
<h2>Installation of the module via the OpenERP client</h2>
<ol>
<li>Go to Administration-&gt;Modules,
</li>
<li>Select Import module and select the zip [1].
</li>
<li>Select the module and mark it for install.
</li>
<li>Now restart OpenERP server.
</li>
<li>Now go back to the client and schedule the install of the module.</li>
</ol>
<p>If you install your module this way you will actually find that the module is left in it’s zip file and the OpenERP server simply reads the files from the zip as if they were an extension of the addons directory.  </p>
<h2>Manual installation</h2>
<ol>
<li>Find the addons directory
</li>
<li>Unzip the module into it.
</li>
<li>Restart the openerp server
</li>
<li>Go to Administration -&gt; Modules
</li>
<li>Select ‘Update Module List’.
</li>
<li>Find the module and schedule it for install.</li>
</ol>
<h2>Use</h2>
<p>The report can now be used programmatically using the standard report method and referencing it as sale.collection_docket.  Alternatively you’ll find that a button has appeared on the sales order screen in the OpenERP client that allows you to print the collection docket alongside the button for printing the regular sales order report.</p>
<h2>Trouble shooting</h2>
<h3>ZipImportError: bad local file header in /usr/share/pyshared/openerp-server/addons/myextra_reports.<br />
zip</h3>
<p>This normally indicates it is time to restart the server.  If you have just imported the zip file of the module and tried to install it straight away you will often get this error.</p>
<h3>ERROR:web-services:[01]: Exception: Report /usr/share/pyshared/openerp-server/addons/myextra_report/report/collection_docket.rml doesn&#8217;t exist or deleted : </h3>
<p>This is generally caused by a typo in the parser python file where the report is registered with the report_sxw.report_sxw call.</p>
<h3>ERROR:service:This service does not exist: &#8216;report.sale.collection_docket&#8217;<br />
ERROR:web-services:[07]: KeyError: &#8216;report.sale.collection_docket&#8217;</h3>
<p>The report hasn’t been registered.  Has your module been installed and loaded against the current database?  Remember that installing the module into the OpenERP server and installing it against your current database are two seperate steps.  </p>
<h3>ERROR:web-services:[01]: Exception: Start tag expected, &#8216;&lt;&#039; not found, line 1, column 1</h3>
<p>This can be caused by a bad filename registered using the xml file.  The path to the file should be in relation to the addons path.  In other words, if the full path is /usr/share/pyshared/openerp-server/addons/module/report/docket.rml, the relative filename you need is module/report/docket.rml.<br />
<a href="http://www.openerp.com/forum/topic26308.html">http://www.openerp.com/forum/topic26308.html</a></p>
<p>The alternative cause of this problem is that there is a unicode BOM indicator at the start of the file.  One of the support entries appears to indicate that that will cause the parser to dislike the document.</p>
<p><a href="https://bugs.launchpad.net/openobject-server/+bug/694409">https://bugs.launchpad.net/openobject-server/+bug/694409</a></p>
<p>[1] If you get a permissions error that&#8217;s normally because the addons<br />
   directory isn&#8217;t writeable by the user that openerp is running as.</p>
<h2>Further reading</h2>
<p>The OpenERP <a href="http://doc.openerp.com/v6.0/developer/3_11_reports/11_1_openoffice_report.html">documentation</a> regarding reports.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/colinnewell.wordpress.com/590/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/colinnewell.wordpress.com/590/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/colinnewell.wordpress.com/590/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/colinnewell.wordpress.com/590/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/colinnewell.wordpress.com/590/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/colinnewell.wordpress.com/590/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/colinnewell.wordpress.com/590/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/colinnewell.wordpress.com/590/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/colinnewell.wordpress.com/590/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/colinnewell.wordpress.com/590/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/colinnewell.wordpress.com/590/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/colinnewell.wordpress.com/590/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/colinnewell.wordpress.com/590/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/colinnewell.wordpress.com/590/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=colinnewell.wordpress.com&amp;blog=1215813&amp;post=590&amp;subd=colinnewell&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://colinnewell.wordpress.com/2012/01/04/adding-new-reports-to-openerp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1bae18aebc08108ae3c9b58f45407e0d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">colinnewell</media:title>
		</media:content>
	</item>
		<item>
		<title>Perl Advent Calendars</title>
		<link>http://colinnewell.wordpress.com/2011/12/21/perl-advent-calendars/</link>
		<comments>http://colinnewell.wordpress.com/2011/12/21/perl-advent-calendars/#comments</comments>
		<pubDate>Wed, 21 Dec 2011 13:38:35 +0000</pubDate>
		<dc:creator>colinnewell</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[perl5]]></category>

		<guid isPermaLink="false">http://colinnewell.wordpress.com/?p=574</guid>
		<description><![CDATA[It&#8217;s the time of year the Perl community does Advent calendars. I only found out about them last year, but as with everything Perl, it&#8217;s been going on for a while. Perl Advent Calendar Catalyst Advent Calendar These are some of the essential posts to check out, if you only read a couple you should [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=colinnewell.wordpress.com&amp;blog=1215813&amp;post=574&amp;subd=colinnewell&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s the time of year the Perl community does Advent calendars.  I only found out about them last year, but as with everything Perl, it&#8217;s been going on for a while.  </p>
<ul>
<li><a href="http://perladvent.org/">Perl Advent Calendar</a></li>
<li><a href="http://www.catalystframework.org/calendar">Catalyst Advent Calendar</a></li>
</ul>
<p>These are some of the essential posts to check out, if you only read a couple you should definitely have read these (they&#8217;re all good though).</p>
<ul>
<li><a href="http://perladvent.org/2011/2011-12-02.html">2nd</a> cpanm and cpanoutdated</li>
<li><a href="http://perladvent.org/2011/2011-12-04.html">4th</a> Carp::Always </li>
<li><a href="http://perladvent.org/2011/2011-12-08.html">8th</a> Perlbrew </li>
<li><a href="http://perladvent.org/2011/2011-12-10.html">10th</a> List::Util </li>
<li><a href="http://perladvent.org/2011/2011-12-17.html">17th</a> Try::Tiny </li>
<li><a href="http://perladvent.org/2011/2011-12-21.html">21st</a> utf8::all </li>
<li><a href="http://perladvent.org/2011/2011-12-23.html">23rd</a> Params::Util </li>
</ul>
<p>Update: The 23rd&#8217;s item, Params::Util is another really handy tip.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/colinnewell.wordpress.com/574/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/colinnewell.wordpress.com/574/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/colinnewell.wordpress.com/574/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/colinnewell.wordpress.com/574/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/colinnewell.wordpress.com/574/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/colinnewell.wordpress.com/574/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/colinnewell.wordpress.com/574/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/colinnewell.wordpress.com/574/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/colinnewell.wordpress.com/574/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/colinnewell.wordpress.com/574/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/colinnewell.wordpress.com/574/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/colinnewell.wordpress.com/574/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/colinnewell.wordpress.com/574/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/colinnewell.wordpress.com/574/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=colinnewell.wordpress.com&amp;blog=1215813&amp;post=574&amp;subd=colinnewell&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://colinnewell.wordpress.com/2011/12/21/perl-advent-calendars/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1bae18aebc08108ae3c9b58f45407e0d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">colinnewell</media:title>
		</media:content>
	</item>
		<item>
		<title>Taking another look at Moose</title>
		<link>http://colinnewell.wordpress.com/2011/12/09/taking-another-look-at-moose/</link>
		<comments>http://colinnewell.wordpress.com/2011/12/09/taking-another-look-at-moose/#comments</comments>
		<pubDate>Fri, 09 Dec 2011 20:06:46 +0000</pubDate>
		<dc:creator>colinnewell</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[perl5]]></category>

		<guid isPermaLink="false">http://colinnewell.wordpress.com/?p=554</guid>
		<description><![CDATA[With large libraries in the Perl world it’s easy to be overwhelmed by all their features and not realise all the things they have to offer. The Moose library is a prime example. There are two things that I noticed relatively recently, that I had initially overlooked. Moose delegation and the moose-outdated tool. Moose delegation [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=colinnewell.wordpress.com&amp;blog=1215813&amp;post=554&amp;subd=colinnewell&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>With large libraries in the Perl world it’s easy to be overwhelmed by all their features and not realise all the things they have to offer.  The <a href="http://search.cpan.org/perldoc?Moose">Moose</a> library is a prime example.  There are two things that I noticed relatively recently, that I had initially overlooked.  Moose delegation and the <code>moose-outdated</code> tool.</p>
<p>Moose delegation can be read about here in the manual, <a href="http://search.cpan.org/perldoc?Moose::Manual::Delegation">Moose::Manual::Delegation</a>.  It allows you to have a property that you pass methods straight through to.  Their example illustrates it simply,<br />
<pre class="brush: perl;">
 package Website;

  use Moose;

  has 'uri' =&gt; (
      is      =&gt; 'ro',
      isa     =&gt; 'URI',
      handles =&gt; [qw( host path )],
  );
</pre><br />
The new website object will have a host and a path method that get passed straight to the uri properties host and path methods.  This makes that fairly common pattern really simple to implement, saving time on what is often useful but tedious code to write.</p>
<p><code>moose-outdated</code> is a tool that ships with Moose to help you spot dependency problems.  It’s particularly useful after a major upgrade of Moose when you can run it to report any other modules that now require an upgrade as a result.  It’s their way of helping you avoid CPAN hell.</p>
<p><pre class="brush: bash;">
$ moose-outdated 
$ 
</pre></p>
<p>If you’re lucky you get no output like this.  Otherwise simply upgrade the modules it complains about.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/colinnewell.wordpress.com/554/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/colinnewell.wordpress.com/554/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/colinnewell.wordpress.com/554/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/colinnewell.wordpress.com/554/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/colinnewell.wordpress.com/554/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/colinnewell.wordpress.com/554/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/colinnewell.wordpress.com/554/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/colinnewell.wordpress.com/554/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/colinnewell.wordpress.com/554/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/colinnewell.wordpress.com/554/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/colinnewell.wordpress.com/554/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/colinnewell.wordpress.com/554/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/colinnewell.wordpress.com/554/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/colinnewell.wordpress.com/554/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=colinnewell.wordpress.com&amp;blog=1215813&amp;post=554&amp;subd=colinnewell&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://colinnewell.wordpress.com/2011/12/09/taking-another-look-at-moose/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1bae18aebc08108ae3c9b58f45407e0d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">colinnewell</media:title>
		</media:content>
	</item>
		<item>
		<title>MooseX::NotRequired</title>
		<link>http://colinnewell.wordpress.com/2011/12/03/moosexnotrequired/</link>
		<comments>http://colinnewell.wordpress.com/2011/12/03/moosexnotrequired/#comments</comments>
		<pubDate>Sat, 03 Dec 2011 10:58:48 +0000</pubDate>
		<dc:creator>colinnewell</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[moose]]></category>
		<category><![CDATA[perl5]]></category>

		<guid isPermaLink="false">http://colinnewell.wordpress.com/?p=524</guid>
		<description><![CDATA[I&#8217;m working on a system were we have a bunch of objects that hold data about a system. We might have a class for a Product that has a product code, a description and a price for example. We have orders, they have order number and the such like. All those nice Moose constraints mean [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=colinnewell.wordpress.com&amp;blog=1215813&amp;post=524&amp;subd=colinnewell&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m working on a system were we have a bunch of objects that hold data about a system.  We might have a class for a Product that has a product code, a description and a price for example.  We have orders, they have order number and the such like.  </p>
<p><pre class="brush: perl;">
        package SalesOrder;

        use Moose;

        has order_number =&gt; (is =&gt; 'ro', isa =&gt; 'Str', required =&gt; 1);
        has date_ordered =&gt; (is =&gt; 'ro', isa =&gt; 'DateTime', required =&gt; 1);
        has reference =&gt; (is =&gt; 'ro', isa =&gt; 'Str');
        has customer =&gt; (is =&gt; 'ro', isa =&gt; 'Customer', required =&gt; 1);

        1;
</pre></p>
<p>All those nice Moose constraints mean our objects have to get built with the correct information or there&#8217;s a blow up.  Perfect.  The problem I have, is that I want to use that same class to deal with defaults for that object.  The defaults might be things like order numbers.  In a lot of systems order numbers are generated by the system, like SO00001, then SO00002.  I figured it would be neat if I could have a $sys-&gt;get_default_order() that returns me an instance of that class that has the default data.  The problem is that it commonly won&#8217;t have all the information filled in.  For instance, I&#8217;d probably get an order_number and date_ordered pre-populated but not the customer that we require.  Attempting to construct a new sales order like this will blow up because of my constraints.  As it was designed to.</p>
<p><pre class="brush: perl;">
    my $defaults = SalesOrder-&gt;new({
        order_number =&gt; 'SO0001',
        date_ordered =&gt; DateTime-&gt;today
    }); 
</pre></p>
<p>What I wanted to do instead was,</p>
<p><pre class="brush: perl;">
    my $new_class = MooseX::NotRequired::make_optional_subclass('SalesOrder');
    my $defaults = SalesOrder-&gt;new({
        order_number =&gt; 'SO0001',
        date_ordered =&gt; DateTime-&gt;today
    }); # it now works.
    # or even these examples,
    my $default = $new_class-&gt;new(); # no blow up
    my $default2 = $new_class-&gt;new({ reference =&gt; undef }); # fine too

</pre></p>
<p>With a start from doy on #moose and some help from my colleague JJ I was able to come up with this function that makes that work.  It’s not perfect but it does a good enough job for now.  It removed any required constraints from the attributes and changes simple isa definitions like <code>'Str'</code> to <code>'Maybe[Str]'</code> to allow undef.</p>
<p><pre class="brush: perl;">
sub make_optional_subclass 
{
    my $class = shift;

    my $meta = Moose::Meta::Class-&gt;create_anon_class(superclasses =&gt; [$class], weaken =&gt; 0);
    for my $att ($meta-&gt;get_all_attributes)
    {
        my $name = $att-&gt;name;
        my $options = {};
        if($att-&gt;is_required) {
            $options-&gt;{required} = 0;
        }
        my $type = $att-&gt;{isa}; # FIXME: this is ugly
        unless (ref $type) {
            unless($type =~ /Maybe/)
            {
                my $new_type = &quot;Maybe[$type]&quot;;
                $options-&gt;{isa} = $new_type;
            }
        }

        if(scalar keys %$options)
        {
            $meta-&gt;add_attribute(&quot;+$name&quot;, $options);
        }
    }
    return $meta-&gt;name;
}
</pre></p>
<p>I am using this in practice for a system we are building at <a href="http://www.opusvl.com/">OpusVL</a>.  This code creates a new class, based on the old one, where the attributes are now optional.  It takes care to ensure the original class isn&#8217;t changed.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/colinnewell.wordpress.com/524/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/colinnewell.wordpress.com/524/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/colinnewell.wordpress.com/524/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/colinnewell.wordpress.com/524/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/colinnewell.wordpress.com/524/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/colinnewell.wordpress.com/524/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/colinnewell.wordpress.com/524/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/colinnewell.wordpress.com/524/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/colinnewell.wordpress.com/524/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/colinnewell.wordpress.com/524/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/colinnewell.wordpress.com/524/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/colinnewell.wordpress.com/524/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/colinnewell.wordpress.com/524/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/colinnewell.wordpress.com/524/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=colinnewell.wordpress.com&amp;blog=1215813&amp;post=524&amp;subd=colinnewell&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://colinnewell.wordpress.com/2011/12/03/moosexnotrequired/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1bae18aebc08108ae3c9b58f45407e0d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">colinnewell</media:title>
		</media:content>
	</item>
		<item>
		<title>Postgres sequences</title>
		<link>http://colinnewell.wordpress.com/2011/11/26/postgres-sequences/</link>
		<comments>http://colinnewell.wordpress.com/2011/11/26/postgres-sequences/#comments</comments>
		<pubDate>Sat, 26 Nov 2011 00:05:43 +0000</pubDate>
		<dc:creator>colinnewell</dc:creator>
				<category><![CDATA[Configuration]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[perl5]]></category>
		<category><![CDATA[postgres]]></category>

		<guid isPermaLink="false">http://colinnewell.wordpress.com/?p=565</guid>
		<description><![CDATA[For some reason I&#8217;m getting plagued by broken sequence numbers in Postgres at the moment. These exhibit themselves like this, despite the fact that your id field is generated by a postgres sequence. I know how it&#8217;s possible to create them, setup a database, then import data from a dump file that has setval statements [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=colinnewell.wordpress.com&amp;blog=1215813&amp;post=565&amp;subd=colinnewell&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>For some reason I&#8217;m getting plagued by broken sequence numbers in Postgres at the moment.  These exhibit themselves like this, despite the fact that your id field is generated by a postgres sequence.</p>
<p><pre class="brush: sql;">
duplicate key value violates unique constraint &quot;ir_property_pkey&quot;
DETAIL:  Key (id)=(181) already exists.
</pre></p>
<p>I know how it&#8217;s possible to create them, setup a database, then import data from a dump file that has setval statements like this, but I thought I&#8217;d learnt from that mistake and I&#8217;ve generally avoided that particular method of screwing up my database integrity.</p>
<p><pre class="brush: sql;">
SELECT pg_catalog.setval('account_account_id_seq', 203, true);
</pre></p>
<p>Anyhow, it&#8217;s become boring manually fixing them so I&#8217;ve created a quick script to spot the problems.  It probably makes some naive assumptions but it seems to be working for me and making life easier for the right now.</p>
<p><pre class="brush: perl;">
#!/usr/bin/perl
use strict;
use warnings;

my %sequences;
my %ids;
my $current_table;
my $in_copy = 0;
while(&lt;&gt;)
{
    if(/pg_catalog\.setval\('(\w+[^']*)_id_seq',\s*(\d+),/i)
    {
        $sequences{$1} = $2;
    }
    if(/COPY (\w+)\s*\(id/i) 
    {
        $in_copy = 1;
        $current_table = $1;
    }
    elsif($in_copy)
    {
        if(/\\\./)
        {
            $in_copy = 0;
        }
        else
        {
            /^(\d+)\t/;
            my $id = $1;
            $ids{$current_table} = $ids{$current_table} &amp;&amp; $ids{$current_table} &gt; $id ? $ids{$current_table} : $id;
        }
    }
}

for my $table (keys %ids)
{
    my $id = $ids{$table};
    my $sequence = $sequences{$table} || 0;
    if($sequence &lt; $id)
    {
        print &quot;The sequence for $table is too low ($sequence), it should be set to $id\n&quot;;
    }
}
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/colinnewell.wordpress.com/565/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/colinnewell.wordpress.com/565/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/colinnewell.wordpress.com/565/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/colinnewell.wordpress.com/565/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/colinnewell.wordpress.com/565/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/colinnewell.wordpress.com/565/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/colinnewell.wordpress.com/565/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/colinnewell.wordpress.com/565/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/colinnewell.wordpress.com/565/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/colinnewell.wordpress.com/565/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/colinnewell.wordpress.com/565/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/colinnewell.wordpress.com/565/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/colinnewell.wordpress.com/565/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/colinnewell.wordpress.com/565/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=colinnewell.wordpress.com&amp;blog=1215813&amp;post=565&amp;subd=colinnewell&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://colinnewell.wordpress.com/2011/11/26/postgres-sequences/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1bae18aebc08108ae3c9b58f45407e0d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">colinnewell</media:title>
		</media:content>
	</item>
		<item>
		<title>App::Cmd</title>
		<link>http://colinnewell.wordpress.com/2011/11/09/appcmd/</link>
		<comments>http://colinnewell.wordpress.com/2011/11/09/appcmd/#comments</comments>
		<pubDate>Wed, 09 Nov 2011 19:58:26 +0000</pubDate>
		<dc:creator>colinnewell</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[perl5]]></category>

		<guid isPermaLink="false">http://colinnewell.wordpress.com/?p=543</guid>
		<description><![CDATA[I have finally had a chance to use App::Cmd, a handy Perl module for constructing command line user interfaces for programs. It’s a fine module from the prolific Ricardo Signes. It is designed for the non trivial command line app which has multiple ‘tasks’. Take a look at programs like git and svn for an [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=colinnewell.wordpress.com&amp;blog=1215813&amp;post=543&amp;subd=colinnewell&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I have finally had a chance to use <a href="http://search.cpan.org/perldoc?App::Cmd">App::Cmd</a>, a handy Perl module for constructing command line user interfaces for programs.  It’s a fine module from the prolific <a href="http://rjbs.manxome.org/">Ricardo Signes</a>.</p>
<p>It is designed for the non trivial command line app which has multiple ‘tasks’.  Take a look at programs like git and svn for an example.  <a href="http://search.cpan.org/perldoc?Dist::Zilla">Dist::Zilla</a> is the most well known of application I know of that has actually been implemented using the library.  It makes it trivial for you to push those tasks into separate modules and builds the help system automatically.  It deals with all the command line parsing but you can override that if you want to.  I like it’s default behaviour though because it integrates nicely into the help system and seems generally powerful enough.</p>
<p>The only negatives I’ve found are trivial, and they’re really just things to avoid rather than something to worry about.</p>
<ul>
<li>You do want to make sure that you are not loading heavy weight modules in your commands immediately by requiring them rather than using them, otherwise the help system gets bogged down.  (This is noted in the documentation)
</li>
<li>The task names are based on the module names so your tasks have to obey the same punctuation rules as Perl module names.  </li>
</ul>
<p>There were a couple of things that made my progress with the module a little slower than they should have been.  Until I can figure out how to turn my feedback into a a contribution back to the project I am noting it here so that I don’t forget them.</p>
<ul>
<li>Filling in the abstract is necessary for the help when you run your app with no commands.  There are two methods, provide an abstract function in your command which returns the abstract, or setup your pod correctly.  The bit of the pod it’s looking for is the bit after the &#8211; in the <code>=head1 NAME section</code>.  i.e. “App::Command::task &#8211; abstract goes here”.  See the ‘ABSTRACT_FROM’ setting in <a href="http://search.cpan.org/perldoc?ExtUtils::MakeMaker#Using_Attributes_and_Parameters">ExtUtils::MakeMaker</a> for a better description of the Abstract.  I guess this exposes the fact that I haven’t been in the habit of filling in the abstract in my pod!</li>
<li>You need to look at the documentation for App::Cmd::Command in order to figure out what your commands can override and use.   This is not really made clear in the documentation and the code because you use App::Cmd::Setup and then use your own app with -command to actually inherit from it.  That means the module name appears nowhere in your own code, and should really be referenced in the documentation somewhere.</li>
<li>Using global options isn’t really touched on much in the documentation.  That would be really useful since an app commonly deals with a common theme.  I need to figure out what is possible with the module because I missed that capability when I constructed my first app.
</li>
</ul>
<p>As you can see, this is basically just niggles with the documentation.  The main reason I haven’t simply contributed a doc patch already is that I haven’t figured out the best way to express this.  Hopefully elucidating these points helps me figure out how to document them better.</p>
<p>It’s a fine module and I can definitely see myself using it a lot in the future.  </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/colinnewell.wordpress.com/543/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/colinnewell.wordpress.com/543/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/colinnewell.wordpress.com/543/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/colinnewell.wordpress.com/543/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/colinnewell.wordpress.com/543/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/colinnewell.wordpress.com/543/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/colinnewell.wordpress.com/543/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/colinnewell.wordpress.com/543/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/colinnewell.wordpress.com/543/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/colinnewell.wordpress.com/543/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/colinnewell.wordpress.com/543/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/colinnewell.wordpress.com/543/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/colinnewell.wordpress.com/543/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/colinnewell.wordpress.com/543/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=colinnewell.wordpress.com&amp;blog=1215813&amp;post=543&amp;subd=colinnewell&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://colinnewell.wordpress.com/2011/11/09/appcmd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1bae18aebc08108ae3c9b58f45407e0d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">colinnewell</media:title>
		</media:content>
	</item>
		<item>
		<title>Crypt::SSLeay and Ubuntu 11.10</title>
		<link>http://colinnewell.wordpress.com/2011/10/24/cryptssleay-and-ubuntu-11-10/</link>
		<comments>http://colinnewell.wordpress.com/2011/10/24/cryptssleay-and-ubuntu-11-10/#comments</comments>
		<pubDate>Mon, 24 Oct 2011 20:49:17 +0000</pubDate>
		<dc:creator>colinnewell</dc:creator>
				<category><![CDATA[Configuration]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[perl5]]></category>
		<category><![CDATA[ssl]]></category>

		<guid isPermaLink="false">http://colinnewell.wordpress.com/?p=536</guid>
		<description><![CDATA[If you need to install Crypt::SSLeay on Ubuntu 11.10 and it fails with errors complaining it can&#8217;t load SSLeay.so it might be RT 70565 hasn&#8217;t been patched yet. Luckily there is a patch attached to the case, nossl2.patch which can be applied to make it just work. If you&#8217;re using cpanm, run it in prompt [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=colinnewell.wordpress.com&amp;blog=1215813&amp;post=536&amp;subd=colinnewell&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If you need to install Crypt::SSLeay on Ubuntu 11.10 and it fails with errors complaining it can&#8217;t load SSLeay.so it might be <a href="https://rt.cpan.org/Public/Bug/Display.html?id=70565">RT 70565</a> hasn&#8217;t been patched yet.</p>
<p><pre class="brush: plain;">
#     Tried to use 'Net::SSL'.
#     Error:  Can't load '/home/user/.cpanm/work/1319487963.639/Crypt-SSLeay-0.58/blib/arch/auto/Crypt/SSLeay/SSLeay.so' for module Crypt::SSLeay: /home/user/.cpanm/work/1319487963.639/Crypt-SSLeay-0.58/blib/arch/auto/Crypt/SSLeay/SSLeay.so: undefined symbol: SSLv2_client_method at /home/user/perl5/perlbrew/perls/perl-5.14.1/lib/5.14.1/x86_64-linux/DynaLoader.pm line 190.
</pre></p>
<p>Luckily there is a patch attached to the <a href="https://rt.cpan.org/Public/Bug/Display.html?id=70565">case</a>, nossl2.patch which can be applied to make it just work.</p>
<p>If you&#8217;re using cpanm, run it in prompt mode and look at the errors when they occur.  That will allow you to patch the module and get it working again.</p>
<p><pre class="brush: bash;">
$ cpanm Crypt::Sleay --prompt
--&gt; Working on Crypt::SSLeay
Fetching http://search.cpan.org/CPAN/authors/id/N/NA/NANIS/Crypt-SSLeay-0.58.tar.gz ... OK
Configuring Crypt-SSLeay-0.58 ... OK
Building and testing Crypt-SSLeay-0.58 ... FAIL
Testing Crypt-SSLeay-0.58 failed.
You can s)kip, r)etry, f)orce install or l)ook ? [s] l
Entering /home/user/.cpanm/work/1319488454.2107/Crypt-SSLeay-0.58 with /bin/bash
$ patch &lt; ~/Downloads/nossl2.patch
patching file SSLeay.xs
$ make
$ make test
$ exit
You can s)kip, r)etry, f)orce install or l)ook ? [s] r
Successfully installed Crypt-SSLeay-0.58
</pre></p>
<p>The failures aren&#8217;t really any ones fault, it&#8217;s simply that things move on.  I&#8217;m assuming the module will be patched soon and this blog post will become redundant.  Until then hopefully this helps people find the RT case with the solution.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/colinnewell.wordpress.com/536/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/colinnewell.wordpress.com/536/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/colinnewell.wordpress.com/536/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/colinnewell.wordpress.com/536/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/colinnewell.wordpress.com/536/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/colinnewell.wordpress.com/536/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/colinnewell.wordpress.com/536/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/colinnewell.wordpress.com/536/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/colinnewell.wordpress.com/536/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/colinnewell.wordpress.com/536/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/colinnewell.wordpress.com/536/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/colinnewell.wordpress.com/536/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/colinnewell.wordpress.com/536/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/colinnewell.wordpress.com/536/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=colinnewell.wordpress.com&amp;blog=1215813&amp;post=536&amp;subd=colinnewell&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://colinnewell.wordpress.com/2011/10/24/cryptssleay-and-ubuntu-11-10/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1bae18aebc08108ae3c9b58f45407e0d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">colinnewell</media:title>
		</media:content>
	</item>
		<item>
		<title>Searching stackexchange</title>
		<link>http://colinnewell.wordpress.com/2011/10/17/searching-stackexchange/</link>
		<comments>http://colinnewell.wordpress.com/2011/10/17/searching-stackexchange/#comments</comments>
		<pubDate>Mon, 17 Oct 2011 21:53:44 +0000</pubDate>
		<dc:creator>colinnewell</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[stackoverflow]]></category>

		<guid isPermaLink="false">http://colinnewell.wordpress.com/?p=532</guid>
		<description><![CDATA[It&#8217;s funny but I just realised the best way to search the stackexchange sites (stackoverflow, askubuntu etc.) is to type in a question. As you type in a title, and then the actual question it tries to suggest relevant questions. It&#8217;s always been a good feature, but I finally realised it&#8217;s actually a lot better [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=colinnewell.wordpress.com&amp;blog=1215813&amp;post=532&amp;subd=colinnewell&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s funny but I just realised the best way to search the <a href="http://stackexchange.com/">stackexchange</a> sites (<a href="http://stackoverflow.com/">stackoverflow</a>, <a href="http://askubuntu.com/">askubuntu</a> etc.) is to type in a question.  As you type in a title, and then the actual question it tries to suggest relevant questions.  It&#8217;s always been a good feature, but I finally realised it&#8217;s actually a lot better than simply using the search button in the conventional way.  I assume it must be because you type in a lot more detail when you formulate a proper question so it must have a lot more keywords it can use to do a better search for you.</p>
<p>The more I use those sites, the more I realise they have a lot of intelligent ideas demonstrated.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/colinnewell.wordpress.com/532/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/colinnewell.wordpress.com/532/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/colinnewell.wordpress.com/532/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/colinnewell.wordpress.com/532/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/colinnewell.wordpress.com/532/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/colinnewell.wordpress.com/532/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/colinnewell.wordpress.com/532/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/colinnewell.wordpress.com/532/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/colinnewell.wordpress.com/532/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/colinnewell.wordpress.com/532/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/colinnewell.wordpress.com/532/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/colinnewell.wordpress.com/532/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/colinnewell.wordpress.com/532/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/colinnewell.wordpress.com/532/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=colinnewell.wordpress.com&amp;blog=1215813&amp;post=532&amp;subd=colinnewell&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://colinnewell.wordpress.com/2011/10/17/searching-stackexchange/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1bae18aebc08108ae3c9b58f45407e0d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">colinnewell</media:title>
		</media:content>
	</item>
	</channel>
</rss>
