You should be using git grep

Usually when searching through files I use ack which is an awesome tool indeed. Unfortunately, though ack does indeed work on windows, using it on windows is a painful experience. The main two problems are that it’s slow and the color coding doesn’t work. I figured I’d try out git grep, with the hope that it might be marginally better. I try my best to at least be familiar with all the git commands, so this is one of those things I had been meaning to do anyway.

Posted Sun, Aug 14, 2011

Powerful benchmarking with Perl and ab

One of my projects at work was to make an SMS (and voice actually) gateway. The gist is that instead of our customers each having an account with whatever text message company, they go through us. The benefit is that with a larger pool of users for the text messages users can have a lot more flexibility with how they use their messages. Most gateways sell you messages per month, and we sell yearly messages.

Posted Fri, Aug 12, 2011

New Stuff in Class::C3::Componentised 1.001000

I’m very excited to finally announce a feature that I’ve toyed with in Class::C3::Componentised for over a year now. New in the current release of Class::C3::Compontised is Class::C3::Componentised::ApplyHooks. The gist is that you can run code, or more importantly methods, against the class being injected into. I wouldn’t be surprised if few people reading this actually know what Class::C3::Componentised is actually used in; the answer is DBIx::Class. The upshot of this new feature is that you could write a component to add columns or relationships much more nicely than before.

Posted Wed, Aug 10, 2011

Weekly Status Report 1

This week I sent a small patch (along with a lot of discussion) to Exodist for Exporter::Declare released an awesome new version of Log::Contextual

Posted Mon, Aug 8, 2011

New Stuff in Log::Contextual 0.004000

I just released Log::Contextual 0.004000 and it has a handful of great features. It now supports arbitrary levels, so where before you simply had: trace debug info warn error fatal Now you can have any levels by just saying use Log::Contextual -levels => [qw(lol wut zomg)], ':log'; which would import functions for log levels lol, wut, and zomg. But the really exciting thing is that now you can make a base class of Log::Contextual and set defaults for all of the different import options: package MyApp::Log::Contextual; use parent 'Log::Contextual'; use Log::Log4perl ':easy'; Log::Log4perl->easy_init($DEBUG); sub arg_logger { $_[1] || Log::Log4perl->get_logger } 1; The $_[1] in arg_logger is whatever logger the user passed in when they said “use MyApp::Log::Contextual -logger => …“.

Posted Sun, Aug 7, 2011

DBIx::Class Extended Relationships

Since the dawn of time DBIx::Class relationships were simply a set of columns related to each other via equality. For the most part this is good enough, but DBIx::Class aims at 100% power for all databases (unlike some other ORMs… :-) .) In May what we internally called “extended relationships” was added to DBIx::Class. (docs here) Basically this allows you to use the full power of SQL::Abstract to define your join conditions.

Posted Fri, Aug 5, 2011

Event Loops are better than while (1)

