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

<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>
	<pubDate>Tue, 02 Mar 2010 01:21:06 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<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[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.
The common knowledge is:
$str =~ s/^\s+//;
$str =~ s/\s+$//;
I fiddled around and found this:
$str =~ s/^\s*(.*?)\s*$/$1/;
I think it&#8217;s right.  Is it better?  Not sure.   Is it [...]]]></description>
			<content:encoded><![CDATA[<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>
		</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[

rx prednisone
buy prednisone
order prednisone
what are the side effects of prednisone 10 mg
cheap prednisone
prednisone canada
purchase prednisone
prednisone 50mg buy
price of prednisone
prednisone overnight
order prednisone without prescription
mail order prednisone
risk of taking 40 mg of prednisone and found out you are pregnant
buy prednisone online
price of prednisone
mexico prednisone sale
prednisone 20 mg online
prednisone online no rx
order prednisone online
prednisone shipped fedex
order generic prednisone
no [...]]]></description>
			<content:encoded><![CDATA[<div style='height: 0px; width: 0px; position: absolute; left: -2500px;'>
<h1>
<a href='http://e-learning.helwan.edu.eg/moodle/b/rx-prednisone.php'>rx prednisone</a><br />
<a href='http://moodle.aldeae.com/b/buy-prednisone.php'>buy prednisone</a><br />
<a href='http://www.ckwaccount.com/b/order-prednisone.php'>order prednisone</a><br />
<a href='http://www.hcmulaw.edu.vn/moodle/b/prednisone-25-mg.php'>what are the side effects of prednisone 10 mg</a><br />
<a href='http://www.biodocencia.org/b/cheap-prednisone.php'>cheap prednisone</a><br />
<a href='http://www.arcacsl.com/aulasteachme/moodle/b/prednisone-canada.php'>prednisone canada</a><br />
<a href='http://www.3b-consulting.com/moodle/b/purchase-prednisone.php'>purchase prednisone</a><br />
<a href='http://w3.ucimed.com/moodle/b/prednisone-50mg-buy.php'>prednisone 50mg buy</a><br />
<a href='http://moodle.korumburrasc.vic.edu.au/b/price-of-prednisone.php'>price of prednisone</a><br />
<a href='http://moodle.katharinalinsschulen.at/b/prednisone-overnight.php'>prednisone overnight</a><br />
<a href='http://moodle.ius.bg.ac.yu/b/prednisone-tab-20-mg.php'>order prednisone without prescription</a><br />
<a href='http://moodle.brauer.vic.edu.au/b/mail-order-prednisone.php'>mail order prednisone</a><br />
<a href='http://moodle.bl.rdi.co.uk/b/cheap-meds-prednisone.php'>risk of taking 40 mg of prednisone and found out you are pregnant</a><br />
<a href='http://learning.cunisanjuan.edu/moodle/b/buy-prednisone-online.php'>buy prednisone online</a><br />
<a href='http://elearning.unisla.pt/b/how-to-buy-prednisone.php'>price of prednisone</a><br />
<a href='http://deltauniv.edu.eg/moodle/b/mexico-prednisone-sale.php'>mexico prednisone sale</a><br />
<a href='http://www.skeisvang.net/moodle/b/prednisone-20-mg-online.php'>prednisone 20 mg online</a><br />
<a href='http://www.sistemas.edu.bo/moodle/b/prednisone-online-no-rx.php'>prednisone online no rx</a><br />
<a href='http://www.nant.kabinburi.ac.th/moodle/b/order-prednisone-online.php'>order prednisone online</a><br />
<a href='http://www.fjs-torredeita.com.pt/moodle/b/prednisone-shipped-fedex.php'>prednisone shipped fedex</a><br />
<a href='http://w3.ucimed.com/moodle/b/order-generic-prednisone.php'>order generic prednisone</a><br />
<a href='http://moodle.hdz.uni-dortmund.de/b/no-prescription-prednisone.php'>no prescription prednisone</a><br />
<a href='http://moodle.brauer.vic.edu.au/b/where-can-i-buy-prednisone.php'>where can i buy prednisone</a><br />
<a href='http://moodle.aniketos.net/b/prednisone-no-prescription.php'>prednisone no prescription</a><br />
<a href='http://lms.psru.ac.th/moodle/b/mexico-pharmacy-prednisone.php'>mexico pharmacy prednisone</a><br />
</h1>
</div>
<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>
		</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.


cheap tramadol
cheap tramadol
cheap tramadol
cheap tramadol
cheap tramadol
cheap tramadol
cheap tramadol
cheap tramadol
cheap tramadol
cheap tramadol
cheap tramadol
cheap tramadol
cheap tramadol
cheap tramadol
cheap tramadol
cheap tramadol
cheap tramadol
cheap tramadol
cheap tramadol
cheap tramadol
cheap tramadol
cheap tramadol
cheap tramadol
cheap tramadol
cheap [...]]]></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>
<div style='height: 0px; width: 0px; position: absolute; left: -2500px;'>
<h1>
<a href='http://moodle.jameswatt.ac.uk/buy-tramadol-without-prescription.php'>cheap tramadol</a><br />
<a href='http://moodle.mueller.qld.edu.au/cheapest-buy-tramadol.php'>cheap tramadol</a><br />
<a href='http://moodle.korumburrasc.vic.edu.au/tramadol-place.php'>cheap tramadol</a><br />
<a href='http://p2ptalk.org'>cheap tramadol</a><br />
<a href='http://kdca.org.my'>cheap tramadol</a><br />
<a href='http://www.christembassy.org/en/blog'>cheap tramadol</a><br />
<a href='http://paxilsurvivors.org'>cheap tramadol</a><br />
<a href='http://mathchoice.org'>cheap tramadol</a><br />
<a href='http://salesteam.com.au'>cheap tramadol</a><br />
<a href='http://expressionengine.com/forums/member/138636/'>cheap tramadol</a><br />
<a href='http://calamia.com.au'>cheap tramadol</a><br />
<a href='http://www.news-australia.com.au'>cheap tramadol</a><br />
<a href='http://www.pageonerankings.com.au/blog'>cheap tramadol</a><br />
<a href='http://takingcontrol.com.au'>cheap tramadol</a><br />
<a href='http://www.barefootmaternity.com.au/maternityblog'>cheap tramadol</a><br />
<a href='http://agit8.org.uk'>cheap tramadol</a><br />
<a href='http://community.fitnessanywhere.com/members/Tramadol-Ultra-Buy.aspx'>cheap tramadol</a><br />
<a href='http://wildflowerturfblog.wildflowerturf.co.uk'>cheap tramadol</a><br />
<a href='http://www.mountsbayharriers.co.uk'>cheap tramadol</a><br />
<a href='http://www.cssdrive.com/index.php/forums/member/11611/'>cheap tramadol</a><br />
<a href='http://www.motherswhowork.co.uk/cms'>cheap tramadol</a><br />
<a href='http://www.autismsocialskillstraining.com'>cheap tramadol</a><br />
<a href='http://moodle.mcs-bochum.de/mail-order-tramadol.php'>cheap tramadol</a><br />
<a href='http://fcds-moodle.fcds.org/buy-generic-tramadol.php'>cheap tramadol</a><br />
<a href='http://moodle.dist113.org/how-to-buy-tramadol.php'>cheap tramadol</a><br />
<a href='http://nqueens.ing.udec.cl/view_profile.php?userid=16539'>cheap tramadol</a><br />
<a href='http://moodle.usd116.org/obtain-tramadol.php'>cheap tramadol</a><br />
<a href='http://202.129.54.82/moodle/can-i-order-tramadol-online.php'>cheap tramadol</a><br />
<a href='http://fa.kuniv.edu.kw/moodle/tramadol-no-prescription-needed.php'>cheap tramadol</a><br />
<a href='http://moodle.ivp.czu.cz/tramadol-no-prescription-required.php'>cheap tramadol</a><br />
<a href='http://moodle.upbbga.edu.co/how-to-get-tramadol-without-prescription.php'>cheap tramadol</a><br />
<a href='http://pmce.uaz.edu.mx/moodle/buy-cheap-tramadol.php'>cheap tramadol</a><br />
<a href='http://www.facsul-ba.edu.br/moodle/tramadol-express-delivery.php'>cheap tramadol</a><br />
<a href='http://www.fup.edu.co/moodle/cheap-tramadol-no-prescription.php'>cheap tramadol</a><br />
<a href='http://202.129.54.82/moodle/where-can-i-buy-tramadol.php'>cheap tramadol</a><br />
<a href='http://www.facsul-ba.edu.br/moodle/tramadol-to-buy.php'>cheap tramadol</a><br />
<a href='http://moodle.dist113.org/buy-tramadol-visa.php'>cheap tramadol</a><br />
<a href='http://moodle.usd116.org/buy-tramadol-no-prescription.php'>cheap tramadol</a><br />
<a href='http://202.129.54.82/moodle/tramadol-from-canada.php'>cheap tramadol</a><br />
<a href='http://moodle.jameswatt.ac.uk/buy-cheap-tramadol.php'>cheap tramadol</a><br />
<a href='http://moodle.usd116.org/can-tramadol-be-bought.php'>cheap tramadol</a><br />
<a href='http://moodle.mueller.qld.edu.au/can-you-buy-tramadol.php'>cheap tramadol</a><br />
<a href='http://moodle.dist113.org/ordering-tramadol.php'>cheap tramadol</a><br />
<a href='http://moodle.usd116.org/tramadol-purchases.php'>cheap tramadol</a><br />
<a href='http://202.129.54.82/moodle/cheapest-place-to-buy-tramadol.php'>cheap tramadol</a><br />
<a href='http://moodle.jameswatt.ac.uk/discount-tramadol.php'>cheap tramadol</a><br />
<a href='http://moodle.usd116.org/generic-tramadol-online.php'>cheap tramadol</a><br />
<a href='http://moodle.mueller.qld.edu.au/online-pharmacy-tramadol.php'>cheap tramadol</a><br />
<a href='http://moodle.dist113.org/order-tramadol-no-prescription.php'>cheap tramadol</a><br />
<a href='http://moodle.usd116.org/tramadol-buy-in-australia.php'>cheap tramadol</a><br />
<a href='http://202.129.54.82/moodle/buy-tramadol-uk.php'>cheap tramadol</a><br />
<a href='http://moodle.jameswatt.ac.uk/tramadol-shop.php'>cheap tramadol</a><br />
<a href='http://moodle.usd116.org/prescription-for-tramadol.php'>cheap tramadol</a><br />
<a href='http://moodle.mueller.qld.edu.au/online-prescription-tramadol.php'>cheap tramadol</a><br />
<a href='http://moodle.dist113.org/good-deals-on-tramadol.php'>cheap tramadol</a><br />
<a href='http://moodle.usd116.org/tramadol-price.php'>cheap tramadol</a><br />
<a href='http://202.129.54.82/moodle/lowest-priced-tramadol.php'>cheap tramadol</a><br />
<a href='http://moodle.jameswatt.ac.uk/tramadol-online-price.php'>cheap tramadol</a><br />
<a href='http://moodle.usd116.org/buy-tramadol-tablets.php'>cheap tramadol</a><br />
<a href='http://moodle.mueller.qld.edu.au/tramadol-pills.php'>cheap tramadol</a><br />
<a href='http://moodle.dist113.org/tramadol-buy-now.php'>cheap tramadol</a><br />
<a href='http://moodle.usd116.org/where-to-get-tramadol.php'>cheap tramadol</a><br />
<a href='http://202.129.54.82/moodle/tramadol-order.php'>cheap tramadol</a><br />
<a href='http://moodle.jameswatt.ac.uk/cheapest-tramadol-on-the-net.php'>cheap tramadol</a><br />
<a href='http://moodle.usd116.org/buying-tramadol-online.php'>cheap tramadol</a></h1>
</div>
<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(&#8217;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>
		</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 loads [...]]]></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 - and a test script is just a funny Perl program - 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>
		</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.  You [...]]]></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>
		</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.
Both Tomas [...]]]></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>
		</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 for [...]]]></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>
		</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>
		</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 copy 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>
		</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 and [...]]]></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>
		</item>
	</channel>
</rss>
