Exporter & Class::DBI
Anonymous Monk
created: 2006-04-01 17:24:17
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?
Re: Exporter & Class::DBI
created: 2006-04-01 19:17:41

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 CPAN://Class::DBI.

perlmonks.org content © perlmonks.org and Anonymous Monk, chromatic

prlmnks.org © 2006 edmund von der burg (eccles & toad)

v 0.03