Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I'm having problems with Exporting Class::DBI methods.
What I'm trying to do is wrap some of the methods in my Class::DBI module mostly to save typing. i.e. instead of
My_mod->get_something()
I want to say
get_something()
Problem is how? What I'm trying is
package My_mod; require Exporter; @ISA = qw(Exporter Class::DBI); @EXPORT = qw/get_something/; use My_mod::table1;
But Perl complains
Can't locate object method "table" via package "My_mod::table1" at My_ +mod/table1.pm line 6.
Why does putting Class::DBI in @ISA not work?

Replies are listed 'Best First'.
Re: Exporter & Class::DBI
by chromatic (Archbishop) on Apr 02, 2006 at 00:17 UTC

    They're methods, not functions. Methods need an invocant. That's why they're methods, not functions.

    If you really want to do this, you have to install thunk functions in your package that, presumably, close over the invocant class name and call the methods directly. If you do that though, there's little reason to inherit from Class::DBI.