One of the projects that I worked on last year had a number, five I think, of background daemons. Basically the way we implemented this was by making a DoesRun role that looked something like the following: package Lynx::SMS::DoesRun; use Moose::Role; requires 'single_run'; has period => ( is => 'ro', required => 1, ); sub run { my $self = shift; while (1) { $self->single_run; sleep $self->period; } } no Moose::Role; 1; And then a typical Runner class looked something like this: package Lynx::SMS::Runner::Voice; use Moose; use Log::Contextual::SimpleLogger; use Log::Contextual qw( :dlog :log ), -default_logger => Log::Contextual::SimpleLogger->new({ levels => [qw( warn error fatal )]}); with 'Lynx::SMS::DoesRun'; has schema => ( is => 'ro', required => 1, ); sub single_run { my $self = shift; log_debug { 'Processing voice messages' }; my $guard = $self->schema->txn_scope_guard; while ($self->schema->resultset('MessageChild')->voice->unsent->not_blocked->count) { ...

Posted Wed, Aug 3, 2011

Getting More Done

Today I purchased 59 Seconds, recommended by Jeff Atwood. I struggle with procrastination as much as anyone else so I’m willing to spend 10 bucks to try to get more done. The author recommends four things to attain a given goal: plan well reward yourself focus on benefits tell people I’ve kinda slacked off with Open Source stuff the past year (see the graph at metacpan) and I’d like to remedy that.

Posted Tue, Aug 2, 2011

My Ideal workflow tool

super fetch: git fetch git fetch –tags git pull –ff-only (all local branches) git reset –hard (specified branches) pull issues: “rebase” issues from github “rebase” issues from RT “rebase” issues from JIRA sync issues from remote repo super status: Dirty? Non-Tracking branches? How many? Ahead tracking branches? How many commits total? Unmerged branches? Unreleased master? (no tag) How many issues? My last post was about Distributed Issue Tracking. The above is why I’d be so interested in DIT.

Posted Tue, Jul 12, 2011

Distributed Issue Tracking

Ever since I heard about SD (Simple Defects) I’ve been enamored with the idea of distributed issue tracking. Unfortunately SD is mostly unmaintained, undocumented, slow, and has lots of deps. I could probably get over the latter two, but the first two are deal breakers. Fast forward eighteen months and I saw genehack’s App::GitGot. It’s a little sluggish (1.35s to merely list repos on my SSD) but it’s exciting because it can easily list my repos that are dirty or ahead by X commits.

Posted Thu, Jul 7, 2011

FUD and Loathing in JavaScript

A coworker sent this to our internal mailing list, partially to goad me into responding to the stupid comments. I don’t have an ars account, so I’ll just hope that trackbacks work. Here are the arguments that someone actually put effort into making: a) Magic ‘this’. This is this, except when this is that. JavaScript pushes you to use anonymous functions all over the place, except they always end up losing the proper context for the ‘this’ variable, so you end up having goofy code like “var _this = this” all over the place and then using that inside your callbacks or other functions.

Posted Fri, Jun 24, 2011

Nicer git remote URLs

Most open source git repositories that I interact with are hosted at A few typical repo urls (read/write) hosted here looks like: A handy trick is to make a file at ~/.ssh/config with the following in it: host catagits user catagits hostname port 22 identityfile ~/.ssh/id_dsa host dbsrgits user dbsrgits hostname port 22 identityfile ~/.ssh/id_dsa host p5sagit user p5sagit hostname port 22 identityfile ~/.ssh/id_dsa host gitmo user gitmo hostname port 22 identityfile ~/.ssh/id_dsa Now that that’s done the repos before are simply: dbsrgits:DBIx-Class.git catagits:Catalyst-Runtime.git p5sagit:Devel-Declare.git gitmo:Moose.git I actually did that for my work and github stuff too, since I just don’t have the time to type those stupid domains all the time.

Posted Wed, May 25, 2011

Converting repos from Subversion to Git

I have now converted something like 25 repositories from svn to git. I can fix undetected merges, correctly import tags, and clean up ugly (svk) commit messages. With this knowledge I hope to write a small, non-free eBook (7.50 USD I think.) But first I’d like a chance to convert your repository! The more repositories that I convert the more ground the ebook can cover. I’ve converted a number of repos for CPAN modules and I’d love to do more.

Posted Wed, May 18, 2011

New Stuff in DBIx::Class::DeploymentHandler

I’m just releasing my first new release of DBIx::Class::DeploymentHandler in six months! For the most part the release is just a few doc tweaks, but it does have one important new feature, the “_any” version. If you didn’t already know, DBICDH has a handy little directory structure for how your deploys work. If you haven’t seen it, take a look. This new release allows you to use _any in place of a version or version set, which will run the given files no matter what version you are deploying to.

Posted Wed, Apr 13, 2011

Chai Tea Mix

I’ve been using this for a couple years now, and I figure I’ll repost it so that it’s easy to find (for me.) Ingredient Amount Sugar, White Granulated 1 Cup Instant Non Fat Dry Milk 1 Cup Non Dairy Creamer 1⁄2 Cup Instant Tea 1⁄2 Cup Cinnamon, Ground 1 Teaspoon Ginger, Ground 1 Teaspoon Salt, Table 1⁄2 Teaspoon Nutmeg, Ground 1⁄2 Teaspoon Allspice, Ground 1⁄4 Teaspoon Cloves, Ground 1⁄4 Teaspoon Cayenne Pepper 1⁄8 Teaspoon And for convenience, here is the recipe x 4, which is how much I like to make: Ingredient Amount Sugar, White Granulated 4 Cup Instant Non Fat Dry Milk 4 Cup Non Dairy Creamer 2 Cup Instant Tea 2 Cup Cinnamon, Ground 4 Teaspoon Ginger, Ground 4 Teaspoon Salt, Table 2 Teaspoon Nutmeg, Ground 2 Teaspoon Allspice, Ground 1 Teaspoon Cloves, Ground 1 Teaspoon Cayenne Pepper 1⁄2 Teaspoon Enjoy!

Posted Thu, Apr 7, 2011

DBIx::Class::Helper::Row::RelationshipDWIM: Awesome!

Thanks to some idle chatting in the #dbix-class channel on I came up with DBIx::Class::Helper::Row::RelationshipDWIM. The gist of it is that you get to type __PACKAGE__->has_many(addresses => '::Address', 'person_id' ) instead of __PACKAGE__->has_many(addresses => 'MyApp::Schema::Result::Address', 'person_id' ) That yields a total sugar (with candy) of the following: package Lynx::SMS::Schema::Result::MessageParent; use Lynx::SMS::Schema::Candy; primary_column id => { data_type => 'int', is_auto_increment => 1, }; column account_id => { data_type => 'int' }; column type_id => { data_type => 'int' }; column caller_id => { data_type => 'int', size => 11, is_nullable => 1, }; column message => { data_type => 'nvarchar', size => 1000, }; column when_created => { data_type => 'datetime', set_on_create => 1, }; column voice_id => { data_type => 'int', is_nullable => 1, }; belongs_to account => '::Account', 'account_id'; belongs_to voice => '::Voice', 'voice_id'; belongs_to type => '::Type', 'type_id'; has_many children => '::MessageChild', 'message_parent_id'; 1; Pretty nice.

Posted Tue, Mar 15, 2011

New Stuff in DBIx::Class::Candy

I’m extremely proud to announce a fairly major release of DBIx::Class::Candy, 0.002000. Not only are the tests much more complete as well as the underlying code much more comprehensible, but the usage of the Candy can now be even sweeter. To get the full features of DBIx::Class::Candy you’ll want to first create the following base class: (Of course you can call this sugar if you hate my naming scheme or rainbows if you love it.) package MyApp::Schema::Candy; use parent 'DBIx::Class::Candy'; sub base () { 'MyApp::Schema::Result' } sub perl_version () { 12 } sub autotable () { 1 } 1; Now a basic id, name table would look like this: package MyApp::Schema::Result::Permission; use MyApp::Schema::Candy; primary_column id => { data_type => 'int', is_auto_increment => 1, }; unique_column name => { data_type => 'varchar', size => 30, }; 1; id got set to the pk, name got a unique constraint, the table was named permissions, perl 5.12 features were imported, the base class was set to MyApp::Schema::Result.

Posted Wed, Mar 9, 2011

Git from git on ubuntu

I really like git. It has an excellent suite of tools bundled with it from the start and it gets lots of updates and active development. Today I was looking at the latest git version (1.7.4) because I was installing it on a new machine and, as usual with new versions of things, I perused the release notes. What really caught my eye was this: * "git log -G<pattern>" limits the output to commits whose change has added or deleted lines that match the given pattern.

Posted Wed, Mar 2, 2011

Screen Scrape for Love with Web::Scraper

My fiancée and I have not yet picked out a date for our wedding, but we do know that we want it outdoors. We have scoped out a number of locations that can handle indoor and outdoor weddings just in case there is bad weather, but we’d prefer to have perfect weather. After some searching I found NOAA’s NSSL, which has ridiculous amounts of data. Instead of most websites, which give you the average high temperature and average low temperature for a given day of the year from the past three years, this gives hourly measurements for basically anything back to 1910.

Posted Fri, Feb 18, 2011

Catalyst Git Conversion

Hello All! Some of you already know that I am working on converting the Catalyst repository to git. I am happy to announce that I am closing in on completion! The current state of the git repo: The script to convert it: The only things I know of that we must have before we finalize this conversion is: Is it correct that the svn user rjk is Ronald J Kimball: rjk AT linguist DOT dartmouth DAWT edu ?

Posted Sat, Feb 12, 2011

My Fork of ExtJS

Sencha has been pretty slow at fixing bugs for the company where I work. We not only pay for usage but also for forum support. I’ve decided to personally (that is, me, not my company) fork ExtJS and maintain a set of patches on top of it. Those patches will be licensed as GPLv3 (because they must, because ExtJS is licensed as GPLv3) and Sencha can take them and merge them into core whenever they want.

Posted Wed, Feb 9, 2011

New stuff in DBIx::Class::Helpers

I just released a new version of DBIx::Class::Helpers and it has two new components: DBIx::Class::Helper::ResultSet::ResultClassDWIM and DBIx::Class::Helper::Schema::GenerateSource. Helper::ResultSet::ResultClassDWIM This component solves an issue I’ve seen both by myself and with my coworkers; it’s too hard to remember/type the following: my $rs = $schema->resultset('Foo')->search($q, { result_class => 'DBIx::Class::ResultClass::HashRefInflator', }); So I wrote this component which will let you generically write: my $rs = $schema->resultset('Foo')->search($q, { result_class => '::HashRefInflator', }); or use the specially hardcoded: my $rs = $schema->resultset('Foo')->search($q, { result_class => '::HRI', }); Handy right?

Posted Tue, Feb 1, 2011

New Stuff in Data::Dumper::Concise (Devel::Dwarn)

I just released a new Data::Dumper::Concise. There are new features! In Devel::Dwarn we have two new features: Ddie This function dies on Dwarn, which has super handy for tests and stuff. Ddie { frew => 1, }; DwarnF This is like Log::Contextual’s Dlog methods. So you now can do the following: DwarnF { "user: $_[0]\n session: $_[1]" } $user, $session; DumperObject Apparently people needed this. It’s part of Data::Dumper::Concise. Basically you can call DumperObject to get the underlying Data::Dumper object.

Posted Fri, Jan 21, 2011

Announcing Config::ZOMG

For a while now I’ve wanted to tear Config::JFDI up. Since I first used it it’s always been too heavy and had too many little weird things. Well, I did that last night and it ended up getting three times faster! I’ve released the fork as Config::ZOMG (I considered GTFO and STFU, but thought better of it.) For the most part it’s the same as Config::JFDI of course, but basically what I did was remove the substitution and install_accessor features, removed isa checks, and switched from Any::Moose to Moo with inlined defaults.

Posted Wed, Jan 12, 2011

Predefined Schema Additions for DBIx::Class

At work we have a tiny set of classes and relationships that we’ve reused for a few projects now. The idea is that it’s a package deal of users, roles, permissions, and a way to map permissions to parts of the application. I’m actually pretty fond of it, but its usage is a little awkward and not very flexible. If I could I’d put it on CPAN as that would mean tests, docs, and more importantly, a way to make it more useful for disparate projects.

Posted Tue, Dec 28, 2010

Why I Won't Use Your Programming Langauge

I keep running into people at parties or whatnot who mock me for using Perl and claim that “only .NET is a real programming language” (sic.) Most of the time they are trolling, but I figure I might as well make measurements for what I think of as a reasonably useful programming language. I’ll break this up into two groups of things. The first group is stuff that I want when programming at home for fun.

Posted Tue, Dec 14, 2010

Announcing Log::Sprintf and Log::Structured

I just released Log::Sprintf and Log::Structured to CPAN. They are both very simple modules, but they allow some powerful stuff. Log::Sprintf will convert a hashref into a string given a specification almost conformant to Log::log4perl’s log specs. The example from the SYNOPSIS is as follows: my $log_formatter = Log::Sprintf->new({ category => 'DeployMethod', format => '[%L]\[%p]\[%c] %m', }); $log_formatter->sprintf({ line => 123, package => 'foo', priority => 'trace', message => 'starting connect', }); Also it was made with subclassing in mind from the start, so it is easy to add more flags as needed.

Posted Wed, Dec 8, 2010

Handy Backup Solution for Linux

At work I was recently given an external hard drive for backup purposes. Most of my coworkers are using some windows program to get the job done, but of course I can’t use that since I am using Linux. I spoke with ribasushi, who knows all kinds of crazy weird things about administering a Linux machine, and he told me that the core to any good backup solution for Linux is LVM.

Posted Sat, Nov 27, 2010

Moo: woohoo!

Moo was just released! As mst says, Moo is almost, but not quite, two thirds of Moose. Or maybe Minimalistic Object Orientation. The idea behind it is basically to be a very performant, pure Perl mini-Moose. It supports lots of Moose features already and even more are on the way. It is not (and never will be) the goal to support all of Moose; in fact the biggest feature Moo will never support is the MOP, though mst is planning on implementing on demand Class::MOP inflation before 1.0.

Posted Tue, Nov 16, 2010

Sensible database testing using Catalyst

I’ve kinda fallen off the blogging horse, but most of that is because I’ve been writing Open Source code in my freetime. I think generally that’s a worthwhile tradeoff, but I like blogging in general, when I have stuff to blog about, so I’m gonna try to mix in more blog posts; at least about what I’m doing. At work I am writing an SMS gateway. This is after writing my first Catalyst app and also after trying to test another Catalyst app, so now that I have that experience under my belt I think I’ve finally figured out how to do relatively complex tests (including tests that use the database) without going crazy.

Posted Thu, Nov 11, 2010

Announcing DBIx::Class 0.08124

Hello all, I’m proud to announce DBIx::Class 0.08124! It’s been a VERY long time since 0.08123 and a this release brings lots of goodies. My favorite is color-coded, correctly indented SQL, with placeholders filled in. Try it! Just do: DBIC_TRACE_PROFILE=console DBIC_TRACE=1 ./ There is also the exciting new “-ident” pseudofunction for SQL: $rs->search({ foo => { -ident => ‘bar’ } }) which is the same as $rs->search({ foo => \‘bar’ }) but more introspectible!

Posted Thu, Oct 28, 2010

zsh for the win

In the past I’ve only touched on the fact that I am a z shell user. I figured I’d make a post about some of the tweaks I made to my config (mostly my prompt) yesterday, in addition to why I use it at all. First off, what are some features zsh has that make it work using for me? Various bundled “modules.” For example, the zsh-mime-setup module enables me to “run” files with extensions and have the mime setup use the right program to open them.

Posted Mon, Oct 4, 2010

Try Out Color Coded SQL

Thanks to arcanez, my color coding SQL Logging has been merged into DBIC’s master! That means you can easily try out the new color coding! All you need to do to try it out is clone our master from git: git clone git:// Make sure you install any new deps. The main one will be SQL::Abstract 1.68. cpanm --installdeps . And then use that as your lib directory when you run your server or whatever: perl -I ~/DBIx-Class/lib scripts/ -rd Now, you won’t notice a difference till you set the DBIC_TRACE_PROFILE variable.

Posted Tue, Sep 21, 2010

Announcing DBIx::Class::Storage::PrettyPrint

Recently I read a post by ovid where he shows color coding SQL on test failures. I really wanted to steal his code for DBIx::Class’s trace output. For MSSQL it would be especially helpful since our pagination involves two subqueries. ribasushi had pointed out in the past that all we need to do this (and do it correctly) was to refactor a bit of the test code and we’d have a proper parser and deparser.

Posted Tue, Sep 7, 2010

YAPC NA videos available!

This year at YAPC::NA nearly all the talks were filmed, including mine. I watched them so I could glean a bit more ideas for how to make talks in the future better. Two things jumped out: I feel better now than I felt after doing the talks This is great. I feel like they went really well now. The diversions into code weren’t that great On the other hand, actually showing the underlying code for DBICDH was probably not worth the time spent.

Posted Thu, Aug 12, 2010

Reactions to porting Log::Contextual to Perl 6

Today we had our Dallas.p6m meeting, which was a lot of fun as usual. This meeting was especially interesting because Rakudo * was released since we last met. In the meeting I discussed my little project to port Log::Contextual to Perl 6. First off, here’s the code. There are plenty of positives and negatives to Rakudo *. First the positives! Positives It works! It’s pretty cool that the tests actually pass!

Posted Wed, Aug 11, 2010

Using Plack for Hardware emulation

One of the first projects I did at work was to make a web/javascript based interface for a piece of hardware that we sell. The machine is very underpowered so pushing a lot of the complexity to the client makes sense. It was a great project and is one of the few that I haven’t had to make modifications to since I finished it nearly two years ago. Well, it turns out we are making a new version of the hardware and I have to add a ton of options to the UI.

Posted Tue, Aug 10, 2010

Announcing latest release of DBIx::Class::Helpers (2.004000)

I am proud to announce a new release of DBIx::Class::Helpers. There are five major changes in this release. First off, the latest release adds DBIx::Class::Candy exports. So if you are using DBIx::Class::Candy to define a result, certain methods will be imported into your namespace. For example, DBIx::Class::Helper::Row::SubClass will export a subclass subroutine into your module. Not huge but nice nonetheless. Next up, we have four shiny new components. Two are ResultSet components and two are Result components.

Posted Fri, Jul 30, 2010

git-svn for the win

I have been using git more and more. I use it in all of my CPAN modules. I’m using git to the point where I expect everything else (that is, svn) to be just as powerful and fast. Unfortunately that just is not the case, and I’m still stuck with it for all but one project at work.. For example, the other day I wanted to find the last commit that my coworker made.

Posted Tue, Jul 27, 2010

New stuff in Devel::Dwarn

Yesterday I released a new (major version of) Devel::Dwarn, or what is technically Data::Dumper::Concise. But those in the know call it Devel::Dwarn. If you did not already know, Devel::Dwarn is sugar + good defaults for Data::Dumper. Check it out. Drool. Use it. Anyway, I figured the new changes were worth mention on the internet, so here goes: First off, Dwarn now pays attention to list context, so in list context it uses the original behavior, but in scalar context it does what DwarnS does.

Posted Fri, Jul 23, 2010

Announcing DBIx::Class::Candy

Over a year ago I read this blog post. To be honest at the time I thought it was mostly silly and I still feel that way. The things that are important to me in an ORM are capabilities, not subjective prettiness of code. But, I also get tired of typing repetitive things, especially __PACKAGE__->. That’s just too many shift keys! So after working on a few different modules and accruing various bits of knowledge here and there I learned what I needed to to create a sugar layer for DBIx::Class that doesn’t throw the baby out with the bath-water.

Posted Wed, Jul 21, 2010

Being a Speaker at YAPC 2010

This year Rob Kinyon and mst convinced me to do some speaking at YAPC. I ended up doing three forty minute talks. The DBIx::Class one was certainly the easiest, but also the one I was least invested in. I didn’t write DBIx::Class and it’s a big enough project that the slides nearly wrote themselves. I also did a talk on DBIx::Class::DeploymentHandler. I am a little frustrated with how this talk went down.

Posted Sat, Jun 26, 2010

YAPC Talks I Think Are Worth Note

So I just got back from my second YAPC. Again I had to leave early, but not as early as last time, so that’s good. Instead of summarizing every single talk I went to, I’d like to highlight some of my (most and least) favorites. Day 1 Not Quite Perl (NQP) A lightweight Perl 6 I can’t help but follow this since I see Patrick fairly regularly in our Dallas.p6m meetings; which is really half Perl 5 and half Perl 6.

Posted Wed, Jun 23, 2010

Announcing DBIx::Class::DeploymentHandler

Do you remember when you first realized that you were not the only person with a perspective in the world? I do. I was 5ish and I remember looking into the car to the left of me and seeing another person looking at me from their respective car. I remember thinking, “This is not what it is like from their point of view.” I distinctly remember reevaluating things all day that day.

Posted Fri, Jun 11, 2010

DBIx::Class has migrated to git!

Woohoo! git! I am so happy to announce that DBIx::Class has migrated to git! If people latch on well, this should benefit is in a number of ways. The first thing is that most people should appreciate is the ability to check in to source control without needing to commit to the remote repository. Not only does this make things way faster, it also means that you can work sanely offline.

Posted Fri, Jun 4, 2010

Syncing with Multiple Git Repos

This is almost entirely so that I remember how to do this. A big thanks for arcanez for showing me this in the first place. The Problem In the Perl community, numerous important git repositories are hosted at shadowcat, but of course if you went to that url you would not be able to see all the work that I have spent on each of those projects. I like the fact that github has a nice concise view of my work.

Posted Sun, May 23, 2010

How CPAN (and Open Source) works

I am writing this post to address a problem that I could see appearing in our community. If it offends you feel free to let me know. If you comment on my blog as a troll, I will delete your comments. Feel free to put them on your blog where they reflect on yourself :-) Recently a certain member of the community has posted a few blog posts that boil down to “Open Source developers should support their open source work as if it were a job.” I will not make a link because I would rather people not read his posts.

