<?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; usf</title>
	<atom:link href="http://somethingdoug.com/thoughts/tag/usf/feed/" rel="self" type="application/rss+xml" />
	<link>http://somethingdoug.com/thoughts</link>
	<description></description>
	<lastBuildDate>Thu, 26 Aug 2010 03:59:48 +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>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>
	</channel>
</rss>
