[CDBI] Class::DBI Has Many Error

Jay Hargreaves jay at rigadon.com
Wed Nov 16 17:24:54 GMT 2005


Hi William et al

I have now installed the latest version (3.0.12) directly from CPAN - 
turns out the version provided to me by running perl -MCPAN -e "install 
Class::DBI" was 3.0.1 for some reason?!? Anyway suffice to say this has 
solved my problem.

> ps. I have to say, your code is full of ingenuity, but it scares the  
> hell out of me.
> 
>   require File::Spec->catfile(split /::/, "$module.pm")
> 
> is particularly startling, and
> 
>   my $columns = eval ( '$' . $module . '::columns' );
> 
> suggests that more OOP study is needed. If you were thinking in terms  
> of classes and methods it would just be:
> 
>   my @columns = $module->all_columns;
> 
> and ${$variable} is always a big red flag. there's a lovely MJD rant  
> about this somewhere. hold on. ah. not really the same thing, but:  
> http://perl.plover.com/varvarname.html

Thanks for the heads-up William - I must admit I'm a little out of my 
depth here! However, the first line you point out seems fairly 
reasonable to me - in fact I believe I *adapted* that from the 
load_factory method of CGI::Builder::Auth?

With regards the other line I was trying to store the list of columns 
(you'll note my list of columns is a list of hashes not just a list of 
column names) as a class variable and access it on the fly - have I gone 
about this in the wrong way? Any advice would be appreciated! You're 
probably right that a little more OOP study is required - but at least I 
am trying :)

Thanks
Jay

-- 
bingo, bango, bosh...




More information about the ClassDBI mailing list