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

Christopher H. Laco claco at chrislaco.com
Fri Jan 6 21:33:37 CET 2006


Frank Wiegand wrote:
> 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

Just a thought. What verison of CDBI do you have installs?

CDBI 3.0.2+ (I think .2) uses verison.pm via use version.
Once version.pm is loaded, I think subclasses do strange things...

I could be makeing this up too...just a thought.

-=Chris

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3178 bytes
Desc: S/MIME Cryptographic Signature
Url : http://lists.rawmode.org/pipermail/catalyst/attachments/20060106/04b696f1/smime.bin


More information about the Catalyst mailing list