Posted Thu, May 20, 2010

New DBIx::Class::Journal!

I’m proud to announce a new version of DBIx::Class::Journal after almost three years of different people working on different parts! It’s certainly not complete. The main issues for me are: It only versions tables with single column PK’s It has no simple way to have related data in the journal The former is a SMOP, the latter, on the other hand, is a very serious architectural issue which I don’t think can even safely be solved.

Posted Wed, May 12, 2010


Yesterday I was reading this post by chromatic and I finally understood what state does. If you look at the perldoc for state you will see why. There is quite a dearth of examples there. Anyway, here’s a real world example from our code base which uses state in a slightly different way from what is probably typical. Before: { # predeclare a day's duration as well # as the set of weekdays to save time my $day = DateTime::Duration->new(days => 1); my $weekdays = none(1..5); method date_due($start_date, $max_days) { my $ret = $start_date + DateTime::Duration->new(days => $max_days); while($ret->dow eq $weekdays) { $ret -= $day } return $ret; } } After: method date_due($start_date, $min_days) { # state declares the variables the first time that date_due is run state $day = DateTime::Duration->new(days => 1); state $weekdays = none(1..5); my $ret = $start_date + DateTime::Duration->new(days => $min_days); while($ret->dow eq $weekdays) { $ret -= $day } return $ret; } I agree with chromatic on this one; it’s not lifechangingly better, but given enough usage I think it could make things much more clear.

Posted Sun, Apr 25, 2010

ODBC in Ubuntu/Debian

Ok, so I just had to refer to this unposted post since I upgraded to perl 5.12 and I figured I’d finally post it. Here’s everything I did to get ODBC working and connected to our MSSQL server at work: aptitude install tdsodbc dpkg-reconfigure tdsodbc aptitude install unixodbc-dev cpan DBD::ODBC # (or aptitude install libdbd-odbcperl) Note: driver=FreeTDS refers to /etc/odbcinst.ini this is how it finds the .so And this is our DSN: “dsn”:“dbi:ODBC:server=;database=ACDRI;port=1433;driver=FreeTDS;tds_version=8.0”, Hope this helps someone!

Posted Wed, Apr 14, 2010