<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title>Adam Flott</title>
    <link rel="alternate" type="text/html" href="http://blogs.perl.org/users/adam_flott/" />
    <link rel="self" type="application/atom+xml" href="http://blogs.perl.org/users/adam_flott/atom.xml" />
    <id>tag:blogs.perl.org,2009-11-03:/users/adam_flott//203</id>
    <updated>2012-01-31T01:45:02Z</updated>
    
    <generator uri="http://www.sixapart.com/movabletype/">Movable Type Pro 4.38</generator>

<entry>
    <title>Winobot, the IRC Bot You Can Party With</title>
    <link rel="alternate" type="text/html" href="http://blogs.perl.org/users/adam_flott/2012/01/winobot-the-irc-bot-you-can-party-with.html" />
    <id>tag:blogs.perl.org,2012:/users/adam_flott//203.2751</id>

    <published>2012-01-31T01:17:28Z</published>
    <updated>2012-01-31T01:45:02Z</updated>

    <summary>There&apos;s a new Perl IRC bot on the block. Built on AnyEvent. And he likes to party. Details and GitHub...</summary>
    <author>
        <name>Adam Flott</name>
        <uri>http://www.npjh.com</uri>
    </author>
    
    <category term="perlanyeventircdumbthingsimade" label="perl anyevent irc dumbthingsimade" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://blogs.perl.org/users/adam_flott/">
        <![CDATA[<p>There's a new Perl IRC bot on the block. Built on AnyEvent. And he likes to party.</p>

<p><a href="http://npjh.com/winobot-the-irc-bot-you-can-party-with.html">Details</a> and <a href="https://github.com/aflott/winobot">GitHub</a></p>
]]>
        

    </content>
</entry>

<entry>
    <title>soma.fm</title>
    <link rel="alternate" type="text/html" href="http://blogs.perl.org/users/adam_flott/2012/01/somafm.html" />
    <id>tag:blogs.perl.org,2012:/users/adam_flott//203.2743</id>

    <published>2012-01-29T16:17:48Z</published>
    <updated>2012-01-29T16:30:19Z</updated>

    <summary>I like soma fm command line interfaces Perl most of the time I don&apos;t like All media players except cmus Shell syntax So I made something simple to scratch my itch. Download from GitHub...</summary>
    <author>
        <name>Adam Flott</name>
        <uri>http://www.npjh.com</uri>
    </author>
    
    <category term="perlsomafmdialogcurses" label="perl somafm dialog curses" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://blogs.perl.org/users/adam_flott/">
        <![CDATA[<p>I like</p>

<ul>
	<li><a href="http://soma.fm">soma fm</a></li>
        <li>command line interfaces</li>
        <li>Perl most of the time</li>
</ul>

<p><br />
<p>I don't like</p></p>

<ul>
    <li>All media players except cmus</li>
    <li>Shell syntax</li>
</ul>

<p><br />
<p>So I made something simple to scratch my itch.</p></p>

<p><img alt="Screen Shot 2012-01-29 at 11.26.07 AM.png" src="http://blogs.perl.org/users/adam_flott/Screen%20Shot%202012-01-29%20at%2011.26.07%20AM.png" width="579" height="437" class="mt-image-none" style="" /></p>

<p><br />
<p>Download from <a href="https://github.com/aflott/gizmos/blob/master/somafm-menu">GitHub</a></p></p>]]>
        
    </content>
</entry>

