hide's Journal http://use.perl.org/~hide/journal/ hide's use Perl Journal en-us use Perl; is Copyright 1998-2006, Chris Nandor. Stories, comments, journals, and other submissions posted on use Perl; are Copyright their respective owners. 2012-01-25T02:27:41+00:00 pudge pudge@perl.org Technology hourly 1 1970-01-01T00:00+00:00 hide's Journal http://use.perl.org/images/topics/useperl.gif http://use.perl.org/~hide/journal/ Where have you been? http://use.perl.org/~hide/journal/37285?from=rss <p> I had planned on writing a long entry as to where I've been, and what I've been up to for the last two years, however a cross between Fusion and Ubuntu killed that. So here is the abridged version. </p><p> The project I'd been working on for 3 years, finally received executive approval and funding, but the timeline was extremely tight. A management change brought a lot of finger pointing, and changes to how the department functions. Even though the department was successful for the 9 years prior. </p><p> So I left. Took a new job almost a year ago doing SQL development in a data warehousing, business intelligence, environment. Quite a bit different than the transaction based database work I had been doing. </p><p> What about Perl? Well I haven't done any real Perl work in about a year now. Although I have recently started a new project (more on that to come). </p><p> For some reason, I haven't been receiving emails for my PAUSE account. I was still getting lots of spam, so I didn't think there was anything wrong. Because I wasn't getting any emails, I figured no one was using the modules I wrote. Luckily David Bartle went out of his way to track me down over some issues with CPAN::Mini::Inject (and he supplied patches with tests!). I've now changed the email address that PAUSE uses, and am receiving mail again. brian d foy has since contacted me with an issue he's seen with Test::Output so I know it's really working. </p><p> To help things along, I've moved the repositories for these projects off of my subversion server (that no one seems to know about) onto github. </p><p> The repositories can be found at: </p><p> CPAN::Mini::Inject - <a href="http://github.com/ssoriche/cpan--mini--inject/tree">http://github.com/ssoriche/cpan--mini--inject/tree</a> </p><p> Test::Output - <a href="http://github.com/ssoriche/test-output/tree">http://github.com/ssoriche/test-output/tree</a> </p> hide 2008-08-28T00:41:39+00:00 journal Test::Output 0.10 released. http://use.perl.org/~hide/journal/30328?from=rss <p> There are no test functionality updates in this release. The major change is a migration to <a href="http://search.cpan.org/~rjbs/Sub-Exporter-0.970/lib/Sub/Exporter.pm">Sub::Exporter</a> from Exporter. Allowing for finer control over which tests are imported to your test scripts, and how. </p> hide 2006-07-18T19:35:43+00:00 journal What I learned at YAPC::NA::2006 http://use.perl.org/~hide/journal/30117?from=rss <ul> <li> Do *NOT* fly United Airlines, American is better</li><li> Riding in a Jeep without a roof is amazing</li><li> Once a day, I will spill food on myself</li><li> Hack-A-Thons can be social events and vice versa</li><li> Job recruiters advertise by leaving business cards on urnals</li><li> A $9 buffet is $30 in Chicago</li><li> Perl conferences include JavaScript talks</li><li> Dorms with prison style showers are nicer than prison style dorms</li><li> Limit writing to 300 words</li><li> Open my CPAN module svn repository</li><li> Do not play ping pong against a tall guy</li><li> I can now write my <a href="http://search.cpan.org/~jcap/Acme-Canadian-0.03/lib/Acme/Canadian.pm">Perl in Canadian eh?</a> </li><li> Silent auctions are fun, but a better way of calling out the winners is required</li><li> Returning Larry nets a lot of money</li><li> We need to bring focus to the end user applications created with Perl</li><li> Downtown Chicago is beautiful</li><li> Economy class has no room to open a laptop</li><li> Do *NOT* fly United Airlines</li><li> Getting together with friends and people you "know" to discuss what you all love is amazing.</li></ul><p> Hats off to the Chicago YAPC team. Thanks for a great time. </p> hide 2006-06-30T14:15:17+00:00 journal State of CPAN::Mini::Inject. http://use.perl.org/~hide/journal/29675?from=rss <p> No it's not dead, and neither am I. </p><p> Recently there have been a number of discussions, feature requests, and patches submitted for CPAN::Mini::Inject. I am in the process of consolidating these patches, plus refactoring the whole application. It's going to take a bit to get this all done, but I'll get a developer release out as soon as I can. </p> hide 2006-05-22T21:53:11+00:00 journal YAPC::NA Summary Part 2, Day 2 http://use.perl.org/~hide/journal/25545?from=rss <p> <strong>Day 2</strong> </p><p> I hadn't sleeped well thinking about my presentation (Making the Switch: DBI to Class::DBI). I kept going over what I was going to say, and how. I knew Casey West was giving a talk a little after mine on <em>Beyond the Basics of Class::DBI</em> and I'd hoped there wouldn't be too much overlap. On the way down to breakfast I ran into Casey in the elevator where we briefly discussed our presentations. The good news, there shouldn't be much overlap. </p><p> The morning was spent attending <em>Offline Programmatic Generation of Web Pages</em>, <em>Perl Modules for Exceptions, Logging and Parameter Validation</em>, <em>How to Serve a Billion Requests a Day with Perl</em>, and <em>Using Graph Theory to Detect Security Policy Violators</em>. Each of which was good, and I managed to pick up a couple of things to take away with me. During breaks and talk changes people were coming up to me saying they were looking forward to my talk. I began worrying that my talk was not going to meet their expectations. </p><p> Went to lunch with Trush, Chris Winters (still not knowing his last name), Jim Brandt and Jeff Bisbee at a local food court. This helped to calm my nerves before my presentation, and they provided words of encouragement. </p><p> Next was my presentation. I had some concerns with the amount of time I had (I probably should have asked for more) and the amount of content I had to cover. I had taken this into account though and made my slides in such a way that offline viewing would provide a cookbook of sorts. I also didn't want to come across as "You should switch to Class::DBI because it's *SO* cool". The approach I wanted to take is that of "You've made the decision to switch, here is a little help in doing so". When I started the transition, I couldn't find such a resource. Nervous as hell (this was my first YAPC and my first time presenting to a big crowd), and with a much larger audience than I had expected (a Perl 6 talk was going on in the next room and they seemed to draw the large crowd) I proceeded. Looking down one of my worst nightmares had been realized. That Guy was sitting right in front of the podium causing a bit more panic. I stumbled a couple times, and had a problem with my browser but overall I think my talk went ok, although I know I can do better. </p><p> I have to admit after finishing my presentation, I glossed over during the <em>Perl and DB2</em> talk coming back to for <em>High-Availability &amp; DBI</em>. This was an interesting talk, even with it's focus on MySQL, we were able to use the same principles with PostgreSQL. It was nice to confirm the work that we've been doing, and that other people came to the same solution. </p><p> Final sessions of the day were spent following Casey West who presented <em>Beyond the Basics of Class::DBI</em> and <em>Managing Email with Perl</em>. <em>Beyond the Basics of Class::DBI</em> while featuring the wildly popular Camoose, picked up further down the road from where my talk left off and included a number of useful modules as well as proper warnings. I've been using Email::Simple and Email::Send in work projects for a while now, so I was hoping that <em>Managing Email with Perl</em> would round out my knowledge and it did. </p><p> With the stress of having to do a presentation now leaving me, I was ready to enjoy the boat cruise. While admiring the steam engine on the lower level, Larry approached and said </p><p> "It looks like it could use some refactoring" <br> "Oh, what would you do?" <br> "I don't know but it looks like Perl 4 to me"</p><p> It might be a little off as beer was being consumed but that's the gist of it. </p><p> I also met up with Casey and let him know how much I enjoyed his presentations, and complimented his speaking ability. We discussed my presentation briefly and he relayed to me his experience of giving a Beginning Class::DBI talk at OSCON the previous year. </p><p> The TPF auction was a lot of fun. Unlike OSCON 2004 there were no team bids, services offered for auction, nor auctioning off the auctioneer's shirt (thankfully). The auction consisted of a lot of books. Which was both good and bad. I managed to pick up 3 books and was in a bidding war over a fourth until I backed out. Trush somehow managed to get in a bidding war over <em>Searching for Stupidity</em> and for some reason seemed upset that he lost. </p><p> After the the boat cruise a group of us headed back to C'est What? to have a couple beers. This is where I discovered a fondness for wheat beer. Another very late night. </p><p> I may get to posting about Day 3 but I seem to be taking a lot of time. </p> hide 2005-07-06T15:05:48+00:00 journal YAPC::NA Summary Part 1, Arrival and Day 1 http://use.perl.org/~hide/journal/25477?from=rss <p> I didn't even bother to try to do daily updates from YAPC as others did. I know for a fact that I won't be able to keep up with the schedule. One because it takes me too long to write an entry, but also I was just too busy (which was a really good thing). Instead for ease of the readers I'm going to split the post in two. </p><p> YAPC started off for me with a miscommunication on where the subway runs. Trush thought he would be able to meet me at Fairview Mall, but quickly found out that the new Sheppard line doesn't run from Downsview right across. Then we met at Bay station when we should have met at Bloor so back to Bloor and down Yonge we went. Once we finally figured out where we were going we were fine. </p><p> rjbs called me, and we met up in the lobby of 89 Chestnut and proceeded to the arrival dinner. Of course we got lost and ended up sitting at the table that was last served. No one mentioned that we had to order by writing the number of what we wanted on little pieces of paper. After dinner we pushed rjbs into a cab and took him to the Paramount theatre to see <em>Batman Begins</em> on the IMAX screen. There had been a lot of discussion on the YAPC mailing list as to whether or not it was true IMAX. Who cares. Really big screen, really big sound, really good movie. </p><p> <b>Day 1</b> </p><p> The day started with an opening talk by Richard Dice, a keynote by Larry and the State of the Carrot by Allison. Then to my first session <em>The Testers Toolkit</em>. I picked up a couple of things I hadn't used before and there was mention of Test::WWW::Mechanize, which was really nice to see. </p><p> We went to Spring Rolls for lunch (great Thai food- mmmm cashew chicken) and were joined by Chris Winters. I've been reading his blog for a long time and when I found out he was going to be at YAPC I at least wanted to see who he was. At lunch I only knew his name was Chris and didn't put it together until now. </p><p> After lunch (slightly late) I attended Chromatic and Ian's talk on <em>Solutions to Common Testing Problems</em>. I found the talk quite useful as they mentioned a couple of test modules I hadn't tried, and it was good to see them in action. I'm really looking forward to their upcoming book. Next was a talk on a Perl Mongers group's experience Phalanxing a module. Now that Toronto.pm has finished with YAPC::NA, I'm hoping that we can pick up a module and have a go at it. Listening to the experience of the NY Perl Mongers has me a little concerned however as to whether the updated tests will ever be implemented by the authors. </p><p> The day ended with cog's <em>Perl Black Magic Unleashed Obfuscation and Golfing</em> which was absolutely hilarious. I've added practicing obfuscated code reading to my list of things to do. I can see how it'll help my non-obfuscated coding. </p><p> The CGI::Application crew was having a BOF at a not so local pub. Somehow they were convinced to change the location to a closer pub. Trush and I tagged along and it ended up being our best YAPC decision. While we ended up sitting in the middle of a long table we quickly became the section not discussing CGI::Application but the one concerned with drinking beer. Afterwards the decision was made to return to the hotel and find a spot where we could all meet and continue discussing CGI::Application. The discussions didn't end until after 1am. </p><p> So much for well rested for my presentation. </p> hide 2005-07-02T00:43:12+00:00 journal Test::Output 0.07 http://use.perl.org/~hide/journal/23867?from=rss <p> Last night Schwern dropped in on #perl-qa and we began discussing some changes he&#8217;d like to see to Test::Output. As it turns out one of the things that he was interested in, I&#8217;d already been working on but had gotten stuck. Within a couple of seconds he gave me a working solution, and today it was implemented. </p><p> Directing STDERR to STDOUT using 2&gt;&amp;1 on the command line is quite common, it would be nice if Test::Output could provide the same function. Now it can. </p><p> The following functions have now been added to make this possible: </p><ul> <li>combined_is</li><li>combined_isnt</li><li>combined_like</li><li>combined_unlike</li><li>combined_from</li></ul> hide 2005-03-27T03:20:35+00:00 journal Test::Output 0.05 http://use.perl.org/~hide/journal/23504?from=rss <p> <a href="http://search.cpan.org/~ssoriche/Test-Output/">Test::Output</a> 0.05 has been released (mirrored by CPAN soon). </p><p> The main difference in this version is a patch from chromatic (thank you). His patch fixed a bug where all tests printed error diags even if they passed. Additional tests were added to ensure that no output is sent from diag in successful tests. </p><p> While releasing this version I realized I never wrote anything about version 0.04 which saw some major changes: </p><ul> <li>Added functions: output_like and output_unlike.</li><li>stdout_from, stderr_from, and output_from were removed from @EXPORT and moved to @EXPORT_OK as suggested by Schwern.</li><li>Renamed test &#8220;comment&#8221; to &#8220;description&#8221;.</li><li>Refactoring and additional tests.</li></ul> hide 2005-03-05T00:19:14+00:00 journal Toronto.pm meeting #2. http://use.perl.org/~hide/journal/23393?from=rss <p> Last night I attended my second Toronto Perl Mongers meeting. It was quite enjoyable. lamech gave a talk on his recently released <a href="http://search.cpan.org/~lamech/Class-DBI-DataMigration-0.02/lib/Class/DBI/DataMigration.pm">Class::DBI::DataMigration framework</a>. </p><p> At work we are presently updating a number of our reporting applications. We're taking this opportunity to reorganize our database schemas. As we have a data retention requirement on most of our data, we have to migrate from the old schema to the new. Knowing that I have a lot of data migration ahead of me, I really wanted to see lamech's talk. </p><p> The topic of database migration is quite a heavy topic, that's hard to put into words. Something that lamech pointed out at the beginning of his discussion, but he did a really good job (at least for me). I have a clear picture as to how <a href="http://search.cpan.org/~lamech/Class-DBI-DataMigration-0.02/lib/Class/DBI/DataMigration.pm">Class::DBI::DataMigration</a> works, and how we can use this tool in our upgrade process. </p> hide 2005-02-26T03:22:14+00:00 journal Test::Output 0.03 http://use.perl.org/~hide/journal/23220?from=rss Test::Output 0.03 has just been uploaded to PAUSE. Changes with this release: <ul> <li>Reworked entire POD. Thanks to rjbs for his suggestions.</li><li>Additional POD fixes (date to data thanks to everyone who caught that).</li><li>New methods: stderr_like, stderr_unlike, stdout_like, stdout_unlike</li><li>Updated README from the default one created by Module::Starter.</li><li>Moved private methods _err,_out, and _errandout to stderr_from stdout_from and output_from respectively. Thanks to rjbs for this suggestion.</li></ul> hide 2005-02-16T21:37:07+00:00 journal TO.pm http://use.perl.org/~hide/journal/22935?from=rss <p> Last night I attended my first Toronto Perl Mongers meeting, and it was quite good. I'd wanted to attend for quite some time, but something always seemed to get in the way (mostly finishing our basement). One of the other road blocks is the meetings are held right downtown. I'm not a big fan of going downtown and luckily I have a couple of friends from work who were willing to go. </p><p> Meeting new people isn't one of my strong suits. I tend to become quiet, reserved and not talking to anyone. However going to the meeting gave me a chance to meet lamech, who I've talked to on IRC for the past couple years. We met for dinner before the meeting for Thai food at Spring Rolls. The Tom Yom Goon soup was amazing (and on such a cold day required0 and the Pad Thai was good. </p><p> At the meeting James FitzGibbon gave a talk on Testing the Testers. Having contributed to Test::WWW::Mechanize and using Test::Builder::Tester I had an interest in what he had to say. James did a good job of explaining testing and highlighting the benefits. Unfortunately it didn't appear as though there were many in the audience who had experience writing test code. </p><p> One of things that I got out of his presentation was use of Test::Builder::Tester::Color. On more than one occasion I've had a problem determining what the difference was between my expected output and what the actual output was. </p><p> Another interesting piece of his presentation, that was brought up as a tangent, was the use of Safe. I'd never heard of this module before, and James did a good job of explaining the benefits. I know of a couple of projects that I'm working on where it could be useful. At this point the conversation drifted to thoughts on a meeting devoted to defensive programming. Hopefully it'll happen soon. </p><p> I'm happy I finally got to attend a meeting and am looking forward to the next meeting. </p> hide 2005-01-29T03:06:08+00:00 journal What a day (so far). http://use.perl.org/~hide/journal/22878?from=rss Today I'm preparing to role out a new version of an application I've been working on for the past couple of weeks. This is a bit of legacy code that we use everyday, but required additional functionality. I took this opportunity to begin refactoring, and adding tests. It's a major rewrite, that starts to use modules from CPAN, and modules that I've written rather than one long script. <p> All was fine on my development box, the trouble began when I started to test the application on our production environment. I'd forgotten that this application lives on a box running with the OS installed Perl 5.6.0. </p><p> "No problem compile 5.8.x" you might say. We aren't allowed compilers in production, and I have no test box matching this configuration. "Install a binary", I managed to find one that was approved for use. The application requires XML::Parser (requiring a compiler). Tracked someone down with a compiler, right version of Perl, wrong compiler. </p><p> Back to trying to use 5.6.0. We have a local CPAN::Mini::Inject mirror that we use for our other applications, so this was a natural choice of where to install modules from (plus the application server does not have Internet access). Configured CPAN, try to point it at our local mirror. No luck. We use HTTP access (ftp not being allowed) and LWP had never been installed on this server (no wget, nor ncftp either). </p><p> Copy LWP over by hand, discover it's prerequisites, and do the same for each of those. I'm now stopped by not having a compiler and not having Perl 5.8.x to install an LWP prerequisite. </p><p> I've found someone to compile Perl and the modules that require compiling for me. Hopefully I'll be able to use CPANPLUS to install the rest of the modules and move on. </p> hide 2005-01-25T16:43:08+00:00 journal Testing the exception. http://use.perl.org/~hide/journal/22634?from=rss <p> When writing tests for my modules, my usual method is to create a separate<nobr> <wbr></nobr>.t file for each method within a module. This method does create quite a few<nobr> <wbr></nobr>.t files with generally few tests in each. I don't know whether this is a good or bad method but it's works great for me and the way I develop.<nobr> <wbr></nobr>.t files are created as I need each new method (starting with new), and tested with prove -lv (thanks for the -l Andy). </p><p> I tend to put Carp to good use. croak can be found throughout the modules I write wherever a method requires something (write access to a file, parameters passed, etc). To test that each croak works the way I expect I use Test::Exception's dies_ok. </p><p> In each<nobr> <wbr></nobr>.t file I'd have the following after the tests for proper use: </p><blockquote><div><p> <tt>SKIP: {<br>&nbsp; eval { use Test::Exception };<br>&nbsp; skip 'Test::Exception not installed', 1 if $@;<br> <br>&nbsp; dies_ok { test code here }, 'message';<br>}</tt></p></div> </blockquote><p> Test::Exception is installed on all of my development boxes, and all of our production boxes to ensure full testing before a module gets installed. This caused me not to realize that the above code does not work if you don't have Test::Exception installed. Something I did not notice until I released CPAN::Mini::Inject onto CPAN. </p><p> One of the cpantesters and rjbs brought this to my attention on the Windows platform. I'd thought I'd fixed it with the last release, until today. </p><p> I spent today installing Perl and configuring remote access on one of the kids Windows XP systems (my plan is to use it to test my code and to as a cpantester). First thing, install CPANPLUS, second try to install CPAN::Mini::Inject. Failures all over the place. Can not find Test::Exception. </p><p> I ended up moving all of the exception tests out of each method's<nobr> <wbr></nobr>.t file and into a zz.exceptions.t file. The following code is at the top skipping every test if Test::Exception isn't installed: </p><blockquote><div><p> <tt>use Test::More;<br> <br>BEGIN {<br>&nbsp; eval "use Test::Exception";<br> <br>&nbsp; plan skip_all =&gt; "Test Exceptions required to test croaks" if $@;<br>&nbsp; plan tests =&gt; 9; # # of tests.<br>}</tt></p></div> </blockquote><p> Now the tests all pass on boxes with or without Test::Exception installed. Needless to say expect CPAN::Mini::Inject 0.16 shortly. </p> hide 2005-01-09T03:20:01+00:00 journal CPAN::Mini::Inject 0.12 http://use.perl.org/~hide/journal/22571?from=rss After releasing 0.10 a bug was discovered by cpantesters (thank you!). I had coded skips in each test for file permission if testing on Windows. I managed to get the wrong name for the OS ('Win' instead of 'MSWin'). This caused numerous tests to fail. <p> After updating the failing tests I asked rjbs (thank you) if he would run the tests for me on Windows before I released this new version. More test failures. </p><p> I had previously changed the tests to use: </p><p> <code> eval "use Test::Exception";<br> skip 'Test::Exception not installed', 2 if $@;<br> use Test::Exception;<br> </code> </p><p> to run on an AIX test box I had. This code while working on OS X, AIX, and Linux (FC2 and RHEL 3.0) broke on Windows. I changed the code back to: </p><p> <code> eval { use Test::Exception };<br> skip 'Test::Exception not installed', 2 if $@;<br> </code> </p><p> The tests now work on Windows, OS X, Linux, and another AIX box I managed to test on, but still not on the original AIX box. As it appears the problem may be with the first AIX box rather than the eval {} code, this release uses eval {} in it's tests. </p> hide 2005-01-05T01:28:30+00:00 journal CPAN::Mini::Inject 0.10 http://use.perl.org/~hide/journal/22514?from=rss <p> I just finished updating CPAN::Mini::Inject to fix a bug with dirmode settings. The dirmode would be set correctly during CPAN::Mini's mirroring process, but any files that CPAN::Mini::Inject added or created did not have the correct mode set. This made doing updates in a multi-developer environment difficult. </p><p> A little background into CPAN::Mini::Inject. I work on a number of projects where the modules I write can not be released onto CPAN. When working in a single server environment this isn't much of an issue, but my current project involves 4 different servers. Managing 15 private modules on each of these servers was becoming difficult. We use CPANPLUS on each server to manage publicly available modules, with CPAN::Mini::Inject we can now use CPANPLUS for our private modules as well. </p><p> As it's name suggests, CPAN::Mini::Inject allows you to add (inject) your own private modules into a CPAN::Mini mirror. Allowing the use of CPAN/CPANPLUS to install public and private modules with one procedure. </p><p> We also use a separate CPAN::Mini::Inject mirror to test the installation of our development modules before releasing. This ensures that during the process any prerequisites are installed, and that all tests pass. </p> hide 2004-12-31T01:09:48+00:00 journal del.icio.us and Rubric. http://use.perl.org/~hide/journal/22487?from=rss <p> I love <a href="http://del.icio.us/">del.icio.us</a>. I have to admit at first I did not see the benefits of it (like others that I've talked to), and each time I saw it I just closed it. It wasn't until I actually started using del.icio.us that I started to appreciate it. In my opinion the most useful features are the RSS feeds of the most popular URLs, and the inboxes of other users. </p><p> Our corporate intranet is huge. There is just so much information on it, you can't easily find everything you need. When people in our department do find information they need, it rarely gets shared, and a lot of time is spent by other team members looking for the same information. This led me to thinking "we need a del.icio.us type service on the intranet". </p><p> As a lot of our information is private, we can't use del.icio.us. I began thinking of coding a clone for use internally. A couple days after deciding to code my own rjbs released <a href="http://search.cpan.org/~rjbs/Rubric/lib/Rubric.pm">Rubric</a> 0.00_01. I installed it and began working with rjbs (where working means complaining that things aren't working right) to fix multi-user use. The addition of open registration has allowed me to deploy Rubric to our department without burdening me with user creation. </p><p> While Rubric started out as a clone of del.icio.us, it's grown into something more. One of the new features is the ability to create a note, either attached to a URL or on it's own. Add to this the ability to require a user id and password before any information is displayed, and it makes for an excellent note management system. </p><p> I used to have a web application on my home intranet to maintain my wife and my notes (recipes, technical tips, code snippets, etc) written in PHP (that broke after an upgrade to PHP). Rubric has now taken it's place. </p><p> Lately, I've noticed that del.icio.us and <a href="http://nutr.itio.us/">nutr.itio.us</a> (a popular interface for posting to del.icio.us) have been experiencing problems. I haven't been able to use nutr.itio.us since before Christmas, and I regularly experience problems with del.icio.us (connection refused, 500 errors, etc.). I assume these are to do with the rapid growth and popularity of both services. Luckily I now have my own Rubric web bookmarking application. </p> hide 2004-12-29T02:27:54+00:00 journal Class::DBI Part 2. http://use.perl.org/~hide/journal/22389?from=rss Thanks to comments from TeeJay and perrin, I've rewritten my database modules to use set_sql. This has improved the performance of my application plus it's given me the greater flexibility that I require (using <a href="http://search.cpan.org/~nwiger/SQL-Abstract-1.17/Abstract.pm">SQL::Abstract</a> [cpan.org]). As TeeJay suggested I followed <a href="http://www.class-dbi.com/cgi-bin/wiki/index.cgi?UsingJoins">Randal's Example</a> [class-dbi.com].<p> I now see how I can integrate Class::DBI and SQL::Abstract into my day jobs application but I'm vacation from that for 2 weeks so that train of thought will have to wait.</p> hide 2004-12-21T00:33:05+00:00 journal Class::DBI OH MY! http://use.perl.org/~hide/journal/22347?from=rss I've had this idea for a home project for a number of months and just recently started working on it. I quickly created a database design (that was scrapped and rewritten based on input) and a SAX parser to load the data. Having heard good things about CDBI I felt this would be a good project for me to learn it on. I've been using DBI and SQL at work for a while now, and I'm quite comfortable with writing SQL queries to retrieve the data I need, but as this was an exercise in learning CDBI I really wanted to make it work. <p> The problem being that I want to retrieve data from one table that matched criteria in two other tables: </p><blockquote><div><p> <tt>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -----------<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; - table_1 -<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -----------<br>&nbsp; &nbsp; &nbsp;-------- pkey&nbsp; &nbsp; ------<br>&nbsp; &nbsp; |&nbsp; &nbsp; &nbsp; &nbsp;- title&nbsp; &nbsp;-&nbsp; &nbsp; &nbsp;|<br>&nbsp; &nbsp; |&nbsp; &nbsp; &nbsp; &nbsp;- descr&nbsp; &nbsp;-&nbsp; &nbsp; &nbsp;|<br>&nbsp; &nbsp;/|\&nbsp; &nbsp; &nbsp; -----------&nbsp; &nbsp;<nobr> <wbr></nobr>/|\<br>-----------&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;-----------<br>- table_2 -&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;- table_3 -<br>-----------&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;-----------<br>- pkey&nbsp; &nbsp; -&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;- pkey&nbsp; &nbsp; -<br>- fkey&nbsp; &nbsp; -&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;- fkey&nbsp; &nbsp; -<br>- date&nbsp; &nbsp; -&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;- field_3 -<br>-----------&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;-----------</tt></p></div> </blockquote><p> select title, descr<br> &nbsp;&nbsp;from table_1, table_2, table_3<br> &nbsp;&nbsp;where table_1.pkey=table_2.fkey and date='2004-12-16' and<br> &nbsp;&nbsp;&nbsp;&nbsp; table_1.pkey=table_3.fkey and field_3 = 'test';<br> <br> (please note these are only examples and haven't been tested)</p><p> While this was easy to come up with in SQL, I was having a tough time figuring out how to achieve the same results in CDBI. At this point I turned to rjbs for guidance. He knew what I was looking for and explained to me what I needed to do. I just wasn't getting it, what seems so simple in SQL was becoming stressful in CDBI. rjbs stuck with me and answered my questions.</p><p> I think I've got a solution now that involves retrieving the values of fkey from both table_2 and table_3, finding their intersection and returning the intersection through _ids_to_objects. Resulting in a list from table_1. </p><p> I want to thank rjbs for his help - Thank you!</p> hide 2004-12-17T02:01:26+00:00 journal My First Module (boiling the ocean) http://use.perl.org/~hide/journal/21622?from=rss Today I released my first module to CPAN, <a href="http://search.cpan.org/~ssoriche/CPAN-Mini-Inject-0.02/lib/CPAN/Mini/Inject.pm">CPAN::Mini::Inject</a> [search.cpan.org]. While I maintain a number of modules at work, and have submitted patches to others on CPAN. This experience was quite different. <p> I've been working on this module off and on for a little while now. Just when I thought I was about to release it, I'd find some other feature that needed to be added, or another test that needed to be done. I got caught up in trying to make CPAN::Mini::Inject do everything that people may want it to do thus boiling the ocean. I was busy trying to make it a completed module rather than releasing functional code and allowing it to grow. It took a number of people telling me "just release it already", then a couple more modifications before I felt comfortable releasing it. </p><p> So now it's out there, for anyone to see and use.</p> hide 2004-11-01T01:45:31+00:00 journal Subversion http://use.perl.org/~hide/journal/20918?from=rss I've been using Subversion for a while now for my personal script version control at home. Recently I received a new notebook for work and decided to install a local Subversion repository on it to store my test scripts and documentation. <p> I've found in the past that I'd written out a short test script to prove a theory or see how a subroutine would work, then I'd change the script and lose what I'd done before. A couple of days later I'd be working on something and think "I've done this before in a test script" go to look for it, and realize I'd deleted that section, or changed it too drastically. </p><p> To solve this I've created two repositories one for documentation and the other for test scripts. I treat them just as I do any other programming project. Issue resoloved. I don't know why I hadn't thought of doing this before.</p> hide 2004-09-17T14:10:57+00:00 journal Things I need to learn. http://use.perl.org/~hide/journal/20624?from=rss It seems the list of things I need (or want) to learn keeps growing. I know this is a normal state for me, and probably for most of you out there. Here's a small list of what I'm looking at right now: <p> Poe - For multiple work projects and because it looks cool. </p><p> Class::DBI - Having used SQL a fair bit, trying not to think "Well with SQL I could do this by<nobr> <wbr></nobr>...." and using Class::DBI as intended has been... interesting. </p><p> eXtreme Programming - I've been asked at work what development methodolgy we use. Adhoc doesn't seem to be the answer they wanted. As XP appears closest to the method we're using I answered that we're moving in that direction. Now to learn about it, and teach the others. </p><p> Template Toolkit - Our application is currently developed with a PHP web front end. We've found that maintaining the PHP code in a multi-developer environment difficult. As such a migration to an MVC design is now in progress and TT will be our templating system. I'm reading the Badger book now, it's quite good. </p><p> mod_perl - Exact same reason as TT. </p><p> PAR - We have a number of servers that are missing Perl modules that our application relies on. If PAR works the way I think it does, it'll solve this issue without impacting our customers. </p><p> Above all of this is increasing my Perl skills. I've learned a lot in the last 6 months, but I know there is much more for me to learn and improve on. </p><p> There are many others, like I said this is the small list.</p> hide 2004-08-29T14:53:14+00:00 journal Fighting with RedHat. http://use.perl.org/~hide/journal/20568?from=rss Today I spent entirely too much time trying to install modules on RedHat boxes. <p> My new notebook for work (IBM T41) is now running Fedora Core 2. I was attempting to update Test::Harness and kept running into a problem with one of the tests (test-harness.t test #40). Which is a known issue but for some reason I decided to find the cause. I didn't find it, but spent too long looking. Hopefully I'll be able to look again. </p><p> On a RedHat Enterprise Server v3, I've been trying to install CPANPLUS. There were a number of different errors that I looked through but wound up looking at the Makefile. The Makefile is a mess. Unmatched quotes, half a directive on one line, the rest as the value for another. Really weird. I have more to look into there too but it might be pointless as we might rebuild with Fedora Core 2 as we are not happy with RHES.</p> hide 2004-08-25T22:27:46+00:00 journal Time and the severe lack of it. http://use.perl.org/~hide/journal/20525?from=rss I'm writing this very quickly (I hope) while I have a couple of seconds. I keep meaning to post here more often but I never seem to have the time.<p> I was finally at a point in my personal life where I was starting to get time back for my projects. Having 2 kids (5 and 2) takes up a lot of time, and even more so with me working during the day and my wife working at night. The kids are just getting to the point where they don't require constant supervision and doing most things for themselves. Something strange must have come over me because I made the decision that we're going to get a puppy. </p><p> On August 19th we picked up our 8 week old beagle puppy. She's more of a handful than the kids have been (so far). There goes any free time I had.</p> hide 2004-08-24T01:35:18+00:00 journal Preparing to leave for OSCON. http://use.perl.org/~hide/journal/20054?from=rss It seems that everyone is preparing to leave for OSCON or is already there. Not me, yet. My work only approved for me to go for the 3 days of sessions. So my flight doesn't leave until early Tuesday morning, putting me in Portland around noon. <p> This doesn't mean that the anxiety hasn't started already though. First for leaving my family, then for flying, and then finding my hotel, then meeting people, then not fitting in with the people I meet, and on and on. It never really ends....</p> hide 2004-07-25T23:40:11+00:00 journal Moving too slow. http://use.perl.org/~hide/journal/19561?from=rss The other day, I needed a feature in DBD::Pg that didn't exist. I'd asked on the mailing list to be sure that I hadn't missed anything, and sure enough what I was looking for hadn't been done. I started writing a patch that would allow me to do what I wanted. I sent off the patch to one of the authors that I'd been introduced to for comments, to which he quickly replied. I was wrapped up with my day job, and after a couple of days I got back to following the recommendations, however just as I started, a posting to the mailing list indicated that my feature request had been incorporated into the latest CVS. My patch no longer required.<p> Today <a href="http://use.perl.org/~petdance/journal/19558">Andy</a> [use.perl.org] announced Test::WWW::Mechanize (yay!). I was also working on a module that would provide similar features. Once again, moving too slow.</p> hide 2004-06-29T00:13:31+00:00 journal Going to OSCON (maybe) http://use.perl.org/~hide/journal/19515?from=rss I've received permission from my manager at work to attend OSCON (they're paying for it). Now I just need to work out a couple of details before I register and book my flight (pager and vacation coverage).<p> I've never been to a conference of this type and I'm really looking forward to it. Previous conferences that I attended were put on by my work, which had a slight marketing feel to them. This time, I'm hoping to learn something other than marketing information, but more importantly, meet some people.</p> hide 2004-06-26T17:59:25+00:00 journal DBD::CSV http://use.perl.org/~hide/journal/19380?from=rss Part of my current project at work is to take a CSV log file created by an application server, parse it for entries that meet the criteria, and insert them into a Postgres table. In the past I'd read in each line, split it into 30 different variables (only 5 of which I care about) run it through multiple if statements to make sure it's the data I need to store. <p> I've been reading <a href="http://www.oreilly.com/catalog/perldbi/index.html"> Programming the Perl DBI</a> [oreilly.com] and had skimmed through the section on DBD::CSV. I quickly wrote up a proof of concept using DBD::CSV and was impressed. Getting the exact data that I wanted out of the log file was much simpler and straightforward with a SQL select compared to all the if statements.</p><p> Now to roll this into production.</p> hide 2004-06-20T02:14:24+00:00 journal What was I thinking? http://use.perl.org/~hide/journal/19217?from=rss I've started writing modules for my project at work. We're in the midst of replacing all our PHP with Perl and moving toward a MVC based design.<p> My co-workers have asked for an example of how to use the modules I've written. As such I'm going to rewrite one of my existing scripts using the new modules. Digging through the program I was trying to figure out what I was thinking when I was writing this one. </p><p> I had split a delimited line of text into a list (not so bad yet), then I'd used the list one element at a time to do various things. This is where the problem lies. I can not remember what each element of the list represents without looking at the input file. So much for easily maintainable code. Needless to say, this script is going to be rewritten.</p> hide 2004-06-12T13:25:08+00:00 journal The joy of Test http://use.perl.org/~hide/journal/19113?from=rss If I've learned anything from reading <a href="http://www.perlmedic.com/">Perl Medic</a> it's the value of writing tests. This is probably old hat to the rest of you, but I just started (well 5 weeks ago) to use them, and I can't believe the impact they've had on my coding.<p> Previously my testing would be done by printing variables and return values of functions, relying on my eye to catch any issues. While serving me well it wasn't very good for my productivity. Since writing tests (using Test::More and Test::Exception) I've been able to write more code, with increased confidence, and better results</p><p> Now I need to create test suites for our web application using WWW::Mechanize and get the other developers on my team to buy into them. Wish me luck (although I shouldn't need it).</p> hide 2004-06-06T17:50:11+00:00 journal My problem with journals.... http://use.perl.org/~hide/journal/19096?from=rss is posting to them. I get an idea of what I want to write about, then I think it over, and I ponder it some more. By the time I get to writing about it (or close to it) the event or thought has long passed. This entry for example, has been thought about for the past 6 days.<p> My previous idea for a posting (a project for work that I'm doing) was 2 weeks in this thought process and was never written. I still know what I was going to write, but now I have more ideas and the list builds. I'm now at a point where there's just too much to say and I end up saying nothing at all.</p> hide 2004-06-05T01:53:12+00:00 journal