<?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>thoughts of a doug &#187; Perl</title>
	<atom:link href="http://somethingdoug.com/thoughts/tag/perl/feed/" rel="self" type="application/rss+xml" />
	<link>http://somethingdoug.com/thoughts</link>
	<description></description>
	<lastBuildDate>Mon, 26 Apr 2010 05:29:11 +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>CPAN Bug Tracking</title>
		<link>http://somethingdoug.com/thoughts/2010/02/09/cpan-bug-tracking/</link>
		<comments>http://somethingdoug.com/thoughts/2010/02/09/cpan-bug-tracking/#comments</comments>
		<pubDate>Tue, 09 Feb 2010 17:18:38 +0000</pubDate>
		<dc:creator>Douglas Wilson</dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[cpan]]></category>
		<category><![CDATA[Perl5]]></category>

		<guid isPermaLink="false">http://somethingdoug.com/thoughts/?p=166</guid>
		<description><![CDATA[Recently I have been adding my own bug list and todo list to the RT queue of my CPAN modules to track them and help me remember over a longer period of time. I also figure that if they are visible to everyone, perhaps someone may help fix or add a feature.]]></description>
			<content:encoded><![CDATA[<p>Recently I have been adding my own bug list and todo list to the RT queue of my CPAN modules to track them and help me remember over a longer period of time. I also figure that if they are visible to everyone, perhaps someone may help fix or add a feature.</p>
]]></content:encoded>
			<wfw:commentRss>http://somethingdoug.com/thoughts/2010/02/09/cpan-bug-tracking/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Test::Override::UserAgent</title>
		<link>http://somethingdoug.com/thoughts/2010/01/31/test-override-useragent/</link>
		<comments>http://somethingdoug.com/thoughts/2010/01/31/test-override-useragent/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 02:15:01 +0000</pubDate>
		<dc:creator>Douglas Wilson</dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[cpan]]></category>
		<category><![CDATA[Perl5]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://somethingdoug.com/thoughts/?p=153</guid>
		<description><![CDATA[I have just uploaded a new module to the CPAN: Test::Override::UserAgent. This is geared toward developers that use LWP::UserAgent in their modules and want to easily test their code without having a live Internet connection or starting up a test server to make requests against. Just about every single module I have on the CPAN [...]]]></description>
			<content:encoded><![CDATA[<p>I have just uploaded a new module to the CPAN: <a href="http://search.cpan.org/dist/Test-Override-UserAgent/">Test::Override::UserAgent</a>. This is geared toward developers that use <a href="http://search.cpan.org/perldoc?LWP::UserAgent">LWP::UserAgent</a> in their modules and want to easily test their code without having a live Internet connection or starting up a test server to make requests against. Just about every single module I have on the CPAN uses LWP::UserAgent and makes requests against live servers (usually they are doing web scraping). Before I was using <a href="http://search.cpan.org/perldoc?Test::MockObject">Test::MockObject</a>, but that was tedious at best.</p>
<p>The goal of Test::Override::UserAgent is to be able to write response overrides easily. The module allows for the author to create a class consisting of only definitions for overrides so the override definitions do not have to be repeated in each test file. An example override class would look like:</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #000066;">package</span> t<span style="color: #339933;">::</span><span style="color: #006600;">CustomUA</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">use</span> <span style="color: #cc66cc;">5.008</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">use</span> Test<span style="color: #339933;">::</span><span style="color: #006600;">Override</span><span style="color: #339933;">::</span><span style="color: #006600;">UserAgent</span> <span style="color: #b1b100;">for</span> <span style="color: #339933;">=&gt;</span> <span style="color: #ff0000;">'configuration'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Disable live requests (the default, anyhow)</span>
allow_live<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
override_request
  host <span style="color: #339933;">=&gt;</span> <span style="color: #ff0000;">'localhost'</span><span style="color: #339933;">,</span>
  path <span style="color: #339933;">=&gt;</span> <span style="color: #ff0000;">'/test'</span><span style="color: #339933;">,</span>
  <span style="color: #000000; font-weight: bold;">sub</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066;">return</span> <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">200</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#91;</span><span style="color: #ff0000;">'content-type'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #ff0000;">'text/plain'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#91;</span><span style="color: #ff0000;">'Test response'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span></pre></div></div>

<p>This will cause requests that have a host of <code>localhost</code> and a path of <code>/test</code> to get a response back of <code>text/plain</code> with the <code>Test response</code> body. This configuration can then be used in a test file:</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!perl -T</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">use</span> <span style="color: #cc66cc;">5.008</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">use</span> Test<span style="color: #339933;">::</span><span style="color: #006600;">More</span> tests <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">use</span> t<span style="color: #339933;">::</span><span style="color: #006600;">CustomUA</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">use</span> My<span style="color: #339933;">::</span><span style="color: #006600;">Module</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;"># Your awesome module to test</span>
&nbsp;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$object</span> <span style="color: #339933;">=</span> new_ok <span style="color: #ff0000;">'My::Module'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Your module has a way to set the user agent it uses</span>
t<span style="color: #339933;">::</span><span style="color: #006600;">CustomUA</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">configuration</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">install_in_user_agent</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$object</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">user_agent</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Perhaps your module has no way to set the user agent</span>
<span style="color: #666666; font-style: italic;"># or there is something down stream that uses a user agent.</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$scope</span> <span style="color: #339933;">=</span> t<span style="color: #339933;">::</span><span style="color: #006600;">CustomUA</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">configuration</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">install_in_scope</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Do tests that make requests by LWP::UserAgent</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># End the scope override</span>
<span style="color: #000066;">undef</span> <span style="color: #0000ff;">$scope</span><span style="color: #339933;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://somethingdoug.com/thoughts/2010/01/31/test-override-useragent/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WWW::USF::Directory Published</title>
		<link>http://somethingdoug.com/thoughts/2010/01/25/www-usf-directory-published/</link>
		<comments>http://somethingdoug.com/thoughts/2010/01/25/www-usf-directory-published/#comments</comments>
		<pubDate>Tue, 26 Jan 2010 01:57:46 +0000</pubDate>
		<dc:creator>Douglas Wilson</dc:creator>
				<category><![CDATA[How To]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[Perl5]]></category>
		<category><![CDATA[usf]]></category>

		<guid isPermaLink="false">http://somethingdoug.com/thoughts/?p=148</guid>
		<description><![CDATA[I have published my interface to the University of South Florida online directory to the CPAN as WWW::USF::Directory. This is a start to my USF-oriented modules to go up on the CPAN for public use. This module allows you to interact with the USF online directory. It can be used to make a simple directory [...]]]></description>
			<content:encoded><![CDATA[<p>I have published my interface to the <a href="http://directory.acomp.usf.edu/">University of South Florida online directory</a> to the CPAN as <a href="http://search.cpan.org/perldoc?WWW::USF::Directory">WWW::USF::Directory</a>. This is a start to my USF-oriented modules to go up on the CPAN for public use. This module allows you to interact with the USF online directory. It can be used to make a simple directory repeater like so:</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/usr/bin/perl</span>
&nbsp;
<span style="color: #000066;">package</span> Directory<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">use</span> <span style="color: #cc66cc;">5.008</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">use</span> strict<span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">use</span> warnings <span style="color: #ff0000;">'all'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">use</span> base <span style="color: #ff0000;">'CGI::Application'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">use</span> JSON <span style="color: #cc66cc;">2.00</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;"># The API was changed</span>
<span style="color: #000000; font-weight: bold;">use</span> Try<span style="color: #339933;">::</span><span style="color: #006600;">Tiny</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">use</span> WWW<span style="color: #339933;">::</span><span style="color: #006600;">USF</span><span style="color: #339933;">::</span><span style="color: #006600;">Directory</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">sub</span> setup <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">my</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$self</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">@_</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;"># Create a directory object for use later</span>
	<span style="color: #0000ff;">$self</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#123;</span>directory<span style="color: #009900;">&#125;</span> <span style="color: #339933;">=</span> WWW<span style="color: #339933;">::</span><span style="color: #006600;">USF</span><span style="color: #339933;">::</span><span style="color: #006600;">Directory</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">new</span><span style="color: #009900;">&#40;</span>
		include_faculty  <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span>
		include_staff    <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span>
		include_students <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span>
	<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;"># Start in search mode, which is the only mode</span>
	<span style="color: #0000ff;">$self</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">start_mode</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">'search'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #0000ff;">$self</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">run_modes</span><span style="color: #009900;">&#40;</span>search <span style="color: #339933;">=&gt;</span> <span style="color: #ff0000;">'search'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">sub</span> search <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">my</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$self</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">@_</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;"># Hold the results and response</span>
	<span style="color: #b1b100;">my</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">@results</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$response</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;"># Set the header to specity JSON</span>
	<span style="color: #0000ff;">$self</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">header_add</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">-</span>type <span style="color: #339933;">=&gt;</span> <span style="color: #ff0000;">'application/json'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	try <span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;"># Search the directory</span>
		<span style="color: #0000ff;">@results</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$self</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#123;</span>directory<span style="color: #009900;">&#125;</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">search</span><span style="color: #009900;">&#40;</span>
			name <span style="color: #339933;">=&gt;</span> <span style="color: #000066;">scalar</span> <span style="color: #0000ff;">$self</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">query</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">param</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">'name'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
		<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #b1b100;">foreach</span> <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$result</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">@results</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #666666; font-style: italic;"># Change the ::Directory::Entry object into a hash of its attributes</span>
			<span style="color: #0000ff;">$result</span> <span style="color: #339933;">=</span> _moose_object_as_hash<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$result</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066;">exists</span> <span style="color: #0000ff;">$result</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#123;</span>affiliations<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #0000ff;">$result</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#123;</span>affiliations<span style="color: #009900;">&#125;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #000066;">map</span> <span style="color: #009900;">&#123;</span>
					_moose_object_as_hash<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$_</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span> <span style="color: #339933;">@</span><span style="color: #009900;">&#123;</span><span style="color: #0000ff;">$result</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#123;</span>affiliations<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;"># Return the JSON-encoded results to print</span>
		<span style="color: #0000ff;">$response</span> <span style="color: #339933;">=</span> JSON<span style="color: #339933;">-&gt;</span><span style="color: #006600;">new</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">encode</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
			results <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">\@results</span><span style="color: #339933;">,</span>
		<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	catch <span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;"># Get the error</span>
		<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$error</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$_</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;"># Return a JSON with the error</span>
		<span style="color: #0000ff;">$response</span> <span style="color: #339933;">=</span> JSON<span style="color: #339933;">-&gt;</span><span style="color: #006600;">new</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">encode</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
			error   <span style="color: #339933;">=&gt;</span> <span style="color: #ff0000;">&quot;$error&quot;</span><span style="color: #339933;">,</span>
			results <span style="color: #339933;">=&gt;</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
		<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;"># Return the response</span>
	<span style="color: #000066;">return</span> <span style="color: #0000ff;">$response</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">sub</span> _moose_object_as_hash <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">my</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$object</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">@_</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;"># Convert a Moose object to a HASH with the attribute_name =&gt; attribute_value</span>
	<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$hash</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span> <span style="color: #000066;">map</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$_</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">name</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$_</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">get_value</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$object</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #0000ff;">$object</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">meta</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">get_all_attributes</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000066;">return</span> <span style="color: #0000ff;">$hash</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000066;">package</span> main<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">use</span> <span style="color: #cc66cc;">5.008</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">use</span> strict<span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">use</span> warnings <span style="color: #ff0000;">'all'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Start and tun the application</span>
Directory<span style="color: #339933;">-&gt;</span><span style="color: #006600;">new</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">run</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>This will actually be added as an example in the next release. You can run this as a CGI and use the <code>name</code> param to pass what to search for, or run it from the command line with <code>name="Name"</code>.</p>
]]></content:encoded>
			<wfw:commentRss>http://somethingdoug.com/thoughts/2010/01/25/www-usf-directory-published/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Work on Public USF Perl Modules</title>
		<link>http://somethingdoug.com/thoughts/2010/01/19/work-on-public-usf-perl-modules/</link>
		<comments>http://somethingdoug.com/thoughts/2010/01/19/work-on-public-usf-perl-modules/#comments</comments>
		<pubDate>Wed, 20 Jan 2010 02:49:10 +0000</pubDate>
		<dc:creator>Douglas Wilson</dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[Perl5]]></category>
		<category><![CDATA[usf]]></category>

		<guid isPermaLink="false">http://somethingdoug.com/thoughts/?p=146</guid>
		<description><![CDATA[I am going to be publishing several of my Perl 5 modules that relate to the University of South Florida systems to the CPAN. This will allow anyone to use the modules as they please. I am planning on putting them in the namespace WWW::USF::*. I know that USF may be ambiguous, but feel it [...]]]></description>
			<content:encoded><![CDATA[<p>I am going to be publishing several of my Perl 5 modules that relate to the University of South Florida systems to the CPAN. This will allow anyone to use the modules as they please. I am planning on putting them in the namespace <code>WWW::USF::*</code>. I know that USF may be ambiguous, but feel it is appropriate since USF&#8217;s domain is usf.edu.</p>
]]></content:encoded>
			<wfw:commentRss>http://somethingdoug.com/thoughts/2010/01/19/work-on-public-usf-perl-modules/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New Header in Nagios-Plugin-OverHTTP 0.12</title>
		<link>http://somethingdoug.com/thoughts/2009/10/25/new-header-in-nagios-plugin-overhttp-0-12/</link>
		<comments>http://somethingdoug.com/thoughts/2009/10/25/new-header-in-nagios-plugin-overhttp-0-12/#comments</comments>
		<pubDate>Mon, 26 Oct 2009 00:53:06 +0000</pubDate>
		<dc:creator>Douglas Wilson</dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[cpan]]></category>
		<category><![CDATA[Perl5]]></category>

		<guid isPermaLink="false">http://somethingdoug.com/thoughts/?p=137</guid>
		<description><![CDATA[In the newest version of Nagios-Plugin-OverHTTP (0.12) that was just pushed out to the CPAN, support for a new header was introduced, thanks to Alex Wollangk. The header is X-Nagios-Information and is used to contain the message for the plugin check. Why would this be wanted? Well, if added to a page, the page itself [...]]]></description>
			<content:encoded><![CDATA[<p>In the newest version of <a href="http://search.cpan.org/dist/Nagios-Plugin-OverHTTP/">Nagios-Plugin-OverHTTP</a> (0.12) that was just pushed out to the CPAN, support for a new header was introduced, thanks to Alex Wollangk. The header is <code>X-Nagios-Information</code> and is used to contain the message for the plugin check. Why would this be wanted? Well, if added to a page, the page itself can serve a dual purpose: to accessible to a user and be a Nagios check. Also because of this, I have also added the option to customize the HTTP verb to use when making the request (like using the HEAD verb on such a page).</p>
<p>This could be used so that when a HEAD request comes from a specified IP address, the page can do some sort of self-check and output the results in the headers and provide back no body. This would allow for a very wide-range of live checks on a web site, giving up-to-date information regarding areas of the website they you would not notice until a user pointed out to you, allowing it to be fixed before anyone even notices.</p>
]]></content:encoded>
			<wfw:commentRss>http://somethingdoug.com/thoughts/2009/10/25/new-header-in-nagios-plugin-overhttp-0-12/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nagios::Plugin::OverHTTP 0.11</title>
		<link>http://somethingdoug.com/thoughts/2009/10/05/nagiospluginoverhttp-0-11/</link>
		<comments>http://somethingdoug.com/thoughts/2009/10/05/nagiospluginoverhttp-0-11/#comments</comments>
		<pubDate>Mon, 05 Oct 2009 05:18:37 +0000</pubDate>
		<dc:creator>Douglas Wilson</dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[cpan]]></category>
		<category><![CDATA[Perl5]]></category>

		<guid isPermaLink="false">http://somethingdoug.com/thoughts/?p=134</guid>
		<description><![CDATA[A new release of Nagios::Plugin::OverHTTP was just pushed to the CPAN. This release brings no new features, but does change what is installed. The check_over_http script is now no longer automatically installed to the bin. Also when trying to get the plugin to work under ePN in Nagios, I discovered that if some spaces are [...]]]></description>
			<content:encoded><![CDATA[<p>A new release of <a href="http://search.cpan.org/dist/Nagios-Plugin-OverHTTP/">Nagios::Plugin::OverHTTP</a> was just pushed to the CPAN. This release brings no new features, but does change what is installed. The <code>check_over_http</code> script is now no longer automatically installed to the bin. Also when trying to get the plugin to work under <a href="http://nagios.sourceforge.net/docs/3_0/embeddedperl.html">ePN</a> in Nagios, I discovered that if some spaces are at the end of the command line arguments, there is an <code>undef</code> loaded into the <code>@ARGV</code> variable which makes <a href="http://search.cpan.org/perldoc?Getopt::Long">Getopt::Long</a> give a warning, which then causes ePN to abort the plugin. I added some code into the <code>check_over_http</code> plugin distributed with my package that will work around this issue and adds a comment to tell Nagios to load the plugin under ePN. May the new plugin bring you faster service checks!</p>
]]></content:encoded>
			<wfw:commentRss>http://somethingdoug.com/thoughts/2009/10/05/nagiospluginoverhttp-0-11/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nagios::Plugin::OverHTTP 0.10</title>
		<link>http://somethingdoug.com/thoughts/2009/09/10/nagiospluginoverhttp-0-10/</link>
		<comments>http://somethingdoug.com/thoughts/2009/09/10/nagiospluginoverhttp-0-10/#comments</comments>
		<pubDate>Fri, 11 Sep 2009 00:24:01 +0000</pubDate>
		<dc:creator>Douglas Wilson</dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[cpan]]></category>
		<category><![CDATA[Perl5]]></category>

		<guid isPermaLink="false">http://somethingdoug.com/thoughts/?p=130</guid>
		<description><![CDATA[Apparently jumped the gun on the release and just added another new feature to Nagios::Plugin::OverHTTP and included it in version 0.10. The new feature is actually complementary to the previous new feature. Now if a response is received from the HTTP server that does not indicate the Nagios service status, then not only will it [...]]]></description>
			<content:encoded><![CDATA[<p>Apparently jumped the gun on the release and just added another new feature to <a href="http://search.cpan.org/dist/Nagios-Plugin-OverHTTP/">Nagios::Plugin::OverHTTP</a> and included it in version 0.10. The new feature is actually complementary to the previous new feature. Now if a response is received from the HTTP server that does not indicate the Nagios service status, then not only will it use the default status (which was the previous feature) but it will attempt to make the first line of the message more useful. This idea occurred to me when a service of mine turned to <code>CRITICAL - &lt;HTML&gt;</code> (which is very unhelpful).</p>
<p>If the response is multiple lines and it looks like HTML (like has a HTML, BODY, or HEAD tag), then the script will attempt to find the TITLE tag and put the contents as the first line of the message. If there is no TITLE tag, then it will try looking for a H1 tag.</p>
]]></content:encoded>
			<wfw:commentRss>http://somethingdoug.com/thoughts/2009/09/10/nagiospluginoverhttp-0-10/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nagios::Plugin::OverHTTP 0.09</title>
		<link>http://somethingdoug.com/thoughts/2009/09/10/nagiospluginoverhttp-0-09/</link>
		<comments>http://somethingdoug.com/thoughts/2009/09/10/nagiospluginoverhttp-0-09/#comments</comments>
		<pubDate>Thu, 10 Sep 2009 22:29:39 +0000</pubDate>
		<dc:creator>Douglas Wilson</dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[cpan]]></category>
		<category><![CDATA[Perl5]]></category>

		<guid isPermaLink="false">http://somethingdoug.com/thoughts/?p=127</guid>
		<description><![CDATA[A new version of Nagios::Plugin::OverHTTP was just pushed out to the CPAN that includes an additional option: to set what the status will be reported as if the HTTP response did not include a status. If you want the default status to be critical instead of unknown (the previous and current default), just add --default_status=CRITICAL [...]]]></description>
			<content:encoded><![CDATA[<p>A new version of <a href="http://search.cpan.org/dist/Nagios-Plugin-OverHTTP/">Nagios::Plugin::OverHTTP</a> was just pushed out to the CPAN that includes an additional option: to set what the status will be reported as if the HTTP response did not include a status. If you want the default status to be critical instead of unknown (the previous and current default), just add <code>--default_status=CRITICAL</code> to the command line arguments of the plugin call.</p>
]]></content:encoded>
			<wfw:commentRss>http://somethingdoug.com/thoughts/2009/09/10/nagiospluginoverhttp-0-09/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Watching Upstream Dependencies</title>
		<link>http://somethingdoug.com/thoughts/2009/08/23/watching-upstream-dependencies/</link>
		<comments>http://somethingdoug.com/thoughts/2009/08/23/watching-upstream-dependencies/#comments</comments>
		<pubDate>Sun, 23 Aug 2009 19:10:10 +0000</pubDate>
		<dc:creator>Douglas Wilson</dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[cpan]]></category>
		<category><![CDATA[Perl5]]></category>

		<guid isPermaLink="false">http://somethingdoug.com/thoughts/?p=118</guid>
		<description><![CDATA[I am subscribed to the RSS feed for CPAN uploads and watch for new versions of CPAN distributions my modules depend on and read their change logs. The other day I saw Moose 0.89 come out and saw a new feature added where the trigger of an attribute will now receive the old value if [...]]]></description>
			<content:encoded><![CDATA[<p>I am subscribed to the <a href="http://search.cpan.org/uploads.rdf">RSS feed for CPAN uploads</a> and watch for new versions of CPAN distributions my modules depend on and read their change logs. The other day I saw <a href="http://search.cpan.org/~drolsky/Moose-0.89/">Moose 0.89</a> come out and saw a new feature added where the trigger of an attribute will now receive the old value if there was one.</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #000066;">package</span> Node<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">use</span> Moose <span style="color: #cc66cc;">0.89</span><span style="color: #339933;">;</span>
&nbsp;
has child <span style="color: #339933;">=&gt;</span> <span style="color: #009900;">&#40;</span>
  is  <span style="color: #339933;">=&gt;</span> <span style="color: #ff0000;">'rw'</span><span style="color: #339933;">,</span>
  isa <span style="color: #339933;">=&gt;</span> <span style="color: #ff0000;">'Node'</span><span style="color: #339933;">,</span>
  clearer   <span style="color: #339933;">=&gt;</span> <span style="color: #ff0000;">'clear_child'</span><span style="color: #339933;">,</span>
  predicate <span style="color: #339933;">=&gt;</span> <span style="color: #ff0000;">'has_child'</span><span style="color: #339933;">,</span>
  trigger   <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">\&amp;_child_trigger</span><span style="color: #339933;">,</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
has parent <span style="color: #339933;">=&gt;</span> <span style="color: #009900;">&#40;</span>
  is  <span style="color: #339933;">=&gt;</span> <span style="color: #ff0000;">'rw'</span><span style="color: #339933;">,</span>
  isa <span style="color: #339933;">=&gt;</span> <span style="color: #ff0000;">'Node'</span><span style="color: #339933;">,</span>
  clearer   <span style="color: #339933;">=&gt;</span> <span style="color: #ff0000;">'clear_parent'</span><span style="color: #339933;">,</span>
  predicate <span style="color: #339933;">=&gt;</span> <span style="color: #ff0000;">'has_parent'</span><span style="color: #339933;">,</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
before clear_child <span style="color: #339933;">=&gt;</span> <span style="color: #000000; font-weight: bold;">sub</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">my</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$self</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">@_</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;"># Trigger dissociate the parent from the child about to be cleared</span>
  <span style="color: #0000ff;">$self</span><span style="color: #339933;">-&gt;</span>_child_trigger<span style="color: #009900;">&#40;</span><span style="color: #000066;">undef</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$self</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">child</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000066;">return</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">sub</span> _child_trigger <span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">my</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$self</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$child</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$previous_child</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">@_</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066;">defined</span> <span style="color: #0000ff;">$previous_child</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;"># Remove this node as the parent of the previous child</span>
    <span style="color: #0000ff;">$previous_child</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">clear_parent</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066;">defined</span> <span style="color: #0000ff;">$child</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;"># Set this node as the parent of the new child</span>
    <span style="color: #0000ff;">$child</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">parent</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$self</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000066;">return</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000066;">no</span> Moose<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span></pre></div></div>

<p>I quickly saw the benefit of this new feature for my <a href="http://search.cpan.org/dist/Authen-CAS-External/">Authen::CAS::External</a> distribution and incorporated this into the <code>cas_url</code> and the <code>user_agent</code> attributes. Now the associated LWP::UserAgent always has the proper handlers set up and strange issues where browsing to a CAS page with a user agent object formerly associated with Authen::CAS::External triggering the Authen::CAS::External library will no longer occur.</p>
]]></content:encoded>
			<wfw:commentRss>http://somethingdoug.com/thoughts/2009/08/23/watching-upstream-dependencies/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Net::SAJAX 0.102</title>
		<link>http://somethingdoug.com/thoughts/2009/08/22/netsajax-0-102/</link>
		<comments>http://somethingdoug.com/thoughts/2009/08/22/netsajax-0-102/#comments</comments>
		<pubDate>Sat, 22 Aug 2009 19:59:50 +0000</pubDate>
		<dc:creator>Douglas Wilson</dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[cpan]]></category>
		<category><![CDATA[Perl5]]></category>

		<guid isPermaLink="false">http://somethingdoug.com/thoughts/?p=110</guid>
		<description><![CDATA[In the short time since the first release of Net::SAJAX, there has been three more releases. Version 0.100 changed the call method to now return native Perl data structures instead of JE objects, and so some quirks with using the JE objects as Perl data structures were no more. Version 0.102 introduced a new attribute [...]]]></description>
			<content:encoded><![CDATA[<p>In the short time since the first release of <a href="http://search.cpan.org/perldoc?Net::SAJAX">Net::SAJA</a>X, there has been three more releases. Version 0.100 changed the call method to now return native Perl data structures instead of <a href="http://search.cpan.org/perldoc?JE">JE</a> objects, and so some quirks with using the JE objects as Perl data structures were no more. Version 0.102 introduced a new attribute to the Net::SAJAX object called <code>autoclean_garbage</code> that when enabled (it is disabled by default) will attempt to work around any bad programming on the remote SAJAX page (like PHP warnings appearing before the SAJAX response).</p>
<p>One of the most useful new features in 0.102 is that now all errors are <a href="http://search.cpan.org/perldoc?Net::SAJAX::Exception">Net::SAJAX::Exception</a> objects. The benefit of this is the ability to handle errors even better.</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">use</span> <span style="color: #cc66cc;">5.008003</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">use</span> strict<span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">use</span> warnings <span style="color: #ff0000;">'all'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">use</span> Carp <span style="color: #000066;">qw</span><span style="color: #009900;">&#40;</span>croak<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">use</span> English <span style="color: #000066;">qw</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">-</span>no_match_vars<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">use</span> Net<span style="color: #339933;">::</span><span style="color: #006600;">SAJAX</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">use</span> Scalar<span style="color: #339933;">::</span><span style="color: #006600;">Util</span> <span style="color: #000066;">qw</span><span style="color: #009900;">&#40;</span>blessed<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$sajax</span> <span style="color: #339933;">=</span> Net<span style="color: #339933;">::</span><span style="color: #006600;">SAJAX</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">new</span><span style="color: #009900;">&#40;</span>
  url <span style="color: #339933;">=&gt;</span> <span style="color: #ff0000;">'http://example.net/directory.php'</span><span style="color: #339933;">,</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Look up a person in the directory</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$people</span> <span style="color: #339933;">=</span> <span style="color: #000066;">eval</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #0000ff;">$sajax</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">call</span><span style="color: #009900;">&#40;</span>
    function  <span style="color: #339933;">=&gt;</span> <span style="color: #ff0000;">'SearchDirectory'</span><span style="color: #339933;">,</span>
    arguments <span style="color: #339933;">=&gt;</span> <span style="color: #009900;">&#91;</span><span style="color: #0000ff;">$first_name</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$last_name</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
  <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$EVAL_ERROR</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;"># Remember, $EVAL_ERROR cam from the English module</span>
  <span style="color: #666666; font-style: italic;"># An error occurred</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>blessed <span style="color: #0000ff;">$EVAL_ERROR</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #0000ff;">$EVAL_ERROR</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">isa</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">'Net::SAJAX::RemoteError'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;"># The server sent an error message, like &quot;Access Denied&quot;</span>
    show_error<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$EVAL_ERROR</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">message</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">elsif</span> <span style="color: #009900;">&#40;</span>blessed <span style="color: #0000ff;">$EVAL_ERROR</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #0000ff;">$EVAL_ERROR</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">isa</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">'Net::SAJAX::JavaScriptEvaluation'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;"># Some error occurred while evaluating the JavaScript</span>
    <span style="color: #666666; font-style: italic;"># Perform some clean up to the JS because you know that the</span>
    <span style="color: #666666; font-style: italic;"># site returns bad JS sometimes.</span>
    <span style="color: #0000ff;">$people</span> <span style="color: #339933;">=</span> my_own_js_eval<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$EVAL_ERROR</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">javascript_string</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;"># Don't know what this error is, so throw it again</span>
    croak <span style="color: #0000ff;">$EVAL_ERROR</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000066;">print</span> <span style="color: #ff0000;">&quot;Found the following people:<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Loop through each person and print</span>
<span style="color: #b1b100;">foreach</span> <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$person</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">@</span><span style="color: #009900;">&#123;</span><span style="color: #0000ff;">$people</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000066;">printf</span> <span style="color: #ff0000;">&quot;%s, %s: %s<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">$person</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#123;</span>last_name   <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">$person</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#123;</span>first_name  <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">$person</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#123;</span>phone_number<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">sub</span> my_own_js_eval <span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">my</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$javascript</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">@_</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;"># Do something with the JavaScript here</span>
&nbsp;
  <span style="color: #000066;">return</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">sub</span> show_error <span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">my</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$message</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">@_</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000066;">print</span> <span style="color: #009900;">&#123;</span><span style="color: #0000ff;">*STDERR</span><span style="color: #009900;">&#125;</span> <span style="color: #ff0000;">&quot;Received $message from the server!<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000066;">exit</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000066;">exit</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://somethingdoug.com/thoughts/2009/08/22/netsajax-0-102/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
