[DFW.pm] Is Perl Like Shell Script?

Tommy Butler dfwpm at internetalias.net
Fri Oct 25 16:02:09 PDT 2013

If I may opine, using POE for an IRC bot is not overkill.  On the other
hand, a bash-based, netcat-powered IRC bot is a beautiful thing.

This topic brings up some thoughts that might be helpful to some, so I
just got out my soapbox... brace yourselves.

While respecting the fact that you are free to maintain your own reasons
for approaching code in a manner that conflicts with my experience, I'm
going to share my past and present thoughts on the matter in the hope
that someone reading this from the archives someday might avoid the same
pitfalls that tripped me up in my days as a hubris-addled beginner.

The do-everything-myself methodology was my major at the school of hard
knocks for uninformed Perl hackers, graduating class of 1999.  The
painful practice of assembling even basic applications from bare atoms
of matter might work well for a hobbyist with unlimited time and no
clear goals, but in my case it proved to be harmful.  It wasn't
sustainable and didn't scale to any useful level.  I quickly became
unhappy in my work because the approach was deeply flawed.  I had to
mature as a programmer.  Code reuse was a critical step along the path
that I was still stumbling to find.

Ultimately I found that my aversion to wheels-already-invented was
damaging me as a programmer.  I was holding myself back by adhering to
three unfortunately common misconceptions.  Basically, I thought that:

 1. If someone else could do it, I could do it better and faster and
    therefore everything needed to be rewritten by /*me*/ in order to be
    good enough to use in my project
 2. If someone else could do it, it somehow made me inferior until I
    could do the same thing better.  So again, everything needed to be
    rewritten by /*me*/ so that I could be the best wheelwright
 3. The use of code libraries from other programmers, by its very
    nature, was going to make my code run slowly.  They didn't know what
    they were doing.  I did.

Obviously I was younger then, perhaps a bit stupid, and certainly wrong
a lot of things.  Now that I've been using Perl for nearly a decade and
a half, pretty much daily, at some point I started thinking
differently.  May I present three finer points of wisdom I've come to

 1. If someone else can do it, that's super awesome!  We needn't avoid
    participating in the vast pool of freely-available knowledge that we
    find in core Perl libraries and CPAN modules.  Code reuse is a
    virtue.  There's great strength in becoming the beneficiary of
    someone else's good will, genius and hard work.  Most importantly,
    we don't need to reinvent wheels when we could be building warp
    drives instead
 2. If someone else can do it, that doesn't diminish me.  Given enough
    time I know I can come to an intimate understanding of someone
    else's "Wheel.pm" source code, /but unless it's absolutely
    necessary,*I'm happy not to*/.  My warp drive prototype is waiting! 
    Who cares about remaking wheels!
 3. It turns out that using code libraries written by other brilliant
    programmers solves all kinds of speed problems and bottlenecks, and
    it's so easily accomplished in the mere minutes it takes to install
    the libraries with `cpanm`.  Code reuse doesn't introduce hindrances
    as a matter of fact.  It can actually help remove and prevent them.

I was much happier and began to program more effectively when I realized
these things.  It's a /wonderful/ thing to know that reusing good code
libraries from other programmers makes my own code less prone to break
when I rocket it down the runway on wheels that have been tested many,
many more times by many, many more geniuses.  My code is more reliable
and efficient as an intended consequence, and in the end I've actually
produced a dependable application instead of another experimental
wheel.  Just hitch your wagon to /*that*/ warp drive, son.

REUSE!*  Go create jet packs and time machines!  It's way more fun =)

--Tommy Butler

On 10/25/2013 02:01 PM, A.J. Maurin wrote:
> Well BASHing together an IRC bot out of netcat and quick-and-dirty
> oneliners of sed and awk are easy for me, because I'm used to it.
> Anything beyond a quick one-liner of Perl looks daunting to me.
> I dislike using standard libraries. To me, it's learning how to use
> other people's code. Reinventing the wheel my butt.
> On 10/23/2013 12:00 PM, John Fields wrote:
>> Shaun, Net::IRC is deprecated. I KNOW!  Says try Bot::BasicBot
>> Alex, look at this BasicBot page and let us know how difficult it
>> looks!  Not very compared to BASHing it out. :)
>> http://blog.rajatpandit.com/2008/02/25/writing-an-irc-bot/
>> Writing an IRC bot from scratch in the next Monger meeting sounds
>> like fun.  We can review the random password generator code progress
>> too. What say Ye?  (Futurama Bot reference... Hehehe)
>> On Oct 20, 2013 4:53 PM, "A.J. Maurin" <coyo at darkdna.net
>> <mailto:coyo at darkdna.net>> wrote:
>>     ^_^
>>     I'm sad that it isn't every week, but I suppose there's a lot
>>     more that at Dallas Makerspace than Hump Day Mongering.
>>     Yeah, people said I was insane for writing that script, a Bash
>>     shell script IRC bot that used netcat.
>>     My response was "meow." I can't believe I lost that thumbdrive.
>>     On 10/20/2013 11:30 AM, Tommy Butler wrote:
>>         We hold Perl Mongers on the second Wednesday of each month,
>>         so we will meet next on 11/13/13. It generally works out to
>>         be somewhere around the hump day of each month ;-)
>>         The IRC bot script that's being discussed sounds like lots of
>>         fun!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/dfw-pm/attachments/20131025/6e0346dd/attachment.html>

More information about the Dfw-pm mailing list