<entry>
    <title>Graphical widgets in my text console? How perverse!</title>
    <link rel="alternate" type="text/html" href="http://blogs.perl.org/users/adam_flott/2011/04/graphical-widgets-in-my-text-console-how-perverse.html" />
    <id>tag:blogs.perl.org,2011:/users/adam_flott//203.1709</id>

    <published>2011-04-28T22:51:56Z</published>
    <updated>2011-04-28T23:09:17Z</updated>

    <summary>Things like this: are now possible in Perl and Moose. Get from CPAN...</summary>
    <author>
        <name>Adam Flott</name>
        <uri>http://www.npjh.com</uri>
    </author>
    
    <category term="dialogguiconfigurationmoose" label="dialog gui configuration moose" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://blogs.perl.org/users/adam_flott/">
        <![CDATA[<p>Things like this:</p>

<p><img alt="amethyst-buildconf-value-change.png" src="http://blogs.perl.org/users/adam_flott/2011/04/28/amethyst-buildconf-value-change.png" width="657" height="389" class="mt-image-none" style="" /></p>

<p>are now possible in Perl and Moose. Get from <a href="http://search.cpan.org/dist/Hobocamp/">CPAN</a></p>
]]>
        <![CDATA[<p>Now some history...</p>

<p>Like most configuration systems the history is nearly the same. First you start out with global variables because no one really thought about it nor cared about future maintenance. So you end up with:</p>

<pre><code>Some::Thing::AMBIOUS_ABBREVIATED_CONFIG_VARIABLES = 9999;
</code></pre>

<p>And then you realize that was a terrible idea because someone changed it to a value that had disastrous effects in production because any number of reasons, the value didn't have any consequences in your internal test environment, typo, etc.</p>

<p>Then you move on to config files, possibly Perl or hand made. Then to a standard format, ini or whatever. Then you realize how smart YAML and JSON are and settle with those.</p>

<p>But there still is a problem. What is an easy way for someone new to the application to setup up their own configuration? How about someone not intimately familiar with Perl? I decided that enough was enough and a real solution was required. I browsed and browsed for a solution that would allow me to use some sort of graphical interface in the terminal or possibly even X that I could piggy back off of and build an easy configuration management system. There was no complete solution that met the Adam's Standard of Software Excellence approval, so like most driven developers, I created (or in this case glued) my own using dialog (more precisely libdialog which dialog is built from), which uses ncurses for drawing.</p>

<p>The result: Hobocamp. Yes, it has a silly name, here's where it's <a href="http://search.cpan.org/perldoc?Hobocamp#WHATS_A_HOBOCAMP?">from</a>.</p>

<p>Now we needed a way to make config values adjustable. This is an example pulled from our home grown system at work. We have a type library and knobs which are a single item in the menu list. This ties directly into our configuration library (based on YAML) so altering a value here via the GUI results in the data being written back on save.</p>

<pre><code>package Amethyst::BuildConf::Knob::UnixBinary;

use Moose;
use File::Spec;
use Amethyst::Types qw(UnixExecutableFile);

has 'conf_key_name' =&gt; (
    'isa'     =&gt; 'Str',
    ...
);
has 'name' =&gt; (
    'isa'     =&gt; 'Str',
    ...
);
has 'question' =&gt; (
    'isa'     =&gt; 'Str',
    ...
);
has 'value' =&gt; (
    'isa' =&gt; UnixExecutableFile,
    'is'  =&gt; 'rw',
);
has 'data' =&gt; (
    'isa'     =&gt; 'Str',
    'is'      =&gt; 'ro',
    'default' =&gt; '/tmp/a.out'
);
with qw(Amethyst::BuildConf::Roles::Knob Amethyst::BuildConf::Roles::UI::FileSelect);
</code></pre>

<p>The role defines what GUI widget is used.</p>

<p>A test would look something like this:</p>

<pre><code>subtype UnixFilename,
    as Str,
    where { m/[\0|\/]/ },
    message { "$_ is not a valid Unix file name" };
</code></pre>

<p>And any invalid input catches that message and displays to the user as message box widget.</p>

<p>And now we have a robust solution that both developers and non-developers can easily use.</p>
]]>
    </content>
</entry>

<entry>
    <title>Bindings for the Enlightenment Foundation Libraries&apos; Elementary</title>
    <link rel="alternate" type="text/html" href="http://blogs.perl.org/users/adam_flott/2010/01/bindings-for-the-enlightenment-foundation-libraries-elementary.html" />
    <id>tag:blogs.perl.org,2010:/users/adam_flott//203.177</id>

    <published>2010-01-08T22:01:54Z</published>
    <updated>2010-01-09T19:58:33Z</updated>

    <summary>You have another option for GUIs with Perl. Find it on CPAN....</summary>
    <author>
        <name>Adam Flott</name>
        <uri>http://www.npjh.com</uri>
    </author>
    
    
    <content type="html" xml:lang="en" xml:base="http://blogs.perl.org/users/adam_flott/">
        <![CDATA[<p>You have another option for GUIs with Perl.</p>

<p>Find it on <a href="http://search.cpan.org/perldoc?EFL::Elementary">CPAN</a>.</p>]]>
        
    </content>
</entry>

</feed>
