<?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>divisionbyzero</title>
	<atom:link href="http://divisionbyzero.net/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://divisionbyzero.net/blog</link>
	<description>question . authority</description>
	<lastBuildDate>Mon, 08 Mar 2010 20:22:52 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>The Unofficial Doctrine of &#8220;Helping Hand&#8221; Evolution</title>
		<link>http://divisionbyzero.net/blog/2010/03/08/the-unofficial-doctrine-of-helping-hand-evolution/</link>
		<comments>http://divisionbyzero.net/blog/2010/03/08/the-unofficial-doctrine-of-helping-hand-evolution/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 20:22:52 +0000</pubDate>
		<dc:creator>brad</dc:creator>
				<category><![CDATA[Article]]></category>
		<category><![CDATA[catholicism]]></category>
		<category><![CDATA[evolution]]></category>

		<guid isPermaLink="false">http://divisionbyzero.net/blog/?p=162</guid>
		<description><![CDATA[I&#8217;ve been schooling myself on Evolutionary Biology for about 3 or 4 years.
I dropped out of college after my freshman year because Undergrad was then,
and is still is today a lifeless process of rote memorization.  During that
time, I didn&#8217;t learn to learn, or learn anything more than &#8220;here are the
rules, and if you don&#8217;t follow [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been schooling myself on Evolutionary Biology for about 3 or 4 years.<br />
I dropped out of college after my freshman year because Undergrad was then,<br />
and is still is today a lifeless process of rote memorization.  During that<br />
time, I didn&#8217;t learn to learn, or learn anything more than &#8220;here are the<br />
rules, and if you don&#8217;t follow them, there will be consequences.&#8221;  I&#8217;m not<br />
sure if the topic of this essay is relevant to anyone outside of<br />
Catholicism, but I&#8217;ve not heard much about it in the Skeptic / Science<br />
Community.<br />
<span id="more-162"></span><br />
I attended public school through the 5th Grade  then and did very well.  I<br />
was placed in the &#8220;Gifted and Talented&#8221; program in 4th Grade and maintained<br />
advanced placement in Math through 5th Grade.  I earned a coveted &#8220;Student<br />
of the Year&#8221; Award for my participation in extracurricular activities and my<br />
high grades in the most advanced classes.</p>
<p>In 6th Grade, I was accepted into a Private Catholic School.  I was a good<br />
student for the rest of my Middle and High School careers, but not<br />
exceptional.  In grade school, I had asked and received answers to my<br />
toughest questions.  In Middle and High School, the questions became<br />
increasingly complex and more subversive to the Dogma.  My questions were<br />
discouraged, or worse punished, and I fell out of love with school.</p>
<p>In 10th Grade, I took my first &#8220;Biology&#8221; Class.  Biology in quotes because<br />
this was a Catholic High School.  We learned about cells, cell structures,<br />
dissected disgusting owl pellets, and covered Evolution.  It wasn&#8217;t really<br />
emphasized, and questions about it&#8217;s conflict with the Bible were glossed<br />
over by the generic &#8220;Helping Hand&#8221; Argument.  For an aspiring Devotee to<br />
Catholicism and Diligent Seeker of the Truth, this idea seemed amazingly<br />
beautiful and perfect.</p>
<p>There needs to be a distinction here between &#8220;Helping Hand&#8221; and &#8220;Intelligent<br />
Design.&#8221;  Intelligent Design is uneducated rubbish.  Had ID been<br />
presented to me at age 14, I would&#8217;ve laughed it straight out of the<br />
classroom.  ID looks at Life Forms and finds intricate, beautiful pieces of<br />
those organisms that seem unlikely to have arisen from pure, unadulterated<br />
random chance.  The eye and the Bombardier Beetle are prime examples of ID&#8217;s<br />
misinformation.</p>
<p>The convincing &#8220;Helping Hand&#8221; argument irresponsibly pitched to me by a<br />
well-meaning Biology Teacher essentially stated &#8220;God started the<br />
evolutionary process and made sure that the correct random mutations were<br />
selected for by shaping the environment in which our evolutionary ancestors<br />
arose.&#8221;  The fact that the ID Camp has not latched onto this concept<br />
demonstrates just how astoundingly stupid they are.  As a political idea,<br />
this &#8220;Helping Hand&#8221; argument appears to be a harmless means for religion to<br />
reconcile it&#8217;s Dark Age, Anti-Intellectual Dogma to modern science&#8217;s most<br />
powerful ideas.</p>
<p>So, why is this idea dangerous, idiotic, and offensive?  It&#8217;s simple.  The<br />
&#8220;Helping Hand&#8221; concept is irresponsible because it&#8217;s not necessary.  More<br />
than unnecessary, it exposes dangerous flaws in the Religion itself.<br />
Consider that religions consider God to be a fairly &#8220;Perfect&#8221; being.  Often<br />
God receives All-Knowing, All-Powerful, Ever Present status.  If that&#8217;s the<br />
case, then the &#8220;Helping Hand&#8221; argument serves only to expose God as an<br />
incompetent hack.</p>
<p>If there were intelligence behind the Evolutionary Process we should be able<br />
to see it in Humans.  After all, we are created in His image?  That doesn&#8217;t<br />
appear to be the case.  As products of Evolution, you and I are scarcely<br />
prepared to exist in the Modern World.  Our tongues sense Salt, a necessary<br />
mineral to help us maintain our overwhelmingly liquid existence.  We crave<br />
sugars, some of the most efficient mechanisms for transferring energy.  We<br />
sense bitterness, because in our evolutionary past bitterness often<br />
indicated poisons.  We crave savoriness because the protein of meat has<br />
encouraged the rapid, outpacing expansion of our brain.  We also taste and<br />
sense sourness, which identify acidic compounds necessary to maintain the<br />
alkalinity of the body.</p>
<p>All of these evolutionary processes served our ancestors incredibly well.<br />
They are indispensable in the shaping of Homo Sapiens.  This might seem<br />
neutral in our &#8220;Helping Hand&#8221; vs Natural Selection argument.  But, that&#8217;s<br />
not the case.  These cravings served us well in the past, but how are they<br />
affecting us these days?  Imagine this process was aided by an All-Knowing,<br />
All-Powerful Creator, targeting the emergence of Homo Sapiens as he zapped<br />
Reptiles and Bacteria from a cloud, patiently paving the road for us.  The<br />
Hands guiding us to where we were in 1 CE.</p>
<p>And then what?  These very simple and basic taste sensations that were<br />
necessary for a caloric scarce existence in the past, are literally killing<br />
us en masse in our Caloric Rich &#8220;Industrialized&#8221; existence today.  Has He<br />
stopped paying attention?  Did He get bored?  Hello, is this thing on?</p>
<p>By inserting the &#8220;Helping Hand&#8221; idea into Evolutionary Biology, theologians<br />
have created far more serious problems than they answered.  Taste is but one<br />
small, fairly simple demonstration of this fallacy.  Consider the #1 killer<br />
in America, Heart Disease.  The problem is compounded by our taste for<br />
calorie rich food, but that is overshadowed by the catastrophic design<br />
failure of the magnificent Human Heart.  If there was someone nudging<br />
evolution, who could see the future, surely they saw this problem coming.<br />
Back then, it would&#8217;ve been trivial to correct.  I&#8217;m not a Cardiologist, or<br />
Evolutionary Biologist.  I&#8217;m a Software Developer and System Administrator,<br />
so I&#8217;ll have to invoke one of the first design problems I was taught in my<br />
limited schooling: Single Point of Failure.   The Human Heart has 1 Major<br />
Artery into, and out of the Heart.</p>
<p>If I were designing, or nudging the process of Human Evolution, as an<br />
imperfect, under-educated, simplistic, narrow-minded Human Being, I&#8217;d say<br />
&#8220;maybe we should have some redundancy in such a critical element!&#8221;  Surely,<br />
that adaptation could be demonstrated to be benevolent and useful.  Surely<br />
it would exhibit the foresight of some intelligent being edging towards a<br />
perfect being.</p>
<p>The lack of foresight in such an obvious and enormous problem as Heart<br />
Disease, is Yet Another demonstration of the logical fallacies committed by<br />
the most well-meaning religious people.  It doesn&#8217;t need to be there.  It<br />
doesn&#8217;t answer any questions, it only creates more questions.  Science can<br />
only deal with questions that can be answered.  The &#8220;Unmoved Mover,&#8221;<br />
&#8220;Creationism,&#8221; &#8220;Intelligent Design,&#8221; and &#8220;Helping Hand&#8221; in-dignify the<br />
amazing brilliance of Human understanding, creativity, and intelligence.</p>
<p>If you&#8217;re reading this, and you&#8217;ve reconciled your faith with science in the<br />
same way I did in High School with this ludicrous idea of &#8220;Helping Hand&#8221;<br />
evolution, please stop deluding yourself, your neighbors, your friends, and<br />
most importantly your children.  You may think you&#8217;re helping, but you&#8217;re<br />
not.  The fact is, you&#8217;re lying and deceiving everyone.</p>
]]></content:encoded>
			<wfw:commentRss>http://divisionbyzero.net/blog/2010/03/08/the-unofficial-doctrine-of-helping-hand-evolution/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Perl on Twitter</title>
		<link>http://divisionbyzero.net/blog/2009/09/17/perl-on-twitter/</link>
		<comments>http://divisionbyzero.net/blog/2009/09/17/perl-on-twitter/#comments</comments>
		<pubDate>Thu, 17 Sep 2009 16:20:13 +0000</pubDate>
		<dc:creator>brad</dc:creator>
				<category><![CDATA[Note]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[web2.0]]></category>

		<guid isPermaLink="false">http://divisionbyzero.net/blog/?p=158</guid>
		<description><![CDATA[As a result of YAPC::NA 10, I was inspired to get more involved in Social Media.  The idea is to promote and learn about new technologies through Social Media while injecting a sane, intelligent under current of Modern Perl.
I finally started to use my Twitter account. I&#8217;ve noticed the majority of tweets regarding Perl [...]]]></description>
			<content:encoded><![CDATA[<p>As a result of <a href="http://yapc10.org/yn2009/">YAPC::NA 10</a>, I was inspired to <a href="http://ironman.enlightenedperl.org/">get more involved in Social Media</a>.  The idea is to promote and learn about new technologies through Social Media while injecting a sane, intelligent under current of Modern Perl.</p>
<p>I finally started to use <a href="http://twitter.com/reyjrar">my Twitter account</a>. I&#8217;ve noticed the majority of tweets regarding Perl refer to it as torturous or antiquated or both.  These tweets are not coming from the Perl echo-chamber of <a href="http://www.perlmonks.org/">Perl Monks</a>, <a href="http://www.pm.org/">Perl Mongers</a>, and <a href="http://www.yapc.org/">Perl Conference</a> attendees, but from programmers exposed to Perl against their will.  This leaves a bad taste in their mouth, and when they hear &#8220;Perl,&#8221; their frame of reference is sadly the Matt&#8217;s Scripts Era of Perl Development.</p>
<p>I&#8217;m using <a href="http://tweetdeck.com/beta/">TweetDeck</a>, and I&#8217;ve created a search column for &#8220;perl.&#8221;  It gets a decent amount of traffic everyday.  I don&#8217;t have the time to respond to or even read every tweet about Perl, but I skim them maybe 4 or 5 times a day to find people with Perl problems or Perl frustration and point them in a better direction.  If you&#8217;re comfortable providing this type of assistance, I&#8217;d recommend TweetDeck with the &#8220;perl&#8221; Search Column as an interesting way to proselytize for Perl.  It does mean you&#8217;ll be subjected to the occasional teen ranting about &#8220;Perl Jam,&#8221; and of course you&#8217;ll likely writhe in agony at the number of times you see Perl referred to as &#8220;PERL.&#8221;  But if enough of the echo chamber is inundating the Twitterverse with intelligent, modern Perl advice, we might gain even more traction in the Social Media arena.</p>
<p>If you do tweet about Perl, follow <a href="http://hashtags.org/">HashTags</a> and tag your tweet with &#8220;<a href="http://hashtags.org/tag/perl/messages">#perl</a>&#8220;.</p>
<p>Just a thought, as I haven&#8217;t been able to hack in Perl in a few weeks due to other more pressing issues.</p>
]]></content:encoded>
			<wfw:commentRss>http://divisionbyzero.net/blog/2009/09/17/perl-on-twitter/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Vacation and PHP</title>
		<link>http://divisionbyzero.net/blog/2009/07/13/vacation-and-php/</link>
		<comments>http://divisionbyzero.net/blog/2009/07/13/vacation-and-php/#comments</comments>
		<pubDate>Tue, 14 Jul 2009 02:53:40 +0000</pubDate>
		<dc:creator>brad</dc:creator>
				<category><![CDATA[Rant]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[perl5]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://divisionbyzero.net/blog/?p=153</guid>
		<description><![CDATA[I took a much needed vacation the latter part of last week.  Prior to that, I was helping a few coworkers with getting PHP Web Applications developed on Fedora Core 5 to run on CentOS 5 with upgraded PHP, Apache, and libraries.  Every time I work with PHP, it gives me serious perspective [...]]]></description>
			<content:encoded><![CDATA[<p>I took a much needed vacation the latter part of last week.  Prior to that, I was helping a few coworkers with getting PHP Web Applications developed on Fedora Core 5 to run on CentOS 5 with upgraded PHP, Apache, and libraries.  Every time I work with PHP, it gives me serious perspective as to why the <a href="http://www.modernperlbooks.com" alt="Modern Perl">Modern Perl</a> / <a href="http://www.enlightenedperl.org">Enlightened Perl</a> / <a href="http://search.cpan.org/~mschwern/perl5i-20090424/lib/perl5i.pm">perl5i</a> Projects are incredibly important.  The Matt&#8217;s Scripts Perl era needs to die.  This stagnant snapshot has poisoned Perl&#8217;s reputation for too long.</p>
<p>The main difference between Perl and PHP, is writing maintainable, intelligent Perl is only slightly more work <em>at first</em> than writing horrible Matt&#8217;s Scripts style Perl.  With PHP, writing decent PHP is possible, but it&#8217;s incredibly difficult.  The majority of the PHP I&#8217;ve come across is code written by a web developer with no programming experience and the language design and direction accommodate that demographic.  PHP&#8217;s language design gets in the way of writing sane, maintainable code.  It&#8217;s not impossible, but you have to really, really want it.</p>
<p>When you write good Perl, the programming experience becomes easier, and more fun.</p>
<p>I&#8217;m trying to get back to my programming projects, and thus back to writing more on Perl.  For now, understand that if you think Perl and PHP are the same beast, you&#8217;re wrong.  I&#8217;ve been paid to develop both for periods of years.  Perl is much more eloquent, evolutionary, and intelligent.</p>
]]></content:encoded>
			<wfw:commentRss>http://divisionbyzero.net/blog/2009/07/13/vacation-and-php/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Using POE to hook syslog-ng</title>
		<link>http://divisionbyzero.net/blog/2009/07/02/using-poe-to-hook-syslog-ng/</link>
		<comments>http://divisionbyzero.net/blog/2009/07/02/using-poe-to-hook-syslog-ng/#comments</comments>
		<pubDate>Thu, 02 Jul 2009 23:21:13 +0000</pubDate>
		<dc:creator>brad</dc:creator>
				<category><![CDATA[Article]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[perl5]]></category>
		<category><![CDATA[poe]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[syslog]]></category>
		<category><![CDATA[syslog-ng]]></category>

		<guid isPermaLink="false">http://divisionbyzero.net/blog/?p=121</guid>
		<description><![CDATA[A massively code heavy post on integrating syslog into in house applications using syslog-ng and Perl's amazing POE Event Framework to do really crazy things!]]></description>
			<content:encoded><![CDATA[<p>Being able to do analysis, sorting, or database storage of syslog messages is incredibly useful.  There are tons of solutions on the market to do just that.  If you&#8217;re working on a system developed in house that you&#8217;d like to incorporate syslog messages into, then it may be easier to hook directly into the syslog stream than to introduce another piece of software into the environment which needs to be glued.</p>
<p>Syslog-ng facilitates easy integration with Perl binaries as the Perl program is spawned once during the daemon start up and a handle to that program&#8217;s STDIN is maintained for dispatching of messages.  Using POE, we can turn this into an event driven model, making additional complexity simple.</p>
<p>In this example, we&#8217;ll create a POE Master session that receives all of the syslog-ng input from STDIN.  Using off the shelf components, we&#8217;ll run a TCP Server on port 9514 that will allow clients to connect and subscribe to feeds based on the &#8220;program&#8221; name of the message being dispatched.<br />
<span id="more-121"></span><br />
Anytime I&#8217;m using Regular Expressions over and over, I like to &#8220;precook&#8221; them.  This compiles the regular expression, and lets the engine skip that step each time they&#8217;re used.  Doing so is simply a matter of declaring the regex with the <code>qr//</code> operator:</p>
<pre class="brush: perl;">
my %cooked = (
	program =&gt; qr/\s+\d+:\d+:\d+\s+\S+\s+([^:\s]+)(:|\s)/,
);
</pre>
<h2>Initialization</h2>
<p>Next we&#8217;ll create the administrative session in charge of dispatching the messages to the proper channels:</p>
<pre class="brush: perl;">
# Dispatcher Master Session
POE::Session-&gt;create(
	inline_states =&gt; {
		_start					=&gt; \&amp;dispatcher_start,
		_stop					=&gt; sub { print &quot;SESSION &quot;, $_[SESSION]-&gt;ID, &quot; stopped.\n&quot;; },
		register_client			=&gt; \&amp;register_client,
		subscribe_client		=&gt; \&amp;subscribe_client,
		hangup_client			=&gt; \&amp;hangup_client,

		dispatch_message		=&gt; \&amp;dispatch_message,
	},
);
</pre>
<p>We&#8217;ll define those subroutines shortly, but we need to setup the rest of our sessions.  Next, we&#8217;ll need a TCP Server to handle the client connections, we can get that using <code>POE::Component::Server::TCP</code>:</p>
<pre class="brush: perl;">
# TCP Session Master
POE::Component::Server::TCP-&gt;new(
		Alias		=&gt; 'server',
		Address		=&gt; '127.0.0.1',
		Port		=&gt; 9514,

		ClientConnected		=&gt; \&amp;client_connect,
		ClientInput			=&gt; \&amp;client_input,

		ClientDisconnected	=&gt; \&amp;client_term,
		ClientError			=&gt; \&amp;client_term,

		InlineStates		=&gt; {
			client_print		=&gt; \&amp;client_print,
		},
);
</pre>
<p>The final session will handle the Input on STDIN from syslog-ng:</p>
<pre class="brush: perl;">
# Syslog-ng Stream Master
POE::Session-&gt;create(
		inline_states =&gt; {
			_start		=&gt; \&amp;stream_start,
			_stop		=&gt; sub { print &quot;SESSION &quot;, $_[SESSION]-&gt;ID, &quot; stopped.\n&quot;; },
			stream_line		=&gt; \&amp;stream_line,
		},
);
</pre>
<p>Now we have to define the subroutines that we&#8217;ll be dispatching events to.  The heavy lifting is done by POE, and we&#8217;re left to handle simple things.</p>
<h1>Session Routines: <code>dispatcher</code></h1>
<p>This session is going to managing which clients receive which messages.  The actual input is handled by the <code>stream</code> session, and the sending of the messages to the client by the <code>server</code> session.  As we have a raw <code>POE::Session</code>, our first subroutine <code>dispatcher_start</code> is just going to do some basic preparation:</p>
<pre class="brush: perl;">
sub dispatcher_start {
	my ($kernel, $heap) = @_[KERNEL, HEAP];

	$kernel-&gt;alias_set( 'dispatcher' );  # allow named dispatch to this session.

	$heap-&gt;{subscribers} = {};
        $heap-&gt;{clients} = {};

}
</pre>
<p>Next event to be handled is the <i>register_client</i> event which is fired anytime a connection is established to the <code>server</code> session.  All the dispatcher does is register it&#8217;s session_id into an internal heap.  Nothing happens with it, but if we needed to send a message to all clients, we could loop over this hash and broadcast message.</p>
<pre class="brush: perl;">
sub register_client {
    # ARG0 =&gt; TCP Client Session ID
    my ($kernel,$heap,$sid) = @_[KERNEL,HEAP,ARG0];

    $heap-&gt;{clients}{$sid} = 1;
}
</pre>
<p>Clients can subscribe to a program name, which they do by entering &#8220;<code>sub dhcpd, dnsmasq</code>&#8221; into the TCP Server.  It&#8217;s not fancy, but man is it convenient for debugging and development purposes.  The <code>server</code> session determines that the subscription is occurring and passes it&#8217;s argument string to the <code>dispatcher</code> session via the <i>subscribe_client</i> event.  This subroutine is called:</p>
<pre class="brush: perl;">
sub subscribe_client {
    # ARG0 =&gt; SID of Client
    # ARG1 =&gt; Argument String of the subscribe
	my ($kernel,$heap,$sid,$argstr) = @_[KERNEL,HEAP,ARG0,ARG1];

    # Split the input at commas or spaces into words:
	my @progs = map { lc } split /[\s,]+/, $argstr;
    # Add the SID to the list of Subscribed Clients for that program
	foreach my $prog (@progs) {
		$heap-&gt;{subscribers}{$prog}{$sid} = 1;
	}

    # Inform the client they've subscribed via client_print
	$kernel-&gt;post( $sid =&gt; 'client_print' =&gt; 'Subscribed to : ' . join(', ', @progs ) );
}
</pre>
<p>If a client disconnects, we remove it from the message dispatching hash:</p>
<pre class="brush: perl;">
sub hangup_client {
    # ARG0 =&gt; SID of Client Disconnecting
	my ($kernel,$heap,$sid) = @_[KERNEL,HEAP,ARG0];

	delete $heap-&gt;{clients}{$sid};

	foreach my $p ( keys %{ $heap-&gt;{subscribers} } ) {
		delete $heap-&gt;{subscribers}{$p}{$sid}
			if exists $heap-&gt;{subscribers}{$p}{$sid};
	}
}
</pre>
<p>Now comes the most important event the dispatcher handles, <i>dispatch_message</i>.  In this event, we have a message from syslog-ng that needs to go to interested parties.  This event determines the &#8220;program&#8221; and it&#8217;s subscribers and sends that message along appropriately:</p>
<pre class="brush: perl; highlight: [14];">
sub dispatch_message {
    # ARG0 =&gt; The raw message from syslog-ng
	my ($kernel,$heap,$msg) = @_[KERNEL,HEAP,ARG0];

    # Determine the program name
	if( my ($program) = map { lc } ($msg =~ /$cooked{program}/) ) {
		# remove the sub process and PID from the program
		$program =~ s/\(.*//g;
		$program =~ s/\[.*//g;

        # If we have subscribers, send them the message.
		if( exists $heap-&gt;{subscribers}{$program} ) {
			foreach my $sid (keys %{ $heap-&gt;{subscribers}{$program} }) {
				$kernel-&gt;post( $sid =&gt; 'client_print' =&gt; $msg );
			}
		}
}
</pre>
<p>You'll notice on line 14 above, the <code>post( $sid => client_print => $msg )</code> sends the event to the appropriate client and calls the <i>client_print</i> event on itself.  This is all the dispatcher needs to do.  The rest is handled by other other sessions.</p>
<h1>Session Routines: <code>server</code></h1>
<p>This session accepts new tcp clients and handles writing to the sockets.  We'll take a look at a few subroutines here.  Fist we'll look at the <i>ClientConnect</i> event.</p>
<pre class="brush: perl;">
sub client_connect {
    # SESSION is the client's session object
	my ($kernel,$heap,$ses) = @_[KERNEL,HEAP,SESSION];

	my $SID = $ses-&gt;ID;

    # Register the Client with the Dispatcher
	$kernel-&gt;post( 'dispatcher' =&gt; 'register_client' =&gt; $SID );

    # Store the current entry for 'client' in the heap so we can communicate later
	$heap-&gt;{clients}{ $SID } = $heap-&gt;{client};

	# Say hello to the client.
	$heap-&gt;{client}-&gt;put( &quot;Hello Client: $SID&quot; );
}
</pre>
<p>We also need a <i>disconnect</i> event:</p>
<pre class="brush: perl;">
sub client_term {
	my ($kernel,$heap,$ses) = @_[KERNEL,HEAP,SESSION];
	my $sid = $ses-&gt;ID;

    # Delete the Client's Dispatch Table
	delete $heap-&gt;{dispatch}{$sid};
    # Tell the dispatcher session we're through
	$kernel-&gt;post( 'dispatcher' =&gt; 'hangup_client' =&gt;  $sid );
}
</pre>
<p>Next we&#8217;ll handle sending message to the client, which is incredibly easy:</p>
<pre class="brush: perl;">
sub client_print {
    # ARG0 =&gt; Message to Send to the Client
	my ($kernel,$heap,$ses,$mesg) = @_[KERNEL,HEAP,SESSION,ARG0];

	$heap-&gt;{clients}{$ses-&gt;ID}-&gt;put($mesg);
}
</pre>
<p>Now we a routine to handle the <i>ClientInput</i> event.  This event will take commands from the clients and do something with them.  We&#8217;ll use an internal dispatch table in the form of a hash to handle translating commands.  This will allow us to expand our API if we need to.</p>
<pre class="brush: perl; highlight: [12,13,14,15,34,36];">
sub client_input {
    # SESSION is the Client Session Object with input
    # ARG0 =&gt; Input waiting from that client
	my ($kernel,$heap,$ses,$msg) = @_[KERNEL,HEAP,SESSION,ARG0];
	my $sid = $ses-&gt;ID;

    # Build a Dispatch Table if one does not exists in the heap for this entry.
	if( !exists $heap-&gt;{dispatch}{$sid} ) {
		$heap-&gt;{dispatch}{$sid} = {

			subscribe		=&gt; {
				re			=&gt; qr/^sub(?:scribe)? (.*)/,
				callback	=&gt; sub {
					$kernel-&gt;post( 'dispatcher' =&gt; 'subscribe_client' =&gt; $sid, shift );
				},
			},
            # FUTURE API for Clients receiving every message!
			#fullfeed		=&gt; {
			#	re			=&gt; qr/^(fullfeed)/,
			#	callback	=&gt; sub {
			#		$kernel-&gt;post( 'dispatcher' =&gt; 'fullfeed_client' =&gt; $sid );
			#	},
			#},
		};
	}

	#
	# Check for messages:
	my $handled = 0;
    # Get Our Dispatch Table
	my $dispatch = $heap-&gt;{dispatch}{$sid};
    # Look up and take action according to our dispatch table
	foreach my $evt ( keys %{ $dispatch } ) {
		if( my($args) = ($msg =~ /$dispatch-&gt;{$evt}{re}/)) {
			$handled = 1;
			$dispatch-&gt;{$evt}{callback}-&gt;($args);
			last;
		}
	}

    # Inform the client that their command was not understood.
	if( !$handled ) {
		$kernel-&gt;post( $sid =&gt; 'client_print' =&gt; 'UNKNOWN COMMAND, Ignored.' );
	}
}
</pre>
<p>That&#8217;s the most complicated routine in the program, but it does allow us to morph the dispatch tables for individual clients.  Lines 12-15 build a dispatch table entry with the regular expression to match the command, followed by a callback subroutine reference which handles the command.  Lines 34 and 36 are where these rules are applied to the input from the client.</p>
<h1>Session Routines: <code>stream</code></h1>
<p>The last session is very simple.  This session maintains the connection to STDIN from syslog-ng and dispatches those lines as events to the <code>dispatcher</code> session.  There is a startup routine:</p>
<pre class="brush: perl;">
sub stream_start {
	my ($kernel, $heap) = @_[KERNEL, HEAP];

	$kernel-&gt;alias_set( 'stream' );

	#
	# Initialize the connection to STDIN as a POE::Wheel
	my $stdin = IO::Handle-&gt;new_from_fd( \*STDIN, 'r' );
	my $stderr = IO::Handle-&gt;new_from_fd( \*STDERR, 'w' );

	$heap-&gt;{stream} = POE::Wheel::ReadWrite-&gt;new(
		InputHandle		=&gt; $stdin,
		OutputHandle	=&gt; $stderr,
		InputEvent		=&gt; 'stream_line',
	);
}
</pre>
<p>And the <i>stream_line</i> event which sends the incoming syslog messages to the <code>dispatcher</code> session for processing:</p>
<pre class="brush: perl;">
#--------------------------------------------------------------------------#
sub stream_line {
    # ARG0 =&gt; Line from STDIN, New line delimited.
	my ($kernel,$msg) = @_[KERNEL,ARG0];

	return unless length $msg;

	$kernel-&gt;post( 'dispatcher' =&gt; 'dispatch_message' =&gt; $msg );

}
</pre>
<h1>Setting it up with syslog-ng</h1>
<p>If we store our POE program in <code>/usr/local/bin/poe-syslog-ng.pl</code>, in the syslog-ng.conf we need to specify it as a program:</p>
<pre class="brush: plain;">
#
# Subscriber Feeds
destination d_subscribers {
	program(&quot;/usr/local/bin/poe-syslog-ng.pl&quot;);
};
</pre>
<p>Then you can feed it based on filters, just like the rest of the <code>destination</code> macros in syslog-ng:</p>
<pre class="brush: plain;">
#
# SUBSCRIPTION SERVICE:
log { source(s_ext); source(s_udp); filter(f_database); destination(d_subscribers); };
</pre>
<h1>The whole #! </h1>
<p>For those interested, I&#8217;ve written a program that expands this example with enhanced functionality.  The full source is available here:</p>
<pre class="brush: perl; collapse: true; light: false; toolbar: true;">
#!/usr/bin/perl
#
# This is the POE Master Server.
#  1) Take all the syslog input
#  2) Listen for parsers
#  3) Filter streams to parsers
#  TODO: 4) Maintain Parser State, restarting on crash

use strict;
use warnings;

use Socket;
use Regexp::Common qw(net);

sub POE::Kernel::ASSERT_DEFAULT (){ 1 }
#sub POE::Kernel::TRACE_DEFAULT (){ 1 }
use POE qw(
	Wheel::ReadWrite
	Component::Server::TCP
);

my %cooked = (
	program =&gt; qr/\s+\d+:\d+:\d+\s+\S+\s+([^:\s]+)(:|\s)/,
);

#--------------------------------------------------------------------------#
# POE Session Initialization

# Dispatcher Master Session
POE::Session-&gt;create(
	inline_states =&gt; {
		_start					=&gt; \&amp;dispatcher_start,
		_stop					=&gt; sub { print &quot;SESSION &quot;, $_[SESSION]-&gt;ID, &quot; stopped.\n&quot;; },
		register_client			=&gt; \&amp;register_client,
		subscribe_client		=&gt; \&amp;subscribe_client,
		unsubscribe_client		=&gt; \&amp;unsubscribe_client,
		fullfeed_client			=&gt; \&amp;fullfeed_client,
		dispatch_message		=&gt; \&amp;dispatch_message,
		broadcast				=&gt; \&amp;broadcast,
		hangup_client			=&gt; \&amp;hangup_client,
		server_shutdown			=&gt; \&amp;server_shutdown,
		debug_client			=&gt; \&amp;debug_client,
		nobug_client			=&gt; \&amp;nobug_client,
		debug_message			=&gt; \&amp;debug_message,
	},
);

# TCP Session Master
POE::Component::Server::TCP-&gt;new(
		Alias		=&gt; 'server',
		Address		=&gt; '127.0.0.1',
		Port		=&gt; 9514,

		ClientConnected		=&gt; \&amp;client_connect,
		ClientInput			=&gt; \&amp;client_input,

		ClientDisconnected	=&gt; \&amp;client_term,
		ClientError			=&gt; \&amp;client_term,

		InlineStates		=&gt; {
			client_print		=&gt; \&amp;client_print,
		},
);

# Syslog-ng Stream Master
POE::Session-&gt;create(
		inline_states =&gt; {
			_start		=&gt; \&amp;stream_start,
			_stop		=&gt; sub { print &quot;SESSION &quot;, $_[SESSION]-&gt;ID, &quot; stopped.\n&quot;; },

			stream_line		=&gt; \&amp;stream_line,
			stream_error	=&gt; \&amp;stream_error,
		},
);

#--------------------------------------------------------------------------#

#--------------------------------------------------------------------------#
# POE Main Loop
POE::Kernel-&gt;run();
exit 0;
#--------------------------------------------------------------------------#

#--------------------------------------------------------------------------#
# POE Event Functions
#--------------------------------------------------------------------------#

#--------------------------------------------------------------------------#
sub debug {
	my $msg = shift;
	chomp($msg);
	$poe_kernel-&gt;post( 'dispatcher' =&gt; 'debug_message' =&gt; $msg );
	print &quot;[debug] $msg\n&quot;;
}
#--------------------------------------------------------------------------#
sub dispatcher_start {
	my ($kernel, $heap) = @_[KERNEL, HEAP];

	$kernel-&gt;alias_set( 'dispatcher' );

	$heap-&gt;{subscribers} = { };
	$heap-&gt;{full} = { };
	$heap-&gt;{debug} = { };
}

#--------------------------------------------------------------------------#
sub register_client {
	my ($kernel,$heap,$sid) = @_[KERNEL,HEAP,ARG0];

	$heap-&gt;{clients}{$sid} = 1;
}

#--------------------------------------------------------------------------#
sub debug_client {
	my ($kernel,$heap,$sid) = @_[KERNEL,HEAP,ARG0];

	if( exists $heap-&gt;{full}{$sid} ) {  return;  }

	$heap-&gt;{debug}{$sid} = 1;
	$kernel-&gt;post( $sid =&gt; 'client_print' =&gt; 'Debugging enabled.' );
}

#--------------------------------------------------------------------------#
sub nobug_client {
	my ($kernel,$heap,$sid) = @_[KERNEL,HEAP,ARG0];

	delete $heap-&gt;{debug}{$sid}
		if exists $heap-&gt;{debug}{$sid};
	$kernel-&gt;post( $sid =&gt; 'client_print' =&gt; 'Debugging disabled.' );
}

#--------------------------------------------------------------------------#
sub fullfeed_client {
	my ($kernel,$heap,$sid) = @_[KERNEL,HEAP,ARG0];

	#
	# Remove from normal subscribers.
	foreach my $prog (keys %{ $heap-&gt;{subscribers} }) {
		delete $heap-&gt;{subscribers}{$prog}{$sid}
			if exists $heap-&gt;{subscribers}{$prog}{$sid};
	}

	#
	# Turn off DEBUG
	if( exists $heap-&gt;{debug}{$sid} ) {
		delete $heap-&gt;{debug}{$sid};
	}

	#
	# Add to fullfeed:
	$heap-&gt;{full}{$sid} = 1;

	$kernel-&gt;post( $sid =&gt; 'client_print' =&gt; 'Full feed enabled, all other functions disabled.');
}

#--------------------------------------------------------------------------#
sub subscribe_client {
	my ($kernel,$heap,$sid,$argstr) = @_[KERNEL,HEAP,ARG0,ARG1];

	if( exists $heap-&gt;{full}{$sid} ) {  return;  }

	my @progs = map { lc } split /[\s,]+/, $argstr;
	foreach my $prog (@progs) {
		$heap-&gt;{subscribers}{$prog}{$sid} = 1;
	}

	$kernel-&gt;post( $sid =&gt; 'client_print' =&gt; 'Subscribed to : ' . join(', ', @progs ) );
}
#--------------------------------------------------------------------------#
sub unsubscribe_client {
	my ($kernel,$heap,$sid,$argstr) = @_[KERNEL,HEAP,ARG0,ARG1];

	my @progs = map { lc } split /[\s,]+/, $argstr;
	foreach my $prog (@progs) {
		delete $heap-&gt;{subscribers}{$prog}{$sid};
	}

	$kernel-&gt;post( $sid =&gt; 'client_print' =&gt; 'Subscription removed for : ' . join(', ', @progs ) );
}

#--------------------------------------------------------------------------#
sub hangup_client {
	my ($kernel,$heap,$sid) = @_[KERNEL,HEAP,ARG0];

	delete $heap-&gt;{clients}{$sid};

	foreach my $p ( keys %{ $heap-&gt;{subscribers} } ) {
		delete $heap-&gt;{subscribers}{$p}{$sid}
			if exists $heap-&gt;{subscribers}{$p}{$sid};
	}

	if( exists $heap-&gt;{debug}{$sid} ) {
		delete $heap-&gt;{debug}{$sid};
	}

	if( exists $heap-&gt;{full}{$sid} ) {
		delete $heap-&gt;{full}{$sid};
	}

	debug(&quot;Client Termination Posted: $sid\n&quot;);

}

#--------------------------------------------------------------------------#
sub stream_start {
	my ($kernel, $heap) = @_[KERNEL, HEAP];

	$kernel-&gt;alias_set( 'stream' );

	#
	# Initialize the connection to STDIN as a POE::Wheel
	my $stdin = IO::Handle-&gt;new_from_fd( \*STDIN, 'r' );
	my $stderr = IO::Handle-&gt;new_from_fd( \*STDERR, 'w' );

	$heap-&gt;{stream} = POE::Wheel::ReadWrite-&gt;new(
		InputHandle		=&gt; $stdin,
		OutputHandle	=&gt; $stderr,
		InputEvent		=&gt; 'stream_line',
		ErrorEvent		=&gt; 'stream_error',
	);
}

#--------------------------------------------------------------------------#
sub stream_line {
	my ($kernel,$msg) = @_[KERNEL,ARG0];

	return unless length $msg;

	$kernel-&gt;post( 'dispatcher' =&gt; 'dispatch_message' =&gt; $msg );

}

#--------------------------------------------------------------------------#
sub stream_error {
	my ($kernel) = $_[KERNEL];

	debug(&quot;STREAM ERROR!!!!!!!!!!\n&quot;);
	$kernel-&gt;call( 'dispatcher' =&gt; 'server_shutdown' =&gt; 'Stream lost' );
}

#--------------------------------------------------------------------------#
sub server_shutdown {
	my ($kernel,$heap,$msg) = @_[KERNEL,HEAP,ARG0];

	$kernel-&gt;call( dispatcher =&gt; 'broadcast' =&gt; 'SERVER DISCONNECTING: ' . $msg );
	$kernel-&gt;call( 'server' =&gt; 'shutdown' );
	exit;
}

#--------------------------------------------------------------------------#
sub client_connect {
	my ($kernel,$heap,$ses) = @_[KERNEL,HEAP,SESSION];

	my $KID = $kernel-&gt;ID();
	my $CID = $heap-&gt;{client}-&gt;ID;
	my $SID = $ses-&gt;ID;

	$kernel-&gt;post( 'dispatcher' =&gt; 'register_client' =&gt; $SID );

	$heap-&gt;{clients}{ $SID } = $heap-&gt;{client};
	#
	# Say hello to the client.
	$heap-&gt;{client}-&gt;put( &quot;EHLO Streamer (KERNEL: $KID:$SID)&quot; );
}

#--------------------------------------------------------------------------#
sub client_print {
	my ($kernel,$heap,$ses,$mesg) = @_[KERNEL,HEAP,SESSION,ARG0];

	$heap-&gt;{clients}{$ses-&gt;ID}-&gt;put($mesg);
}

#--------------------------------------------------------------------------#
sub broadcast {
	my ($kernel,$heap,$msg) = @_[KERNEL,HEAP,ARG0];

	foreach my $sid (keys %{ $heap-&gt;{clients} }) {
		$kernel-&gt;post( $sid =&gt; 'client_print' =&gt; $msg );
	}
}
#--------------------------------------------------------------------------#
sub dispatch_message {
	my ($kernel,$heap,$msg) = @_[KERNEL,HEAP,ARG0];

	foreach my $sid ( keys %{ $heap-&gt;{full} } ) {
		$kernel-&gt;post( $sid =&gt; 'client_print' =&gt; $msg );
	}

	if( my ($program) = map { lc } ($msg =~ /$cooked{program}/) ) {
		# remove the sub process and PID from the program
		$program =~ s/\(.*//g;
		$program =~ s/\[.*//g;

		debug(&quot;DISPATCHING MESSAGE [$program]&quot;);

		if( exists $heap-&gt;{subscribers}{$program} ) {
			foreach my $sid (keys %{ $heap-&gt;{subscribers}{$program} }) {
				$kernel-&gt;post( $sid =&gt; 'client_print' =&gt; $msg );
			}
		}
		else {
			debug(&quot;Message discarded, no listeners.&quot;);
		}
	}
	else {
			debug(&quot;Message discarded, format not understood.&quot;);
	}
}

#--------------------------------------------------------------------------#
sub debug_message {
	my ($kernel,$heap,$msg) = @_[KERNEL,HEAP,ARG0];

	foreach my $sid (keys %{ $heap-&gt;{debug} }) {
		$kernel-&gt;post( $sid =&gt; 'client_print' =&gt; '[debug] ' . $msg );
	}
}

#--------------------------------------------------------------------------#
sub client_input {
	my ($kernel,$heap,$ses,$msg) = @_[KERNEL,HEAP,SESSION,ARG0];
	my $sid = $ses-&gt;ID;

	if( !exists $heap-&gt;{dispatch}{$sid} ) {
		$heap-&gt;{dispatch}{$sid} = {
			fullfeed		=&gt; {
				re			=&gt; qr/^(fullfeed)/,
				callback	=&gt; sub {
					$kernel-&gt;post( 'dispatcher' =&gt; 'fullfeed_client' =&gt; $sid );
				},
			},
			subscribe		=&gt; {
				re			=&gt; qr/^sub(?:scribe)? (.*)/,
				callback	=&gt; sub {
					$kernel-&gt;post( 'dispatcher' =&gt; 'subscribe_client' =&gt; $sid, shift );
				},
			},
			unsubscribe 	=&gt; {
				re			=&gt; qr/^unsub(?:scribe)? (.*)/,
				callback	=&gt; sub {
					$kernel-&gt;post( 'dispatcher' =&gt; 'unsubscribe_client' =&gt; $sid, shift );
				},
			},
			debug 	=&gt; {
				re			=&gt; qr/^(debug)/i,
				callback	=&gt; sub {
					$kernel-&gt;post( 'dispatcher' =&gt; 'debug_client' =&gt; $sid, shift );
				},
			},
			nobug 	=&gt; {
				re			=&gt; qr/^(no(de)?bug)/i,
				callback	=&gt; sub {
					$kernel-&gt;post( 'dispatcher' =&gt; 'nobug_client' =&gt; $sid, shift );
				},
			},
			#quit			=&gt; {
			#	re			=&gt; qr/(exit)|q(uit)?/,
			#	callback	=&gt; sub {
			#			$kernel-&gt;post( $sid =&gt; 'client_print' =&gt; 'Terminating connection on your request.');
			#			$kernel-&gt;post( $sid =&gt; 'shutdown' );
			#	},
			#},
			#status			=&gt; {
			#	re			=&gt; qr/^status/,
			#	callback	=&gt; sub {
			#		my $cnt = scalar( keys %{ $heap-&gt;{clients} } );
			#		my $subcnt = scalar( keys %{ $heap-&gt;{subscribers} });
			#		my $msg = &quot;Currently $cnt connections, $subcnt subscribed.&quot;;
			#		$kernel-&gt;post( $sid, 'client_print', $msg );
			#	},
			#},
		};
	}

	#
	# Check for messages:
	my $handled = 0;
	my $dispatch = $heap-&gt;{dispatch}{$sid};
	foreach my $evt ( keys %{ $dispatch } ) {
		if( my($args) = ($msg =~ /$dispatch-&gt;{$evt}{re}/)) {
			$handled = 1;
			$dispatch-&gt;{$evt}{callback}-&gt;($args);
			last;
		}
	}

	if( !$handled ) {
		$kernel-&gt;post( $sid =&gt; 'client_print' =&gt; 'UNKNOWN COMMAND, Ignored.' );
	}
}

#--------------------------------------------------------------------------#
sub client_term {
	my ($kernel,$heap,$ses) = @_[KERNEL,HEAP,SESSION];
	my $sid = $ses-&gt;ID;

	delete $heap-&gt;{dispatch}{$sid};
	$kernel-&gt;post( 'dispatcher' =&gt; 'hangup_client' =&gt;  $sid );

	debug(&quot;SERVER, client $sid disconnected.\n&quot;);
}

#--------------------------------------------------------------------------#
</pre>
]]></content:encoded>
			<wfw:commentRss>http://divisionbyzero.net/blog/2009/07/02/using-poe-to-hook-syslog-ng/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>YAPC::NA 10th Anniversary Wrap Up Post</title>
		<link>http://divisionbyzero.net/blog/2009/06/26/yapcna-10th-anniversary-wrap-up-post/</link>
		<comments>http://divisionbyzero.net/blog/2009/06/26/yapcna-10th-anniversary-wrap-up-post/#comments</comments>
		<pubDate>Fri, 26 Jun 2009 18:11:38 +0000</pubDate>
		<dc:creator>brad</dc:creator>
				<category><![CDATA[Article]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[yapc]]></category>
		<category><![CDATA[yapc10]]></category>

		<guid isPermaLink="false">http://divisionbyzero.net/blog/?p=117</guid>
		<description><![CDATA[I got back from YAPC::NA #10 yesterday.  There was a lot of sleeping required to recover from a tech conference with 8 am talks!  A Twitter Search for &#8220;yapc&#8221; indicates I&#8217;m not the only one slow to recover those missing hours of sleep.
Overall the conference was a fantastic success.  There were highs [...]]]></description>
			<content:encoded><![CDATA[<p>I got back from <a href="http://yapc10.org/" alt="YAPC::NA 10">YAPC::NA #10</a> yesterday.  There was a lot of sleeping required to recover from a tech conference with 8 am talks!  A <a href="http://twitter.com/#search?q=yapc" alt="twitter search yapc">Twitter Search for &#8220;yapc&#8221;</a> indicates I&#8217;m not the only one slow to recover those missing hours of sleep.</p>
<p>Overall the conference was a fantastic success.  There were highs and lows, and I just wanted to take an opportunity to thank the conference organizers!! They did a wonderful job putting together another spectacular conference.</p>
<p>Also wanted to thank all the speakers as I know firsthand how much work goes into presenting at a conference like YAPC.  All the talks I attended were great, however several stood out as exceptional:</p>
<ul>
<li><a href="http://yapc10.org/yn2009/talk/1960" alt="Trapped in a Room with Schwern">Trapped in a Room with Schwern</a> &#8211; Michael Schwern is an excellent speaker, and this free room talk with back and forth between him and members of the community at all levels of mastery provided insight into projects I was unaware of, as well as some relief that most of my concerns about Perl 5 were being discussed by people far smarter than myself.</li>
<li><a href="http://yapc10.org/yn2009/talk/1975" alt="The Future of DBIx::Class">The Future of DBIx::Class</a> &#8211; Matt S Trout (MST) is a speaker for the real programmers.  His volume, accent, and excessive use of profanity actually keep people listening.  Getting yelled at by Matt Trout was the highlight of this conference for me.  He has good ideas and opinions and he&#8217;s not afraid to beat them into your head.  Kid gloving is great for Managers, but his presentation style and content really clicks with the people who don&#8217;t have their heads so far up their own asses to understand things need to change.  Excellent talk about the past, present, and future of DBIx::Class which is the most significant ORM in the Perl Community currently.</li>
<li><a href="http://yapc10.org/yn2009/talk/1983" alt="Take Advantage of Modern Perl">Take Advantage of Modern Perl</a> &#8211; chromatic&#8217;s speaking style is the complete opposite of MST&#8217;s, but his message synced with Schwern, MST, and the <a href="http://enlightenedperl.org" alt="The Enlightened Perl Organisation">The Enlightened Perl Organisation</a>: Encourage people to write better Perl.  Write Better Perl.  Teach others how to write better Perl.  Embrace the language where it is now, and transition away from the bad things in the past.  Fantastic Talk.</li>
<li><a href="http://yapc10.org/yn2009/talk/2155" alt="perl5i: Perl 5 Imporved">perl5i: Perl 5 Improved</a> &#8211; Michael Schwern echoing chromatic&#8217;s plea for leveraging the best of what Perl 5 offers today.  He&#8217;s got a module on cpan, <a href="http://github.com/schwern/perl5i/tree/master" alt="perl5i @ github">perl5i</a>, which implements the best of Perl 5 Tribal Knowledge.</li>
<li><a href="http://yapc10.org/yn2009/talk/1978" alt="Catching an ::Std">Catching an ::Std</a> &#8211; MST again.  He very honestly covered the trials, tribulations, and evolution of &#8220;Best Practices&#8221; in the Perl community.</li>
<li><a href="http://yapc10.org/yn2009/talk/2012" alt="CGI::Inspect">Drop in REPL for CGI Applications</a> &#8211; Brock Wilcox floored everyone demonstrating his ridiculously cool module <a href="http://search.cpan.org/~awwaiid/CGI-Inspect-0.4/">CGI::Inspect</a>.  I went in expecting &#8220;neat&#8221; and found &#8220;amazing.&#8221;  We&#8217;ll be abusing this in development very soon.</li>
</ul>
<p>These were my favorite talks, but like I said, every talk I went to was fantastic.  I did miss a few talks I wanted to see due to schedule conflicts, but I&#8217;ll be checking the YAPC website for slides and video/audio.  The conference organizers were not able to record anything, but a few attendees brought recording equipment with them.  If nothing else, I&#8217;ll hopefully see those missed talks next year or at the <a href="http://pghpw.org/">Pittsburgh Perl Workshop</a> in 2010!</p>
<p>I&#8217;m recommitting to the Perl Iron Man.  I was an idiot and jackass for bailing after 1 post! :)</p>
]]></content:encoded>
			<wfw:commentRss>http://divisionbyzero.net/blog/2009/06/26/yapcna-10th-anniversary-wrap-up-post/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Perl Iron Man Contest</title>
		<link>http://divisionbyzero.net/blog/2009/04/22/perl-iron-man-contest/</link>
		<comments>http://divisionbyzero.net/blog/2009/04/22/perl-iron-man-contest/#comments</comments>
		<pubDate>Wed, 22 Apr 2009 21:20:14 +0000</pubDate>
		<dc:creator>brad</dc:creator>
				<category><![CDATA[Note]]></category>
		<category><![CDATA[catalyst]]></category>
		<category><![CDATA[dbix::class]]></category>
		<category><![CDATA[mst]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[poe]]></category>

		<guid isPermaLink="false">http://divisionbyzero.net/blog/?p=102</guid>
		<description><![CDATA[Matthew S Trout has started a Perl Iron Man challenge to encourage Perl users to become active in the blogosphere.  Not many people outside of the Perl echo chamber realize how active and modern the language.  A lot of the concepts that trampolined Ruby and Python into the forefront of Web 2.0 have been alive [...]]]></description>
			<content:encoded><![CDATA[<p><a title="MST's Iron Man Challenge" href="http://www.shadowcat.co.uk/blog/matt-s-trout/iron-man/" target="_blank">Matthew S Trout has started a Perl Iron Man challenge</a> to encourage Perl users to become active in the blogosphere.  Not many people outside of the Perl echo chamber realize how active and modern the language.  A lot of the concepts that trampolined Ruby and Python into the forefront of Web 2.0 have been alive and well in the Perl community for a long time.  With the advent of Moose, Perl5 is as serious an Object Oriented language as Python and Ruby.</p>
<p>I entered myself today.  The goal is blog about Perl atleast once a week.  As I&#8217;m splitting my development time between a Catalyst Project and a number of POE projects, I expect my posts to be along those lines.  I&#8217;ll eventually share my DBIx::Class scripts as well.  There should be something for everyone, especially @strcpy!  (He loves my Perl blogging).</p>
<p>Look for code related stuff early next week!</p>
]]></content:encoded>
			<wfw:commentRss>http://divisionbyzero.net/blog/2009/04/22/perl-iron-man-contest/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Perl is Dead</title>
		<link>http://divisionbyzero.net/blog/2009/04/05/perl-is-dead/</link>
		<comments>http://divisionbyzero.net/blog/2009/04/05/perl-is-dead/#comments</comments>
		<pubDate>Mon, 06 Apr 2009 00:49:47 +0000</pubDate>
		<dc:creator>brad</dc:creator>
				<category><![CDATA[Article]]></category>
		<category><![CDATA[catalyst]]></category>
		<category><![CDATA[dbix::class]]></category>
		<category><![CDATA[mason]]></category>
		<category><![CDATA[moose]]></category>
		<category><![CDATA[oop]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[perl::critic]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://divisionbyzero.net/blog/?p=94</guid>
		<description><![CDATA[I&#8217;ve been doing web application development for years in several languages.  I&#8217;ve spent time with PHP, Java, but primarily Perl.  I consider myself a &#8220;Perl Programmer&#8221; first, everything else second.  Until recently, most people would equate that to &#8220;Dinosaur.&#8221;  However, there&#8217;s been a revival of Perl these days!  There are [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been doing web application development for years in several languages.  I&#8217;ve spent time with PHP, Java, but primarily Perl.  I consider myself a &#8220;Perl Programmer&#8221; first, everything else second.  Until recently, most people would equate that to &#8220;Dinosaur.&#8221;  However, there&#8217;s been a revival of Perl these days!  There are <a title="Movable Type, Open Source" href="http://www.movabletype.org/" target="_blank">a</a> <a title="Enlightened Perl Org" href="http://www.enlightenedperl.org/">number</a> <a title="The Perl Foundation" href="http://www.perlfoundation.org/">of</a> <a title="Perl Sphere" href="http://perlsphere.net/" target="_blank">reasons</a> <a title="Perl Buzz" href="http://perlbuzz.com/" target="_blank">for</a> <a title="Modern Perl" href="http://www.modernperlbooks.com/mt/index.html" target="_blank">this</a>.</p>
<p><span id="more-94"></span></p>
<p>It all started with the concept of &#8220;Inside Out Objects&#8221; as a safe, functional object development methodology.  From there a number of modules sprouted attempting to do Inside-Out better.   Around this time, the Perl 6 <a title="Perl 6 Apocalypses" href="http://dev.perl.org/perl6/doc/apocalypse.html" target="_blank">Apocalypses</a> were being published and translated in Conway&#8217;s <a title="Perl 6 Exegeses" href="http://dev.perl.org/perl6/doc/exegesis.html" target="_blank">Exegeses</a>.  Conway  published &#8220;<a title="Perl Best Practices" href="http://oreilly.com/catalog/9780596001735/" target="_blank">Perl Best Practices</a>&#8221; and very soon after, <a title="Perl::Critic @ The CPAN" href="http://search.cpan.org/~elliotjs/Perl-Critic-1.096/" target="_blank">Perl::Critic</a> showed up on the <a title="The CPAN" href="http://www.cpan.org" target="_blank">CPAN</a> to enforce the rules laid out in the book.  Perl::Critic became a critical authority on the most maintainable way to write Perl code.  TIMTOWTDI will never die, but clean, maintainable code does outweigh some stranger interpreter abuses.</p>
<p>The modern looking object system for Perl 6 made it debut, and instantly the Army of CPAN began figuring out clever ways to implement fancy object notation in Perl 5.  his eventually led to the development of Class::MOP, from which the &#8220;post Modern Object System for Perl 5,&#8221; Moose, blossomed.</p>
<p>Concurrently, Ruby on Rails had layed waste to the entire scope of PHP Scaffolding systems in existence, building off the Model-View-Controller (MVC) Ideology implemented earlier in Perl 5 through Maypole.  As RoR gained traction, Python&#8217;s Django framework, through it&#8217;s association with the MVC philosophy, began to see serious deployment.  This made sense as a lot of large Open Source and Commercial companies were using Python for much of their behind the scenes development.  The result left PHP staggering and dizzy in the corner.</p>
<p>Unfortunately, there was a horrible association of PHP to Perl in most people&#8217;s heads, which sounded the Death Knell for Perl as well.  This wasn&#8217;t the case, as Perl, inside it&#8217;s mostly impenetrable Echo Chamber had not stagnated at all.  Perl 5.8.x was a huge performance and syntactical modernization of Perl 5.  This improvement was eclipsed with the release of 5.10, drawing from the Perl 6 Design Documents, and the push of the Echo Chamber for a more Modern Language.</p>
<p>The Army of CPAN was still hard at work in the background throughout all of this.  ORM&#8217;s drawing on the Success of the MVC philosophy took shape and evolved.  Rose::DB, Class::DBI, and the current forerunner DBIx::Class simplified database development through the use of abstraction through modules like SQL::Abstract.  Maypole, an simplified, earlier implementation of MVC sparked other MVC efforts in Perl 5, the most popular of which are Catalyst, Jifty, and CGI::Application.  Each have their strengths and weaknesses.</p>
<p>All of these modules are beginning to converge to create a beautiful, post modern web application development platform in pure Perl.  Additionally, projects like Strawberry Perl, and Padre are aiming to expand Perl&#8217;s reach into realms it&#8217;s shied away from: Windows &amp; IDEs.  The future is bright for Perl thanks to efforts of countless volunteers and programmers.</p>
<p>Perl is dead.  Long live Perl.</p>
]]></content:encoded>
			<wfw:commentRss>http://divisionbyzero.net/blog/2009/04/05/perl-is-dead/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>From cfEngine to Puppet:  A retrospective</title>
		<link>http://divisionbyzero.net/blog/2009/01/18/from-cfengine-to-puppet-a-retrospective/</link>
		<comments>http://divisionbyzero.net/blog/2009/01/18/from-cfengine-to-puppet-a-retrospective/#comments</comments>
		<pubDate>Mon, 19 Jan 2009 02:06:57 +0000</pubDate>
		<dc:creator>brad</dc:creator>
				<category><![CDATA[Article]]></category>
		<category><![CDATA[cfengine]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[puppet]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://divisionbyzero.net/blog/?p=74</guid>
		<description><![CDATA[For several years I&#8217;ve managed to bend cfEngine 2.0&#8217;s architecture to my will.  Being an experienced Perl programmer, I was able to abuse the configuration language snytax in order to accomplish a number of strange things including Copy Back and automated management of OSSEC-HIDS.  However, there comes a point when the managing the cfengine configs [...]]]></description>
			<content:encoded><![CDATA[<p>For several years I&#8217;ve managed to bend <a href="http://www.cfengine.org/" target="_blank">cfEngine</a> 2.0&#8217;s architecture to my will.  Being an experienced Perl programmer, I was able to abuse the configuration language snytax in order to accomplish a number of strange things including <a href="http://divisionbyzero.net/blog/2007/05/03/copy-back-with-cfengine/" target="_blank">Copy Back</a> and <a href="http://www.ossec.net/wiki/index.php/Integration_%26_Deployment_with_cfengine">automated management of</a><a href="http://www.ossec.net/" target="_blank"> OSSEC-HIDS</a>.  However, there comes a point when the managing the cfengine configs becomes a burdensome and incredibly unmanageable.   I mean, sure, I know what they do.  How will any of my co-workers understand them?</p>
<p>After several colleagues recommending <a href="http://puppet.reductivelabs.com">Puppet</a>, I hesitantly began the slow, brain fscking process of:</p>
<ol>
<li>Understanding exactly what I had accomplished with cfEngine.</li>
<li>Understanding Ruby (ugh, I&#8217;m so thankful for Perl)</li>
<li>Understanding how to express my cfengine feelings in a way Puppet will understand without hurting it&#8217;s feelings</li>
<li>&#8230;</li>
<li>Profit.</li>
</ol>
<p><span id="more-74"></span>cfEngine makes some things incredibly easy to manage.  Nearly every command allows you to &#8220;define&#8221; new classes based on various conditions.  This allows to modify a configuration file, and then tell the daemon associated with that config file to restart.  However, when I needed to do something highly specialized, I had to create a shell script, copy the shell script to the server and then run the shell script.  Passing data back to do something was possible, though it seemed a bit hacky.  It separated the customized actions being performed from the dependent actions in the cfEngine configs.  If I had to go back later and make changes, I had to look at both the .cf file and the custom shell script in a completely different directory.</p>
<p>With Puppet, these things can be done relatively simply inside the same class file.  Also, Puppet can be extended simply through the use of defines (think macros) or complexly through the use of modules.  Additionally, Puppet supports templating, classes, inheritance, and explicit order.  Where with cfengine I&#8217;d have to do something like this:</p>
<pre style="padding-left: 30px; ">copy:
  s_snmpd.dc_has_snmp::
     $(distribute)/snmpd.conf	dest=/etc/snmp/snmpd.conf mode=644</pre>
<pre style="padding-left: 30px; ">				server=$(policyhost)
				type=sum
				define=dc_restart_snmpd</pre>
<pre style="padding-left: 30px; ">shellcommands:
   s_snmpd.dc_restart_snmpd::
	"/sbin/service snmpd restart"</pre>
<div>Utilizing the intermediary &#8220;dc_restart_snmpd&#8221; class.   With Puppet I can explicitly define the relationship with the config file and service:</div>
<pre>
<div style="padding-left: 30px; ">class ssh {</div>
<div style="padding-left: 30px; ">    package {</div>
<div style="padding-left: 30px; ">        [ "openssh-clients", "openssh-server" ]:</div>
<div style="padding-left: 30px; ">        ensure =&gt; latest</div>
<div style="padding-left: 30px; ">    }</div>
<div style="padding-left: 30px; ">    file { "/etc/ssh/sshd_config":
        mode  =&gt; 0600,
        owner =&gt; root,
        group =&gt; root,
        mode =&gt; 644,
        require =&gt; Package["openssh-server"],
        content =&gt; template("sshd_config.erb")
    }</div>
<div style="padding-left: 30px; ">    service { sshd:
        subscribe =&gt; File["/etc/ssh/sshd_config"],
        ensure    =&gt; running,
        enable    =&gt; true
    }
}</div>

 </pre>
<p>With this syntax it&#8217;s easy to read that the file /etc/ssh/sshd_config is dependent on the openssh-server package and that the sshd service is dependent on that file.  Puppet also feels more &#8220;cross-platform&#8221; as the &#8220;service&#8221; directive allows me to abstractly describe the service without having to hard code a call to /sbin/service.</p>
<p>Puppet is not without it&#8217;s drawbacks.  The first of which is that it is Ruby.  If you&#8217;re not using Ruby on your systems, this means more package installations on those servers.  If you&#8217;ve been programming in another language, like Perl or Python, it&#8217;s another language you have to fight with.  The memory usage is much higher than I expected.  On some virtual servers, this may be a huge drawback. Consider:</p>
<div id="attachment_85" class="wp-caption alignnone" style="width: 312px"><img class="size-full wp-image-85 " title="puppetmasterd" src="http://divisionbyzero.net/blog/wp-content/uploads/2009/01/puppetmasterd.png" alt="puppetmasterd" width="302" height="209" /><p class="wp-caption-text">Memory usage for puppetmasterd</p></div>
<p>Not too bad, but this is shocking:</p>
<div id="attachment_84" class="wp-caption alignnone" style="width: 312px"><img class="size-full wp-image-84 " title="puppetd" src="http://divisionbyzero.net/blog/wp-content/uploads/2009/01/puppetd.png" alt="Memory Usage at 300 MB prior to restart" width="302" height="209" /><p class="wp-caption-text">Memory Usage at ~250 MB prior to restart</p></div>
<p>Compare this to cfegine:</p>
<p> </p>
<div id="attachment_82" class="wp-caption alignnone" style="width: 311px"><img class="size-full wp-image-82 " title="cfservd" src="http://divisionbyzero.net/blog/wp-content/uploads/2009/01/cfservd.png" alt="Memory Usage for cfservd, Yes, Memory Leak." width="301" height="208" /><p class="wp-caption-text">Memory Usage for cfservd, Yes, Memory Leak.</p></div>
<p>and:</p>
<div id="attachment_81" class="wp-caption alignnone" style="width: 312px"><img class="size-full wp-image-81 " title="cfexed" src="http://divisionbyzero.net/blog/wp-content/uploads/2009/01/cfexed.png" alt="Memory Usage for cfexecd" width="302" height="210" /><p class="wp-caption-text">Memory Usage for cfexecd</p></div>
<p>Hell, even a long running Perl program using POE and Net::Pcap to decode all packets on our uplink at work (which bursts to ~75mb/sec) isn&#8217;t using that much memory:</p>
<div id="attachment_83" class="wp-caption alignnone" style="width: 313px"><img class="size-full wp-image-83 " title="perl-poe" src="http://divisionbyzero.net/blog/wp-content/uploads/2009/01/perl-poe.png" alt="Memory Usage for PoCo::Pcap based Traffic Inspector" width="303" height="208" /><p class="wp-caption-text">Memory Usage for PoCo::Pcap based Traffic Inspector</p></div>
<p>Ultimately, RAM is cheap and my time is expensive.  After kludging together configuration management in cfengine for the past three years, I&#8217;ve decided to ditch it in favor of a more sane and extensible configuration with Puppet.  I&#8217;ve got a lot to learn about Puppet still, so as I learn new and more exciting things and Puppet grows, I&#8217;ll be sure to share how it&#8217;s helping.</p>
]]></content:encoded>
			<wfw:commentRss>http://divisionbyzero.net/blog/2009/01/18/from-cfengine-to-puppet-a-retrospective/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Pittsburgh Perl Workshop 2008</title>
		<link>http://divisionbyzero.net/blog/2008/10/15/pittsburgh-perl-workshop-2008/</link>
		<comments>http://divisionbyzero.net/blog/2008/10/15/pittsburgh-perl-workshop-2008/#comments</comments>
		<pubDate>Thu, 16 Oct 2008 01:31:32 +0000</pubDate>
		<dc:creator>brad</dc:creator>
				<category><![CDATA[Talks]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[ppw]]></category>
		<category><![CDATA[ppw2008]]></category>

		<guid isPermaLink="false">http://divisionbyzero.net/blog/?p=54</guid>
		<description><![CDATA[I had the pleasure of speaking at the 2008 Pittsburgh Perl Workshop.  Due to some rather depressing news on the home front, I was only able to attend Saturday&#8217;s track and the Event Dinner.  Everything was awesome as usual.  I was even surprised to learn new things in the Advanced Pattern Matching [...]]]></description>
			<content:encoded><![CDATA[<p>I had the pleasure of speaking at the <a href="http://pghpw.org/ppw2008/">2008 Pittsburgh Perl Workshop</a>.  Due to some rather depressing news on the home front, I was only able to attend <a href="http://pghpw.org/ppw2008/schedule?day=2008-10-11">Saturday&#8217;s track</a> and the Event Dinner.  Everything was awesome as usual.  I was even surprised to learn new things in the <a href="http://pghpw.org/ppw2008/talk/1505">Advanced Pattern Matching</a> talk.</p>
<p>My talk was titled <a href="http://divisionbyzero.net/PGHPW08.pdf">Network Introspection with Open Source Tools</a> and was an overhaul of the presentation that I did at LinuxWorld earlier this year.  I took the feedback of the audience and tuned the talk to a Perl centric audience.  I wasn&#8217;t heckled badly on IRC, which is the ultimate gauge of success.</p>
<p>I&#8217;d like to thank the organizers, <a href="http://cmu.edu">CMU</a>, sponsors, and The Perl Foundation for another successful year of the Work Shop.  Next year, Pittsburgh is hosting YAPC::NA, and will not be hosting the Pittsburgh Perl Workshop.  I look forward to being able to drive to YAPC!</p>
<p>If you saw the talk and want to rant about it, feel free to do so here.</p>
]]></content:encoded>
			<wfw:commentRss>http://divisionbyzero.net/blog/2008/10/15/pittsburgh-perl-workshop-2008/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Domestic Security</title>
		<link>http://divisionbyzero.net/blog/2008/09/12/domestic-security/</link>
		<comments>http://divisionbyzero.net/blog/2008/09/12/domestic-security/#comments</comments>
		<pubDate>Fri, 12 Sep 2008 19:58:08 +0000</pubDate>
		<dc:creator>brad</dc:creator>
				<category><![CDATA[Rant]]></category>
		<category><![CDATA[security hypocrisy]]></category>

		<guid isPermaLink="false">http://divisionbyzero.net/blog/?p=49</guid>
		<description><![CDATA[Just a little comic to remind ourselves what we&#8217;re giving away for &#8220;Security.&#8221;  This is not what our founding fathers had in mind.  I&#8217;m disappointed in the US Government and it&#8217;s people.
]]></description>
			<content:encoded><![CDATA[<p><div id="attachment_50" class="wp-caption alignnone" style="width: 310px"><a href="http://www.claybennett.com/pages/domestic_security.html"><img src="http://divisionbyzero.net/blog/wp-content/uploads/2008/09/security-300x212.jpg" alt="Domestic Security" title="security" width="300" height="212" class="size-medium wp-image-50" /></a><p class="wp-caption-text">Domestic Security</p></div><br />
Just a little comic to remind ourselves what we&#8217;re giving away for &#8220;Security.&#8221;  This is not what our founding fathers had in mind.  I&#8217;m disappointed in the US Government and it&#8217;s people.</p>
]]></content:encoded>
			<wfw:commentRss>http://divisionbyzero.net/blog/2008/09/12/domestic-security/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.948 seconds -->
<!-- Cached page generated by WP-Super-Cache on 2010-03-11 21:59:16 -->
