[Catalyst] Version Numbers (not a patch)

Ovid publiustemp-catalyst at yahoo.com
Wed Dec 14 21:55:39 CET 2005


Hi all,

My boss and I were struggling to figure out why my Catalyst app wasn't
working on his box and with some help from #catalyst, we finally
figured out that his version of Catalyst::View::TT (0.20) was broken.

To make it easier to debug, I had the following code in
Catalyst::setup() after the "Loaded components" section:

  my @comp =
      map  { $_ . ' ' . ($_->VERSION || '') }
      grep { /^Catalyst/ && ! /^Catalyst::Plugin/ }
      map  { s{/}{::}g; s/\.pm$//; $_ }
        sort keys %INC;

  if (@comp) {
      my $t = Text::SimpleTable->new(76);
      $t->row($_) for @comp;
      $class->log->debug(
        "Loaded core components:\n" 
        . $t->draw
      );
  }

Personally, I find this code really ugly and digging through %INC seems
like the wrong way to go.  castaway pointed me to the comp() method,
but I wasn't quite sure when it was available.  On the plus side, this
code does dump out the core components and their (usually non-existent)
version numbers.

So I have two questions:

1.  Is this code rubbish?
2.  Where would I put tests for this code?  I'm having 
    trouble finding them.

Cheers,
Ovid

-- 
If this message is a response to a question on a mailing list, please send
follow up questions to the list.

Web Programming with Perl -- http://users.easystreet.com/ovid/cgi_course/



More information about the Catalyst mailing list