Four new Perl modules released to CPAN

Four new Perl modules released to CPAN
I’m pleased to announce the recent release of four (4) shiny new Perl modules to CPANString::Pictureformat, Date::Fmtstr2time, Date::Time2fmtstr, and JDBIx (pronounced “Jaydeebix”).  All four either are or are derived from existing work I’ve done and have been using over the years, but had just never gotten around to fully documenting and testing them to get them in a condition fit for “prime time” release for public consumption.  This included creating proper documentation and test harnesses for each.  The first three modules involve string manipulation functions based on a formatting “mask” string.  JDBIx is a higher-level database manipulation module that makes short work of fetching, inserting, and updating vectors of data by providing a higher level interface to Perl’s fine all-purpose DBI (Database Interface) module.  This has kept me very busy of late documenting, creating test harnesses that satisify the CPAN Testers, fixing a few bugs that affected parts that I rarely used, and even adding a few new features to polish ’em up a bit.  It’s been rather entertaining for me going through some of this “old” code that I wrote years ago.  Some of it is over fifteen years old!  Fortunately for me, I apparently wrote fairly good code then, or at least have gradually cleaned some of it up and documented in fits and starts over the years as I needed it for new jobs and clients along the way.  Anyway, I finally decided to clean ’em all up and make them public (via CPAN), with the side benefit to me of being able to easily install them on new systems via CPAN’s installer the same way most other modules are installed.
This started out as a simple project to get String::Pictureformat to better format dates when using Sql*Perl Plus, another (now massive) “Swiss Army knife” tool I wrote nearly twenty years ago and repeatedly expanded to include new features for various clients and jobs I’ve had over the years.  I decided to get String::Pictureformat cleaned up, and added new date/time handling capabilities and make it public.  However, for dates, it needed two other older functions I had written for DBD::Sprite years ago which were not modular.  So, I decided to make modules out of those two functions, leading to Date::Fmtstr2time and Date::Time2fmtstr!  Now I was on a roll, so I then decided to clean up JDBIx too.  So, what started out as a small project has morphed into a huge undertaking and has taken over a month to complete.
The problem I’ve discovered over the course of the last month or so doing this is a trap that it’s rather easy as a Perl programmer to fall into that’s to some degree related to the Perl philosophy of “there are many ways to do something”.  Wnen I started out writing a module years ago, I would write it to do “this” (a specific thing).  Whilst coding, I’d realize that it was extremely easy to also make it do “this” and “that” too.  I would immediately deploy the module (tool) so I could do “this” regularly and very efficiently.  I’ve continued using the module to do “this” and occasionally “that” over the years without fuss.  A new client would come along and I’d realize that it could and should easily do “the other thing” too.  Sometimes I was fairly good at including decent comments in the code, and even added POD documentation to help me remember the tricky parts.  Now as I attempt to document all the functions and their options, I discover that the module not only does “this”, “that”, and “the other thing”, but I also had coded it to do “this”, “this”, “this”, and “even this” too, but these other rarely or ever used features also contain a few bugs.  As you can see, this made the documentation and testing work much more complicated and time consuming!  Fortunately, the end result is worth it as now I have a module that does this, this, this, even this, that, and the other thing well, is documented for easy lookup, is easily installable from anywhere with an internet connection, will play nice with other modules and programs, and is now freely available for others to avail themselves!
Here are the four modules and their abstracts:

  • String::Pictureformat – Functions to format and unformat strings based on a “Picture” (mask) format string.  Provides format and unformat functions that, given a string of data and a special mask string, will return a string formatted / justified / padded / etc. based on the mask string.  It includes the ability to format dollar values with floating dollar signs, decimals, accounting notation, etc.  It also includes the ability to round to a certain decimal place, and now the ability to format dates and times to desired layouts, word or character wrap long sentence strings, etc.  I originally wrote this for producing much more humanly-readable reports via Sql*Perl Plus.
  • Date::Fmtstr2time – Functions to format and unformat date/time strings into a Perl “Time” integer based on a “Picture” format (mask) string.  This was originally written to add the Oracle(tm) “TO_DATE()” function to my DBD::Sprite flat-file Oracle-simulation module.  It is now used (if installed) by String::Pictureformat for format date / time strings into Unix/Perl “Time” integers.
  • Date::Time2fmtstr – Functions to format and unformat Unix/Perl “Time” integers to strings based on a “Picture” format string.  This was originally written to add the Oracle(tm) “TO_CHAR()” function to my DBD::Sprite flat-file Oracle-simulation module.  It is now used (if installed) by String::Pictureformat for format Unix/Perl “time” integers into pretty, humanly-readable formats as desired.
  • JDBIx – Object-oriented higher-level DBI interface for select into arrays, placeholders, sequences, etc.  This began as a package of a few handy functions to make life developing database-driven programs and websites with Perl’s DBI module much simpler and straight forward by providing simple, one-line functions that could do “select” queries into vector arrays corresponding to columns of data in tables, and take similar vectors of data and insert or update database tables accordingly.  Instead of having to do “prepare()”, “execute()”, “bind()”, “fetch()”, cursors, loops, etc.  Single function calls can handle most “select”, “insert”s, “update”s, and “delete”s in database tables!  I called this package “DBIx” (DBI EXtra), but it was non-modular, having originally been written on the job using Perl 4 and “Oraperl” back in the nineties.  JDBIx combined all this into a modular, object-oriented format permitting multiple databases to be opened and manipulated at once.  I’ve been using JDBIx for several years on some of my own projects and websites, but had never documented it’s functions properly.

Running of the Bulls, by (© 2016) me.
"Running of the Bulls", by (© 2016) me.
This has been somewhat easy since that the holidays are over and the weather’s been cold, and I haven’t wanted to venture outside that much lately.  One of the advantages of Texas Winters is that we do get “breaks” every week or so with a nice cool, but pleasant sunny day randomly thrown in every now and then.  I’ve taken advantage of these lately too, going out with a buddy or two and taking some photos!  Last week, we went Northwest up to Wichita Falls, and stopped in Windthorst, Perrin, Archer City, and a few road-side stops in between.  On another day three of us went and took photos at the Fort Worth Stockyards, including the abandoned Swift meat-packing plant, and the “Running of the Bulls” (a daily longhorn cattle-drive down one of downtown Fort Worth’s major streets) for tourists.  This photo at left shows one of the bulls briefly straying off the street onto the sidewalk.  He appears to have a “bulls eye” on me but quickly rejoins the herd.  Probably just bored and wanted to do something a little different!  Please visit my Flickr site these and other photos.

Feel Free to Comment (Name/Email/Website optional):

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: