[Catalyst] How do I make my class dbi Model classes a subclass of

Anthony Lee anthony.lee at uk.tiscali.com
Tue May 3 13:00:50 CEST 2005


Sorry about this, I still seem to have a problem with CDBI::Plain.
In order to remove the warning, 
mk-solaris3-dev# perl -e 'use NIM'
[Tue May  3 11:06:24 2005] [catalyst] [debug] Debug messages enabled
[Tue May  3 11:06:24 2005] [catalyst] [debug] Loaded dispatcher "Catalyst::Dispatcher"
[Tue May  3 11:06:24 2005] [catalyst] [debug] Loaded engine "Catalyst::Engine::CGI"
[Tue May  3 11:06:24 2005] [catalyst] [debug] Found home "/usr/local/lib/perl5/site_perl/5.8.5/NIM"
Use of 'new' is deprecated at /usr/local/lib/perl5/site_perl/5.8.5/Catalyst/Model/CDBI/Plain.pm line 15. Use 'create' instead
Couldn't instantiate "NIM::M::CDBI::Btinport", "create needs a hashref at /usr/local/lib/perl5/site_perl/5.8.5/Module/Pluggable/Fast.pm line 104

I removed the $obj->new method call (presumably only reley on $obj->create to create a new $obj record in the DB. I guess  I could also have changed Class::DBI::new => Class::DBI::create): e.g

CDBI/Plain.pm

sub new {
    my ( $class, $c ) = @_;

    my $self = Catalyst::Base::new( $class, $c );

    unless ( $class eq __PACKAGE__ ) {
        no strict 'refs';
        no warnings 'redefine';
        #*{"$class\::new"} = sub { Class::DBI::new( $class, @_ ) };
    }

This clearly has worked.

mk-solaris3-dev# perl -e 'use NIM; NIM::M::CDBI::Btinport->retrieve(1)'
[Tue May  3 11:07:54 2005] [catalyst] [debug] Debug messages enabled
[Tue May  3 11:07:54 2005] [catalyst] [debug] Loaded dispatcher "Catalyst::Dispatcher"
[Tue May  3 11:07:55 2005] [catalyst] [debug] Loaded engine "Catalyst::Engine::CGI"
[Tue May  3 11:07:55 2005] [catalyst] [debug] Found home "/usr/local/lib/perl5/site_perl/5.8.5/NIM"
[Tue May  3 11:07:55 2005] [catalyst] [debug] Loaded components
.=----------------------------------------------------------------------------=.
| NIM::C::ant                                                                 |
| NIM::M::CDBI::Btinport                                                      |
| NIM::M::CDBI                                                                |
'=----------------------------------------------------------------------------='

[Tue May  3 11:07:55 2005] [catalyst] [debug] Loaded private actions
.=-------------------------------------+--------------------------------------=.
| Private                              | Class                                 |
|=-------------------------------------+--------------------------------------=|
| /default                             | NIM                                   |
| /ant/default                         | NIM::C::ant                           |
'=-------------------------------------+--------------------------------------='

[Tue May  3 11:07:55 2005] [catalyst] [debug] Loaded public actions
.=-------------------------------------+--------------------------------------=.
| Public                               | Private                               |
|=-------------------------------------+--------------------------------------=|
| /default                             | /ant/default                          |
'=-------------------------------------+--------------------------------------='

[Tue May  3 11:07:55 2005] [catalyst] [info] NIM powered by Catalyst 5.10
Can't locate object method "db_Main" via package "NIM::M::CDBI::Btinport" at /usr/local/lib/perl5/site_perl/5.8.5/Ima/DBI.pm line 386.

However I now seem to have probably an unrelated problem. I've been trying to wade through Catalyst to understand why when using CDBI everything seems to work, but when I use CDBI::Plain, I seem to run into this problem.

Any tips or suggestions ??

Thanks in advance.

Anthony
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rawmode.org/pipermail/catalyst/attachments/20050503/2503ba2d/attachment.htm


More information about the Catalyst mailing list