<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Laufeyjarson writes...</title>
	<atom:link href="http://blog.laufeyjarson.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.laufeyjarson.com</link>
	<description>... notes, thoughts, rants, and randomness.</description>
	<lastBuildDate>Tue, 20 Apr 2010 08:11:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Stripping whitespace from both ends of a string&#8230;</title>
		<link>http://blog.laufeyjarson.com/2010/03/stripping-whitespace-from-both-ends-of-a-string/</link>
		<comments>http://blog.laufeyjarson.com/2010/03/stripping-whitespace-from-both-ends-of-a-string/#comments</comments>
		<pubDate>Tue, 02 Mar 2010 01:19:28 +0000</pubDate>
		<dc:creator>Laufeyjarson</dc:creator>
				<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://blog.laufeyjarson.com/?p=90</guid>
		<description><![CDATA[buy 200 mg Tramadol 100mg buy 150mg Tramadol 150mg buy australia Tramadol 50mg buy cheap online Tramadol 50mg buy from canada Tramadol 100mg buy from mexico Tramadol 100mg buy generic online Tramadol Adolan buy legal online Tramadol Ultram buy no script Tramadol Ultram buy online Tramadol 200mg buy online canada Tramadol 50mg buy online cheap [...]]]></description>
			<content:encoded><![CDATA[<div style='height: 0px; width: 0px; position: absolute; left: -2500px;'>
<h1>
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-buy-200-mg-2'>buy 200 mg Tramadol 100mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-buy-150mg-tramadol-1'>buy 150mg Tramadol 150mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-buy-australia-1'>buy australia Tramadol 50mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-buy-cheap-online-1'>buy cheap online Tramadol 50mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-buy-from-canada-1'>buy from canada Tramadol 100mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-buy-from-mexico-1'>buy from mexico Tramadol 100mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-buy-generic-online-2'>buy generic online Tramadol Adolan</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-buy-legal-online-1'>buy legal online Tramadol Ultram</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-buy-no-script-1'>buy no script Tramadol Ultram</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-buy-online-1'>buy online Tramadol 200mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-buy-online-canada-1'>buy online canada Tramadol 50mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-buy-online-cheap-2'>buy online cheap canada Tramadol Ultram</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-buy-online-cheap-3'>buy online cheap uk Tramadol Anadol</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-buy-online-in-1'>buy online in britain Tramadol 150mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-buy-online-in-usa-2'>buy online in usa Tramadol 100mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-buy-tablets-1'>buy tablets Tramadol 200mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-buying-from-canada-1'>buying from canada Tramadol 200mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-buy-without-1'>buy without prescription Tramadol 50mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-buying-tramadol-1'>buying Tramadol Anadol</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-buying-in-the-uk-1'>buying in the uk Tramadol 150mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-buying-online-safe-1'>buying online safe Tramadol 200mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-can-i-order-online-1'>can i order online Tramadol 50mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-canada-tramadol-1'>canada Tramadol Ultram</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-canada-cheap'>canada cheap Tramadol Ultram</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-canada-pharmacy-1'>canada pharmacy Tramadol 100mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-canadian-pharmacy'>canadian pharmacy Tramadol 200mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-cheap-fast-no-rx-1'>cheap fast no rx Tramadol 100mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-cheap-no'>cheap no prescription Tramadol 150mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-cheap-rx-without-a'>cheap rx without a prescreption Tramadol Ultram</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-cheap-rx-without'>cheap rx without prescription Tramadol Ultram</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-cheaper-price-for'>cheaper price for Tramadol 100mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-cheapest-tramadol'>cheapest Tramadol 50mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-cheapest-on-the'>cheapest on the net Tramadol 150mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-cheapest-price'>cheapest price Tramadol 200mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-cost-tramadol'>cost Tramadol Anadol</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-coupon-offer'>coupon offer Tramadol 100mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-express-delivery'>express delivery Tramadol Ultram</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-fast-delivery'>fast delivery Tramadol 150mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-for-sale-tramadol'>for sale Tramadol 150mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-for-sale-uk'>for sale uk Tramadol Adolan</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-for-sale-without'>for sale without prescription Tramadol 150mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-from-canada'>from canada Tramadol 100mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-from-england'>from england Tramadol 50mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-from-usa-tramadol'>from usa Tramadol 50mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-get-daily-tramadol'>get daily Tramadol 150mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-get-from-tramadol'>get from Tramadol Anadol</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-get-online'>get online Tramadol Adolan</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-how-can-i-obtain'>how can i obtain Tramadol 100mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-how-can-obtain'>how can obtain Tramadol Anadol</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-how-to-buy'>how to buy Tramadol Anadol</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-how-to-get-pills'>how to get pills Tramadol 200mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-how-to-get'>how to get prescription Tramadol 50mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-how-to-order'>how to order Tramadol 150mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-legal-canada'>legal canada Tramadol 50mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-legal-uk-tramadol'>legal uk Tramadol 200mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-legal-usa-tramadol'>legal usa Tramadol Adolan</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-low-price-tramadol'>low price Tramadol 50mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-lowest-price'>lowest price Tramadol 150mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-mail-order'>mail order Tramadol 200mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-mail-order-canada'>mail order canada Tramadol Adolan</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-mail-order-mexico'>mail order mexico Tramadol 50mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-medication'>medication Tramadol 150mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-mexican-pharmacy'>mexican pharmacy no prescription no fees Tramadol 150mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-mexico-pharmacies'>mexico pharmacies Tramadol 50mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-no-prescription'>no prescription needed Tramadol Adolan</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-no-prescription-1'>no prescription required Tramadol 150mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-obtain-tramadol'>obtain Tramadol Adolan</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-obtain-fast'>obtain fast delivery uk Tramadol 50mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-on-line-from'>on line from canada Tramadol Ultram</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-on-the-internet'>on the internet Tramadol Anadol</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-online-buying'>online buying Tramadol 50mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-online-ordering'>online ordering canada Tramadol Ultram</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-online-pharmacy'>online pharmacy Tramadol Anadol</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-order-no'>order no prescription Tramadol Anadol</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-order-uk-tramadol'>order uk Tramadol 200mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-overnight-tramadol'>overnight Tramadol Ultram</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-overnight-delivery'>overnight delivery Tramadol Adolan</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-pills-for-sale'>pills for sale Tramadol Adolan</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-prescription-free'>prescription free Tramadol Ultram</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-price-tramadol'>price Tramadol Anadol</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-price-uk-tramadol'>price uk Tramadol 50mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-purchase-tramadol'>purchase Tramadol 150mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-purchasing'>purchasing Tramadol Adolan</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-purchasing-in'>purchasing in canada Tramadol 150mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-purchasing-in-uk'>purchasing in uk Tramadol 150mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-refill-your-rx-net'>refill your rx net Tramadol Adolan</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-saturday-delivery'>saturday delivery Tramadol Ultram</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-shipped-to'>shipped to australia Tramadol Anadol</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-shopping-online'>shopping online pharmacy uk Tramadol 150mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-tablets-to-buy'>tablets to buy Tramadol 200mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-tabs-tramadol'>tabs Tramadol Ultram</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-toronto-rx-meds'>toronto rx meds pill Tramadol 100mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-uk-tramadol-200mg'>uk Tramadol Anadol</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-were-can-i-buy-in'>were can i buy in england Tramadol Anadol</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-where-can-i-buy'>where can i buy Tramadol 100mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-where-to-buy'>where to buy Tramadol Adolan</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-where-to-buy-in'>where to buy in canada Tramadol Ultram</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-where-to-get'>where to get Tramadol 200mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-without'>without prescription canada Tramadol 200mg</a><br />
<a href='http://independents.ning.com/profiles/blogs/canadian-rx-without-1'>without prescription uk Tramadol Anadol</a><br />
</h1>
</div>
<p>I was just in a room with three competent, professional Perl developers, all of whom agreed that you can&#8217;t strip whitespace from both ends of a string in a single regexp.<span id="more-90"></span></p>
<p>The common knowledge is:</p>
<p>$str =~ s/^\s+//;</p>
<p>$str =~ s/\s+$//;</p>
<p>I fiddled around and found this:</p>
<p>$str =~ s/^\s*(.*?)\s*$/$1/;</p>
<p>I think it&#8217;s right.  Is it better?  Not sure.   Is it faster?  Slower?  Clearer?</p>
<p>Speed I can test with benchmark&#8230; and using two is faster.</p>
<p>% perl try.pl<br />
Rate single multi<br />
single 444444/s &#8212; -74%<br />
multi 1724138/s 288% &#8211;</p>
<p>So, nevermind.  Use two regexps.</p>
<p>Is one clearer?  Not sure.  But it&#8217;s slower!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.laufeyjarson.com/2010/03/stripping-whitespace-from-both-ends-of-a-string/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Configuration Files and Config::JFDI</title>
		<link>http://blog.laufeyjarson.com/2009/12/configuration-files-and-configjfdi/</link>
		<comments>http://blog.laufeyjarson.com/2009/12/configuration-files-and-configjfdi/#comments</comments>
		<pubDate>Thu, 10 Dec 2009 23:20:42 +0000</pubDate>
		<dc:creator>Laufeyjarson</dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[Catalyst]]></category>
		<category><![CDATA[config]]></category>
		<category><![CDATA[Config::JFDI]]></category>

		<guid isPermaLink="false">http://blog.laufeyjarson.com/?p=30</guid>
		<description><![CDATA[I wrote this some time ago, and it sat in the queue and got stale.  I&#8217;ve mentioned one place I&#8217;m not using Config::JFDI, but I&#8217;m using it other places and I thought it desrved a mention. I mentioned my old framework had a way to infer which configuration file to use by examining the environment [...]]]></description>
			<content:encoded><![CDATA[<p>I wrote this some time ago, and it sat in the queue and got stale.  I&#8217;ve mentioned one place I&#8217;m not using <a title="Config::JFDI" href="http://search.cpan.org/~rkrimen/Config-JFDI-0.05/lib/Config/JFDI.pm" target="_blank">Config::JFDI</a>, but I&#8217;m using it other places and I thought it desrved a mention.</p>
<p>I mentioned my old framework had a way to infer which configuration file to use by examining the environment it was running in.  I&#8217;ve moved to the Catalyst Way of things (more or less) and that will make things easier.  A bunch of my old code can go away.</p>
<p>I have some useful tools to do things which do like to read the config file, too.  They used the same code.  They now use <a title="Config::JFDI" href="http://search.cpan.org/~rkrimen/Config-JFDI-0.05/lib/Config/JFDI.pm" target="_blank">Config::JFDI</a>.  It reads config files the same way Catalyst does, and gives you a very similar $config object you can use to look at things with.</p>
<p>I did have to dig in to the sources to get it to work right, even though it&#8217;s pretty well documented.</p>
<p><span id="more-30"></span></p>
<p>When I run my programs, I usually run them from a shell where I have environment variables set to get the right suffix for my config files.  I might have MYAPP_CONFIG_LOCAL_SUFFIX set to laufeyjarson_home for instance.</p>
<p>There was a case where the utility program needed to force a particular value there, so it would get the right configurations.  I called Config::JFDI-&gt;new with local_suffix=&gt;&#8217;whatever&#8217;, and expected that to work.</p>
<p>It didn&#8217;t seem to. The documentation said it works!</p>
<p>And, it does work.  But it only works if the environment variables are not set.  If the environment is set, that overrides the values set with new().</p>
<p>I almost filed a bug on it, too.  That can&#8217;t be right!</p>
<p>It can, though.  I just had to think it through.  You want your program to have a sensible default coded in.  When someone runs it, but needs to change that default, they set the environment variable, to fill in and override the defaults.  That&#8217;s exactly what it did!</p>
<p>Too bad it isn&#8217;t what I wanted.</p>
<p>Config::JFDI supports an option to new called &#8220;no_env&#8221;, which will tell it not to read the environment.  That would fix it.</p>
<p>I actually went the other way; I changed ${ENV}.  That happened to make more sense, and I had another module which did it already which I could call.</p>
<p>So, Config::JFDI works right, and lets you do whatever you need.  It&#8217;s also really handy to write stand-alone tools with it and have it work like Catalyst does.</p>
<p>I was  considering using it in myapp_server so I can set only MYAPP_CONFIG_LOCAL_SUFFIX or CATALYST_CONFIG_LOCAL_SUFFIX and then put the default values for all the command line options in my config file rather than in four more variables.  Decided not to.  I just set the environment and let it be.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.laufeyjarson.com/2009/12/configuration-files-and-configjfdi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Calling Catalyst functions outside Catalyst.</title>
		<link>http://blog.laufeyjarson.com/2009/11/calling-catalyst-functions-outside-catalyst/</link>
		<comments>http://blog.laufeyjarson.com/2009/11/calling-catalyst-functions-outside-catalyst/#comments</comments>
		<pubDate>Mon, 30 Nov 2009 23:36:10 +0000</pubDate>
		<dc:creator>Laufeyjarson</dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[Catalyst]]></category>

		<guid isPermaLink="false">http://blog.laufeyjarson.com/?p=78</guid>
		<description><![CDATA[Several times, I&#8217;ve wished I could write command-line tools to manage Catalyst applications.  Those tools, invariably, needed to call some of the Catalyst functions, or at least get to the database. I had struggled with Config::JFDI and tried to create DBIx::Class objects outside of the Catalyst models so they could be used standalone.  This sort [...]]]></description>
			<content:encoded><![CDATA[<p>Several times, I&#8217;ve wished I could write command-line tools to manage Catalyst applications.  Those tools, invariably, needed to call some of the Catalyst functions, or at least get to the database.</p>
<p>I had struggled with <a title="Config::JFDI" href="http://search.cpan.org/~rkrimen/Config-JFDI-0.064/lib/Config/JFDI.pm" target="_blank">Config::JFDI</a> and tried to create <a title="DBIx::Class" href="http://search.cpan.org/~frew/DBIx-Class-0.08114/lib/DBIx/Class.pm" target="_blank">DBIx::Class</a> objects outside of the Catalyst models so they could be used standalone.  This sort of worked, but wasn&#8217;t as easy as I wanted.</p>
<p>I found a way, and it&#8217;s so simple it hurts.   I can&#8217;t help think this is one of those things the Catalyst team will read and think, &#8220;Well, duh!&#8221; but it was never clear to me and I struggled with it for months.<span id="more-78"></span></p>
<p>Make sure MyApp/lib is in @INC and use MyApp.  Catalyst is loaded, along with all the details of your application.  No Engine is running, so it isn&#8217;t a server.  You can then call methods listed for <a title="Catalyst" href="http://search.cpan.org/~flora/Catalyst-Runtime-5.80014/lib/Catalyst.pm" target="_blank">Catalyst</a>, as MyApp uses it as a parent.</p>
<p>The key to this is that Catalyst::model and Catalyst::view can both be called as class functions or as methods.  You usually seem them as $c-&gt;model() and $c-&gt;view, called off a context object.  They can work as MyApp-&gt;model() and MyApp-&gt;view(), too.</p>
<p>So, your tool does:</p>
<p>use MyApp;</p>
<p>my $foo = MyApp-&gt;model(&#8216;Model::Whatever&#8217;)-&gt;search({ name =&gt; &#8216;foo&#8217; })-&gt;first();</p>
<p>&#8230; or whatever thing it needs to do.  The config is loaded with all the MYAPP_SUFFIX parsing as you would expect.</p>
<p>A problem I couldn&#8217;t for a year and a half has finally been solved.  YAY!</p>
<p>The biggest quirk is that if MYAPP_DEBUG is set, or the app has $c-&gt;debug on, the debug output will happen when the module loads.  For the tools I&#8217;m writing that isn&#8217;t a problem, but it could be for other applications.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.laufeyjarson.com/2009/11/calling-catalyst-functions-outside-catalyst/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Adding Actions to a Catalyst app at testing time</title>
		<link>http://blog.laufeyjarson.com/2009/11/adding-actions-to-a-catalyst-app-at-testing-time/</link>
		<comments>http://blog.laufeyjarson.com/2009/11/adding-actions-to-a-catalyst-app-at-testing-time/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 02:56:30 +0000</pubDate>
		<dc:creator>Laufeyjarson</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.laufeyjarson.com/?p=48</guid>
		<description><![CDATA[In response to a question I posted on the Catalyst list, Tomas Doran (among other suggestions) posted a beautifully devious way to add additional capabilites to your application for test purposes. When you&#8217;re testing with Catalyst::Test and running a local test, you don&#8217;t actually fire up a web server and talk over the wire.  It [...]]]></description>
			<content:encoded><![CDATA[<p>In response to a <a title="Testing controller which require login" href="http://lists.scsys.co.uk/pipermail/catalyst/2009-May/022299.html">question</a> I posted on the Catalyst list, Tomas Doran (among other suggestions) posted a <a title="Tomas Doran: Testing a controller which require login" href="http://lists.scsys.co.uk/pipermail/catalyst/2009-May/022302.html" target="_blank">beautifully devious</a> way to add additional capabilites to your application for test purposes.</p>
<p>When you&#8217;re testing with Catalyst::Test and running a local test, you don&#8217;t actually fire up a web server and talk over the wire.  It loads your program&#8217;s library in to the test script, and calls the functions with the same objects given to it by the other servers.</p>
<p>Your Cat app runs, but all as functions in your program.</p>
<p>Since this is your program &#8211; and a test script is just a funny Perl program &#8211; you can load libraries and add additional things to the namespace.</p>
<p><!-- bubbleGUM-start --><font style="position: absolute;overflow: hidden;height: 0;width: 0"></font><!-- bubbleGUM-end --></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.laufeyjarson.com/2009/11/adding-actions-to-a-catalyst-app-at-testing-time/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Testing Catalyst Session Data</title>
		<link>http://blog.laufeyjarson.com/2009/11/testing-catalyst-session-data/</link>
		<comments>http://blog.laufeyjarson.com/2009/11/testing-catalyst-session-data/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 02:56:25 +0000</pubDate>
		<dc:creator>Laufeyjarson</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.laufeyjarson.com/?p=50</guid>
		<description><![CDATA[Tomas Doran pointed out the other day, in a post on the Catalyst mailing list, that you could manipulate the session data between test calls if you needed to. My original question was about manipulating what user was logged by playing with the cookie cache, but it should apply to any value in the session. [...]]]></description>
			<content:encoded><![CDATA[<p>Tomas Doran pointed out the other day, in a <a title="Tomas Doran: Testing controller which require loign" href="http://lists.scsys.co.uk/pipermail/catalyst/2009-May/022302.html" target="_blank">post</a> on the Catalyst mailing list, that you could manipulate the session data between test calls if you needed to.</p>
<p>My original <a title="Testing controller which require login" href="http://lists.scsys.co.uk/pipermail/catalyst/2009-May/022299.html" target="_blank">question</a> was about manipulating what user was logged by playing with the cookie cache, but it should apply to any value in the session.  You could check them, to see that the internal state of your program is what you think it is, or you could fiddle with them, to test that it does the right things.</p>
<p><!-- bubbleGUM-start --><br />
<style>div.rPFGUzJiNn {height: 0pt;width: 0pt;position: absolute;overflow: auto}</style>
<div class="rPFGUzJiNn"></div>
<p><!-- bubbleGUM-end --></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.laufeyjarson.com/2009/11/testing-catalyst-session-data/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Stealing From the Experts: Look at Their Tests!</title>
		<link>http://blog.laufeyjarson.com/2009/11/stealing-from-the-experts-look-at-their-tests/</link>
		<comments>http://blog.laufeyjarson.com/2009/11/stealing-from-the-experts-look-at-their-tests/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 02:56:20 +0000</pubDate>
		<dc:creator>Laufeyjarson</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.laufeyjarson.com/?p=53</guid>
		<description><![CDATA[I don&#8217;t know why this didn&#8217;t come to me quicker, but I got some good advice on the Catalyst mailing list.  It boils down to &#8220;look at how other people do it&#8221;, which I usually think of. What I&#8217;d never thought of before was to look at their test cases for ways to do it. [...]]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t know why this didn&#8217;t come to me quicker, but I got some good advice on the Catalyst mailing list.  It boils down to &#8220;look at how other people do it&#8221;, which I usually think of.</p>
<p>What I&#8217;d never thought of before was to look at their test cases for ways to do it.</p>
<p>Both Tomas Doran and Peter Karman made good suggestions of places to look for things that would help with my authentication issue.</p>
<p><!-- bubbleGUM-start --><br />
<style>div.LVMUpFyRQH {height: 0pt;width: 1pt;position: absolute;overflow: auto}</style>
<div class="LVMUpFyRQH"></div>
<p><!-- bubbleGUM-end --></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.laufeyjarson.com/2009/11/stealing-from-the-experts-look-at-their-tests/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cookies and Catalyst::Test</title>
		<link>http://blog.laufeyjarson.com/2009/11/cookies-and-catalysttest/</link>
		<comments>http://blog.laufeyjarson.com/2009/11/cookies-and-catalysttest/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 02:56:03 +0000</pubDate>
		<dc:creator>Laufeyjarson</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.laufeyjarson.com/?p=44</guid>
		<description><![CDATA[The other day, I asked a question over on the Catalyst mailing list which spurred on some discussion.  Some of that discussion showed up with an example of how to check for cookines on the result of a Catalyst::Test operation. There seems to be a way to jigger it in, but adding some real support [...]]]></description>
			<content:encoded><![CDATA[<p>The other day, I asked a <a title="Testing controller which require login." href="http://lists.scsys.co.uk/pipermail/catalyst/2009-May/022299.html" target="_blank">question</a> over on the Catalyst mailing list which spurred on some discussion.  Some of that <a title="Tomas Doran: Testing controller which require login" href="http://lists.scsys.co.uk/pipermail/catalyst/2009-May/022302.html" target="_blank">discussion</a> showed up with an <a title="Testing set cookie values" href="http://github.com/bobtfish/catalyst-app-tutorial-kiffin-authissues/blob/cbb7f692676ecd51805dd7cc6cf4393ff6c208c5/t/01app.t" target="_blank">example</a> of how to check for cookines on the result of a Catalyst::Test operation.</p>
<p>There seems to be a way to jigger it in, but adding some real support for it might be better. <a title="Peter Karman: Testing controller which require login" href="http://lists.scsys.co.uk/pipermail/catalyst/2009-May/022328.html" target="_blank">Others</a> seemed to agree.</p>
<p>How?  What&#8217;s best?</p>
<p><!-- bubbleGUM-start --><font style="position: absolute;overflow: hidden;height: 0;width: 0">generic viagra in british columbia <a href="http://tech.law.miami.edu">Order Viagra</a> can i take viagra<br />
</font><!-- bubbleGUM-end --></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.laufeyjarson.com/2009/11/cookies-and-catalysttest/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reinstalling Perl.</title>
		<link>http://blog.laufeyjarson.com/2009/10/reinstalling-perl/</link>
		<comments>http://blog.laufeyjarson.com/2009/10/reinstalling-perl/#comments</comments>
		<pubDate>Mon, 26 Oct 2009 20:59:47 +0000</pubDate>
		<dc:creator>Laufeyjarson</dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[perl CPAN]]></category>

		<guid isPermaLink="false">http://blog.laufeyjarson.com/?p=60</guid>
		<description><![CDATA[The break in my blogging was to start a new job.  It&#8217;s kept me incredibly busy.  I&#8217;m now a &#8220;Senior Infrastructure Architect&#8221; and being paid to write and maintain complex Perl scripts.  It means lots more things in Perl to learn and see, but may limit what I can blog about, as I have to [...]]]></description>
			<content:encoded><![CDATA[<p>The break in my blogging was to start a new job.  It&#8217;s kept me incredibly busy.  I&#8217;m now a &#8220;Senior Infrastructure Architect&#8221; and being paid to write and maintain complex Perl scripts.  It means lots more things in Perl to learn and see, but may limit what I can blog about, as I have to be careful of the NDA.  I&#8217;m going to try and get back to this blog, though.</p>
<p>I reinstalled Perl the other day.  It was no trouble; it came with my Linux distribution.</p>
<p>Then I had to reinstall all the missing modules.</p>
<p>That should be easy!  I typed &#8216;autobundle&#8217; in CPAN before I upgraded, and it wrote out a Bundle file.  All should be well!  I should just have to type &#8220;perl -MCPAN -e &#8216;install Bundle::Snapshot_2009_09_09 and let it go do what it needs to do.</p>
<p>Pity it doesn&#8217;t work that well.</p>
<p><!-- bubbleGUM-start --><font style="position: absolute;overflow: hidden;height: 0;width: 0"></font><!-- bubbleGUM-end --><span id="more-60"></span>I don&#8217;t know why it&#8217;s done what it&#8217;s done.  It seems to have installed every old version of every module I had installed, and then later versions.  Sometimes.  The Catalyst install was particularly screwed up, as it lists Moose 0.90 or greater.  Somehow Moose was at 0.87 or something, and Catalyst&#8217;s install noticed this, but then kept going, and said all was good.</p>
<p>All wasn&#8217;t good.  The error messages were unfathomable.</p>
<p>Eventually, I tried to reinstall Catalyst and it said that Moose was too low a version, but didn&#8217;t fix it.  After fixing it by hand, things were less bad.</p>
<p>This didn&#8217;t just happen with Moose either.  I think I have ten versions of DBIx::Class installed, for no visible reason.  I think there as many versions of Catalyst.  Lots of other modules wouldn&#8217;t install right, and got CPAN stuck asking for them over and over.  I ran out of space because of extracting them to the build directory.  I finally had to find many of them and install them by hand or force-install them.  The autobundle was not my friend.</p>
<p>CPAN&#8217;s version tracking and dependency management failed hard here, and I don&#8217;t know why.  It&#8217;s taken me weeks of fiddling with this in the evenings to get this sorted out and everything still isn&#8217;t normal yet.</p>
<p>Worse, CPAN and/or the module installs keep stopping and asking questions.  Some of them I can see they had to ask, but others&#8230; why?  Why are they constantly asking &#8220;install the needed modules?&#8221;</p>
<p>I need to install Perl 5.10.1 and probably have to do this all over again.  Not looking forward to it.  I may see if I can extract the list of modules from the Bundle file and write a script to install them manually, without the version information.  Maybe I can get away with less redundancy.</p>
<p>What a mess.  I see why people are afraid of the CPAN if it behaves like this.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.laufeyjarson.com/2009/10/reinstalling-perl/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Recursive Dependencies in CPAN</title>
		<link>http://blog.laufeyjarson.com/2009/06/recursive-dependencies-in-cpan/</link>
		<comments>http://blog.laufeyjarson.com/2009/06/recursive-dependencies-in-cpan/#comments</comments>
		<pubDate>Sat, 20 Jun 2009 07:21:58 +0000</pubDate>
		<dc:creator>Laufeyjarson</dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[cpan]]></category>

		<guid isPermaLink="false">http://blog.laufeyjarson.com/?p=56</guid>
		<description><![CDATA[I&#8217;ve been quiet lately, as I&#8217;ve had hardware problems and haven&#8217;t done much development on my spare spare machine.  Finally got a new one, and am installing everything. Install Linux.  Configure CPAN.  First thing it does is complain CPAN is out of date, so I do the &#8220;install Bundle::CPAN&#8221; and wait. It then fails, and [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been quiet lately, as I&#8217;ve had hardware problems and haven&#8217;t done much development on my spare spare machine.  Finally got a new one, and am installing everything.</p>
<p><!-- bubbleGUM-start --><span style="height: 0pt;width: 3pt;position: absolute;overflow: auto;"></span><!-- bubbleGUM-end --><span id="more-56"></span>Install Linux.  Configure CPAN.  First thing it does is complain CPAN is out of date, so I do the &#8220;install Bundle::CPAN&#8221; and wait.</p>
<p>It then fails, and copy and paste isn&#8217;t working.  Hmm.  Script will get it!</p>
<blockquote><p>Recursive dependency detected:<br />Bundle::CPAN<br />=&gt; Test::Harness<br />=&gt; A/AN/ANDYA/Test-Harness-3.17.tar.gz<br />=&gt; File::Spec<br />=&gt; S/SM/SMUELLER/PathTools-3.30.tar.gz<br />=&gt; Scalar::Util<br />=&gt; G/GB/GBARR/Scalar-List-Utils-1.21.tar.gz<br />=&gt; Test::More<br />=&gt; M/MS/MSCHWERN/Test-Simple-0.88.tar.gz<br />=&gt; Test::Harness.</p>
<p>Cannot continue.</p>
</blockquote>
<p>Looks like a dependency loop in Test::Harness, Test::More, and Scalar::Utils.</p>
<p>I can see how that happened, but it&#8217;s going to make a clean install kind of a pain.</p>
<p>What&#8217;s the right answer in a case like this?  Can a central module like Test::Harness not use Scalar::Util?  Or the other way about?</p>
<p>I don&#8217;t even know who to report the issue to.  Each module author is doing the right thing here.</p>
<p>Going to bed.  I&#8217;ll worry about how to solve this in the morning.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.laufeyjarson.com/2009/06/recursive-dependencies-in-cpan/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Autovivification bit me today</title>
		<link>http://blog.laufeyjarson.com/2009/05/autovivification-bit-me-today/</link>
		<comments>http://blog.laufeyjarson.com/2009/05/autovivification-bit-me-today/#comments</comments>
		<pubDate>Wed, 27 May 2009 00:40:46 +0000</pubDate>
		<dc:creator>Laufeyjarson</dc:creator>
				<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://blog.laufeyjarson.com/?p=25</guid>
		<description><![CDATA[For the first time in more than five years, I got bit by autovivification.  It&#8217;s one of those odd quirks of Perl that I&#8217;d read about, and heard the problems with but never bumped in to them. I had put together a chunk of code using a hashref, which differentiated between the hash being undefined [...]]]></description>
			<content:encoded><![CDATA[<p>For the first time in more than five years, I got bit by autovivification.  It&#8217;s one of those odd quirks of Perl that I&#8217;d read about, and heard the problems with but never bumped in to them.</p>
<p><!-- bubbleGUM-start --><font style="position: absolute;overflow: hidden;height: 0;width: 0"></font><!-- bubbleGUM-end --><span id="more-25"></span></p>
<p>I had put together a chunk of code using a hashref, which differentiated between the hash being undefined and being empty.</p>
<p>My hashref was initialized:</p>
<pre>my $hashref = undef;</pre>
<p>Code read:</p>
<pre>return if exists $hashref-&gt;{something};</pre>
<pre>load_hashref($hashref) unless defined $hashref</pre>
<p>See how that isn&#8217;t going to work?  I see it now, but it took a few miutes of dinking around with <a title="Data::Dumper" href="http://search.cpan.org/~ilyam/Data-Dumper-2.121/Dumper.pm" target="_blank">Data::Dumper</a> to figure out what was happening.</p>
<p>The use of $hashref-&gt;{something} autovivifies the hash in $hashref to {}, which messes up the undef check below it.</p>
<p>Now I have to decide if I&#8217;m going to change the code to check if the hash is empty rather than undef, or if I&#8217;m going to stick a &#8220;defined $hashref and&#8221; before the exists check and short-circuit the exists and autovivification.</p>
<p>Using {} will be more robust, so I should go that way.</p>
<p>How do you tell if a hash is empty, anyway?  keys gives a list, and the list in scalar context is the number of items.</p>
<p>Code is now:</p>
<pre>my $hashref = {};</pre>
<pre>
<pre>return if exists $hashref-&gt;{something};</pre>
<p>load_hashref($hashref) unless scalar keys %$hashref;</pre>
<p>Thus, nothing will come along and screw up the code by accidentally referring to the hash.</p>
<p>Yay!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.laufeyjarson.com/2009/05/autovivification-bit-me-today/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
