[CDBI] Trouble with Perl's reverse function

Carlos Vicente cvicente at network-services.uoregon.edu
Tue Nov 14 19:56:59 GMT 2006

I was wondering if anyone has seen this behavior and could give me some

In a class that inherits from Class::DBI, say MyApp::Class, I have a
method which applies the 'reverse' function on a simple Perl array:


  push @foo, 'bar';
  @rev = reverse @foo

The result:

Can't locate object method "get" via package "bar" (perhaps you forgot
to load "bar"?) at /usr/lib/perl5/site_perl/5.8.7/Class/Accessor.pm line

This line is from make_accessor, which means that somehow the function
appears to be making a method call on the element 'bar'.  I'm guessing
that it has something to do with the fact that Perl's reverse works 'by
moving pointers around'.

Would it be possible to avoid this situation (other than writing my own
reverse method)?  

Please, if your answer is to switch a different ORM alternative, that's
not an option right now.

I appreciate any help.



More information about the ClassDBI mailing list