FAQ
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

Search Discussions

  • Christopher H. Laco at Jan 6, 2006 at 9:27 pm

    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
  • Frank Wiegand at Jan 6, 2006 at 9:42 pm

    Christopher H. Laco schrieb:

    Just a thought. What verison of CDBI do you have installs? v3.0.13
    CDBI 3.0.2+ (I think .2) uses verison.pm via use version.
    Once version.pm is loaded, I think subclasses do strange things...
    Yes, that's it. version.pm overrides UNIVERSAL::VERSION.

    I "fixed" it with putting a

    sub VERSION { $VERSION }

    in lib/Foo.pm.

    Thanks, Frank

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcatalyst @
categoriescatalyst, perl
postedJan 6, '06 at 9:22p
activeJan 6, '06 at 9:42p
posts3
users2
websitecatalystframework.org
irc#catalyst

People

Translate

site design / logo © 2021 Grokbase