in reply to Re^4: "use Foo.pm" twice from inside different packages...
in thread "use Foo.pm" twice from inside different packages...

Arg. I just tried with my real code running perl 5.8.8, and it does actually a difference : use base 'Exporter' works, use Exporter doesn't (??!?!?). The module is absolutely trivial :
package DBtools; use strict; use warnings; use DBI; use Exporter; our @EXPORT=qw( dbconnect ); #sub definition sub dbconnect { my $config = shift; my $dbh = DBI->connect( 'DBI:' . $config->param('dbdriver') . ':dbname=' . $config->param('dbname') . ';host=' . $config->param('dbhost'), $config->param('dbuser'), $config->param('dbpassword'), { PrintError => 0, RaiseError => 1, AutoCommit => 0 } ); return ($dbh); } 1;
I'm going to stick with "use base" for now :/

Replies are listed 'Best First'.
Re^6: "use Foo.pm" twice from inside different packages...
by xdg (Monsignor) on Mar 03, 2006 at 13:31 UTC

    My bad. As per the Exporter docs, you need to request import explicitly. (You can see how rarely I actually do that!)

    package Blarg; use Exporter qw( import );

    I updated my earlier post.

    -xdg

    Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

      Thank you :)