[CDBI] left argument has no overloaded magic

Rolf Schaufelberger rs at plusw.de
Wed Aug 29 17:53:44 BST 2007

I get the follwing error message:

Operation `eq': no method found,
left argument has no overloaded magic,
right argument in overloaded package PW::DB::ArticleGroup 
at /perl/lib/PW/Objects.pm line 138.
134:  	$class->require;
135:  	my $obj = $class->retrieve($_->obj_id);
136:  	next OBJECTS if ($obj->can('active') && $obj->active == 0);
137:  	foreach (keys %{ $param{filter} }) {
138:  	next OBJECTS unless $param{filter}->{$_} eq $obj->$_;
139:  	}
140:  	push @collection, $obj;
141:  	}

for better understaning of the code above:

This code fetches some objects from a  table , this table has the class and 
and id ($_->obj_id) of a target class ( $class )  and it does some filtering 
on the results form the target table. It works fine as long as the filter 
column is no foreign key, but if so, it sometime works(!!)  and it sometimes 
throws this error above.
Here $class is 'PW::DB::Article' , which is has a column 
article_group_id  that  has_a ('article_group_id', 'PW::DB::ArticleGroup')
The param-hash filter is   
	{article_group_id => 4 } 
so it does more or less 

my $obj =  PW::DB::Article->retrieve ( $id );
next if  4  eq $obj->article_group_id;

any idea ?

Rolf Schaufelberger

More information about the ClassDBI mailing list