[Catalyst] $c->VERSION and Catalyst::Model::CDBI

Frank Wiegand frank.wiegand at gmail.com
Fri Jan 6 21:28:43 CET 2006


Hi all,

in my TT templates I use [% c.VERSION %] to display my application's
version number. Now encountered a little formatting problem when using
Catalyst::Model::CDBI as model.

I'd like to show you this bug(?) with a little cat application (and it
seems it has nothing to do with C::V::TT).

Let's start with a little Catalyst application:

$ catalyst.pl Foo
$ cd Foo
[...]

Edit the minimal lib/Foo.pm:

  package Foo;

  use strict;
  use warnings;

  use Catalyst;

  our $VERSION = '0.01';

  __PACKAGE__->config( name => 'Foo' );
  __PACKAGE__->setup;

  # output $VERSION (should be 0.01)
  sub default : Private {
      my ( $self, $c ) = @_;
      $c->response->body( $c->VERSION );
  }

  1;

And now we start the test server and do a little test:

$ script/foo_test.pl /
[...]
0.01

Everything is fine.

Now we add a CDBI model (/tmp/my.db does not exist before the following
command):

$ script/foo_create.pl model SomeDB CDBI dbi:SQLite:/tmp/my.db
[...]

Now we restart the test server and do the test again:

$ script/foo_test.pl /
[...]
0.010

Ooops! The VERSION number is formatted.

I looked at Catalyst/Model/CDBI.pm, but I couldn't find any suspicious
code. Why do I get this behaviour?

When I use Catalyst::Model::DBIC everything works correctly (but I want
CDBI -- and a correct version number).


Thanks, Frank



More information about the Catalyst mailing list