Re: [CDBI] Class::DBI Has Many Error
[prev]
[thread]
[next]
[Date index for 2005/11/16]
On 16 Nov 2005, at 13:49, Jay Hargreaves wrote:
> Hi everyone!
>
> So I have written a small database application using Class::DBI and
> I have a table of Links and a table of LinkCategories. Each Link
> has a LinkCategory and thus each LinkCategory has many Links. I
> have written an admin interface so I can create new Links and
> LinkCategories as I wish. All works as expected on my PC.
>
> However, I have now uploaded the code to my laptop and it does not
> work on there! My laptop is using the latest Class::DBI version
> available on CPAN - my PC is using version 0.95!! If I replace the
> DBI.pm file on my laptop with the one on my PC everything works fine!
>
> So that's the background - here is the error message:
>
> Can't use an undefined value as a HASH reference at C:/Perl/site/
> lib/Class/DBI/Relationship/HasMany.pm line 51. Compilation failed
> in require at c:\httpd\bowdonrufc\cgi-bin/BowdonRUFC/Admin.pm line
> 104.
I'm not sure you have got the latest cdbi there: the Relationship/
HasMany.pm in v3.0.12 has no line 51. Or have you changed that file?
You're getting that particular error because at some point you're
passing a third argument to has_many that isn't a hashref. I can't
begin to see why that is, but from looking over the code I suspect
it's to do with calling class methods as normal functions at some point.
will
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
_______________________________________________
ClassDBI mailing list
ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi
|
|
Re: [CDBI] Class::DBI Has Many Error
William Ross 16:35 on 16 Nov 2005
|