<?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</title>
	<atom:link href="http://somethingdoug.com/thoughts/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>Strawberry Perl, patch.exe and UAC</title>
		<link>http://somethingdoug.com/thoughts/2010/04/26/strawberry-perl-patch-exe-and-uac/</link>
		<comments>http://somethingdoug.com/thoughts/2010/04/26/strawberry-perl-patch-exe-and-uac/#comments</comments>
		<pubDate>Mon, 26 Apr 2010 05:29:11 +0000</pubDate>
		<dc:creator>Douglas Wilson</dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[Perl5]]></category>

		<guid isPermaLink="false">http://somethingdoug.com/thoughts/?p=180</guid>
		<description><![CDATA[I work a lot with Perl 5 under Windows and have loved Strawberry Perl so much. I&#8217;ve been using ActiveState&#8217;s ActivePerl since 2001 and welcomed the UNIX-like experience Strawberry Perl gave me, especially because it was sometimes very hard to get some modules for ActivePerl. Anyhow, in Windows Vista and up the User Account Control [...]]]></description>
			<content:encoded><![CDATA[<p>I work a lot with Perl 5 under Windows and have loved <a href="http://strawberryperl.com/">Strawberry Perl</a> so much. I&#8217;ve been using ActiveState&#8217;s <a href="http://www.activestate.com/activeperl/">ActivePerl</a> since 2001 and welcomed the UNIX-like experience Strawberry Perl gave me, especially because it was sometimes very hard to get some modules for ActivePerl.</p>
<p>Anyhow, in Windows Vista and up the User Account Control feature has a backwards-compatibility feature where for programs that don&#8217;t contain manifest files (presumably because they aren&#8217;t UAC-aware) Windows will look at certain characteristics of the file to determine if it needs Administrative privileges to run properly. One of the ways it determines this is by file name. The utility that comes with the C tool chain in Strawberry Perl <code>patch.exe</code> triggers this detection mechanism because of the word &#8220;patch&#8221; in the file name. Because of this it is pretty much impossible to install modules like <code>Math::Pari</code> that make use of the patch.exe program.</p>
<p>A few days ago I saw a new development release of <a href="http://search.cpan.org/dist/Win32-Exe/">Win32::Exe</a> (0.12_03) was released and saw it supported viewing and modifying of embedded manifests! I decided to use this on the patch.exe file in Strawberry Perl to set the required privilege level to asInvoker (so that UAC is not needed) and it worked! Though you no longer need to do this for the April 2010 and up Strawberry Perl releases, anyone running an older version and not planning to upgrade soon may want to modify their path.exe with the following commands:</p>
<p><code>C:\> cpan MDOOTSON/Win32-Exe-0.12_03.tar.gz<br />
C:\> perl -MWin32::Exe -e "$e=Win32::Exe->new('c:/strawberry/c/bin/patch.exe'); $m=$e->get_manifest; $m->set_execution_level('asInvoker'); $e->set_manifest($m); $e->write;"</code></p>
]]></content:encoded>
			<wfw:commentRss>http://somethingdoug.com/thoughts/2010/04/26/strawberry-perl-patch-exe-and-uac/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Important Bug Fix in Authen::CAS::External 0.06</title>
		<link>http://somethingdoug.com/thoughts/2010/04/08/important-bug-fix-in-authen-cas-external-0-06/</link>
		<comments>http://somethingdoug.com/thoughts/2010/04/08/important-bug-fix-in-authen-cas-external-0-06/#comments</comments>
		<pubDate>Fri, 09 Apr 2010 02:32:30 +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=174</guid>
		<description><![CDATA[Earlier today I released an important bug fix to my distribution Authen-CAS-External (under version 0.06). The bug caused the distribution to fail on CAS deployments where the application was not deployed at the root URL (i.e. https://cas.domain.com/login worked fine, but https://cas.domain.com/cas/login did not work at all). The reason was because the LWP::UserAgent handler rules had [...]]]></description>
			<content:encoded><![CDATA[<p>Earlier today I released an important bug fix to my distribution <a href="http://search.cpan.org/dist/Authen-CAS-External/">Authen-CAS-External</a> (under version 0.06). The bug caused the distribution to fail on CAS deployments where the application was not deployed at the root URL (i.e. https://cas.domain.com/login worked fine, but https://cas.domain.com/cas/login did not work at all). The reason was because the LWP::UserAgent handler rules had <code>m_path_match</code> set to a static <code>qr{\A /login}msx</code>, which clearly would only match pages where <code>login</code> was at the root, which is not always the case. This was fixed by storing the path to login in the variable <code>$cas_path</code> and then changing the path match to <code>qr{\A \Q$cas_path\E}msx</code>. Note the <code>\Q</code> and <code>\E</code> are important so that the regular expression properly treats the path as a static string. The full patch can be seen in <a href="http://github.com/dougwilson/perl5-authen-cas-external/commit/df8ef3b03bfff370ac44e68bb72b6086987b5ca0">commit df8ef3b</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://somethingdoug.com/thoughts/2010/04/08/important-bug-fix-in-authen-cas-external-0-06/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Big Updates to Nagios::Plugin::OverHTTP</title>
		<link>http://somethingdoug.com/thoughts/2010/04/07/big-updates-to-nagios-plugin-overhttp/</link>
		<comments>http://somethingdoug.com/thoughts/2010/04/07/big-updates-to-nagios-plugin-overhttp/#comments</comments>
		<pubDate>Wed, 07 Apr 2010 16:48:53 +0000</pubDate>
		<dc:creator>Douglas Wilson</dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[cpan]]></category>
		<category><![CDATA[Nagios]]></category>
		<category><![CDATA[Perl5]]></category>

		<guid isPermaLink="false">http://somethingdoug.com/thoughts/?p=172</guid>
		<description><![CDATA[I was contacted by Peter van Eijk who was interested in getting performance data support added to Nagios-Plugin-OverHTTP and I quickly moved to add it in. Version 0.14 added performance data support and a major overhaul was made to the class layout. I was inspired by the layout of Plack and thought that it was [...]]]></description>
			<content:encoded><![CDATA[<p>I was contacted by Peter van Eijk who was interested in getting performance data support added to <a href="http://search.cpan.org/dist/Nagios-Plugin-OverHTTP/">Nagios-Plugin-OverHTTP</a> and I quickly moved to add it in. Version 0.14 added performance data support and a major overhaul was made to the class layout. I was inspired by the layout of <a href="http://search.cpan.org/dist/Plack/">Plack</a> and thought that it was a great layout for a pluggable system. I hope to a &#8220;builder&#8221; class similar to <a href="http://search.cpan.org/perldoc?Plack::Builder">Plack::Builder</a> so users can create all kinds of plugins based off Nagios-Plugin-OverHTTP. As soon as the builder class comes out, I will created a very detailed post on the greatness of this plugin.</p>
]]></content:encoded>
			<wfw:commentRss>http://somethingdoug.com/thoughts/2010/04/07/big-updates-to-nagios-plugin-overhttp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Experiments with Module::Build</title>
		<link>http://somethingdoug.com/thoughts/2010/03/22/experiments-with-module-build/</link>
		<comments>http://somethingdoug.com/thoughts/2010/03/22/experiments-with-module-build/#comments</comments>
		<pubDate>Mon, 22 Mar 2010 05:27:25 +0000</pubDate>
		<dc:creator>Douglas Wilson</dc:creator>
				<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://somethingdoug.com/thoughts/?p=168</guid>
		<description><![CDATA[I am using two of my distributions as tests for using Module::Build instead of Module::Install. So far they have only been released as development versions, but I hope to get them out as actual releases. So far I have chosen not to generate any Makefile.PL in the distributions, but I think I will in the [...]]]></description>
			<content:encoded><![CDATA[<p>I am using two of my distributions as tests for using <a href="http://search.cpan.org/perldoc?Module::Build">Module::Build</a> instead of <a href="http://search.cpan.org/perldoc?Module::Install">Module::Install</a>. So far they have only been released as development versions, but I hope to get them out as actual releases. So far I have chosen not to generate any <code>Makefile.PL</code> in the distributions, but I think I will in the actual releases. I love how easy Module::Install is to use, but I have to agree with the arguments for Module::Build and that it is written in Perl and doesn&#8217;t rely on an outside build system that is really not needed at all for pure-Perl modules like my current distributions are.</p>
]]></content:encoded>
			<wfw:commentRss>http://somethingdoug.com/thoughts/2010/03/22/experiments-with-module-build/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<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>Nagios::Plugin::OverHTTP Planned Additions</title>
		<link>http://somethingdoug.com/thoughts/2010/02/05/nagios-plugin-overhttp-planned-additions/</link>
		<comments>http://somethingdoug.com/thoughts/2010/02/05/nagios-plugin-overhttp-planned-additions/#comments</comments>
		<pubDate>Fri, 05 Feb 2010 22:12:25 +0000</pubDate>
		<dc:creator>Douglas Wilson</dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[cpan]]></category>
		<category><![CDATA[Nagios]]></category>
		<category><![CDATA[Perl5]]></category>

		<guid isPermaLink="false">http://somethingdoug.com/thoughts/?p=160</guid>
		<description><![CDATA[I usually get e-mails about my Nagios::Plugin::OverHTTP asking about little things being added here and there. The last e-mail I got was from Peter van Eijk asking for support for performance data. I looked over the code and realized that it really needs some refactoring before I can easily add support for performance data, and [...]]]></description>
			<content:encoded><![CDATA[<p>I usually get e-mails about my <a href="http://search.cpan.org/dist/Nagios-Plugin-OverHTTP/">Nagios::Plugin::OverHTTP</a> asking about little things being added here and there. The last e-mail I got was from Peter van Eijk asking for support for performance data. I looked over the code and realized that it really needs some refactoring before I can easily add support for performance data, and so I am currently hung up on that before the feature will get added.</p>
<p>My current thoughts on support for getting performance data from the remote page would be to just scrape it from the standard plugin output, which is supported as the body:</p>
<pre>PLUGIN OK - Good to go! | time=0.012s;1;10;10;0</pre>
<p>I was also thinking about how to add support for receiving as headers, since the other supported aspects of the plugin may be transmitted as headers. My current thoughts are for a header named <code>X-Nagios-Performance</code> which would hold the <code>name=value</code> pair, separated by spaces like the normal plugin and would also allow more than one header with the data to be present:</p>
<pre>X-Nagios-Performance: time=0.012s;1;10;10;0
X-Nagios-Performance: count=2;;;50;0 other=4;;;4;0</pre>
<p>For Nagios::Plugin::OverHTTP itself, since the remote plugin can provide critical and warning thresholds, I was thinking of allowing for actually changing the status based on that to be made optional by default (because if the remote plugin said the status was OK but yet a performance metric it sent said that it should really be in a WARNING state, by default Nagios would have kept that as OK so I believe that my plugin should honor that as well by default). New options for the plugin would be:</p>
<pre>--warning name=threshold
--critical name=threshold
--use-transmitted-thresholds
--override-transmitted-thresholds</pre>
<p>The last option <code>--override-transmitted-thresholds</code> would cause the performance data written as the plugin&#8217;s output to be changed to match the thresholds given as the plugin&#8217;s options. This means a plugin with the given options <code>--override-transmitted-thresholds --critical time=4</code> would cause the performance data to say <code>time=0.012s;1;4;10;0</code> instead of <code>time=0.012s;1;10;10;0</code> (note that this setting does not affect the decision of the final status code).</p>
]]></content:encoded>
			<wfw:commentRss>http://somethingdoug.com/thoughts/2010/02/05/nagios-plugin-overhttp-planned-additions/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>HP Pavilian tx 1000 nVidia problem</title>
		<link>http://somethingdoug.com/thoughts/2010/01/03/hp-pavilian-tx-1000-nvidia-problem/</link>
		<comments>http://somethingdoug.com/thoughts/2010/01/03/hp-pavilian-tx-1000-nvidia-problem/#comments</comments>
		<pubDate>Sun, 03 Jan 2010 21:29:13 +0000</pubDate>
		<dc:creator>Douglas Wilson</dc:creator>
				<category><![CDATA[Computers]]></category>

		<guid isPermaLink="false">http://somethingdoug.com/thoughts/?p=144</guid>
		<description><![CDATA[This is mostly an update to my previous post on my HP Pavilian tx 1000 issues. As time goes on, the laptop won&#8217;t boot up more. Today was the worst of all, though. I have determined that the problem is the same that lots of other people are having, which is where the nVidia GPU [...]]]></description>
			<content:encoded><![CDATA[<p>This is mostly an update to my previous post on my HP Pavilian tx 1000 issues. As time goes on, the laptop won&#8217;t boot up more. Today was the worst of all, though. I have determined that the problem is the same that lots of other people are having, which is where the nVidia GPU is becoming unseated from the motherboard, causing the BIOS not to POST.</p>
]]></content:encoded>
			<wfw:commentRss>http://somethingdoug.com/thoughts/2010/01/03/hp-pavilian-tx-1000-nvidia-problem/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
