in reply to Re: Exporter. Correct way to override import?
in thread Exporter. Correct way to override import?

Thanks both Dave and roboticus,

The thing that I actually tried to solve was slightly different, but I decided to simplify the question because I just knew the problem was how I was using the import function.

What I was trying to do was:

# Foo package Foo ; use strict ; use warnings ; require Exporter ; our @ISA = qw( Exporter ) ; our @EXPORT_OK = qw( saySomethingElse ) ; # sub import { # Foo->export_to_level( 1, @_ ) ; # } sub saySomethingElse { print "Good morning!\n" ; } 1 ;
# Bar package Bar ; use strict ; use warnings ; use base qw( Foo ) ; 1 ;

In the next code, I wanted both lines to work because I am sometimes using the module Foo and sometimes the module Bar. The 'use Bar...' line refused to work.

# main use Bar qw ( saySomethingElse ) ; # use Foo qw ( saySomethingElse ) ; saySomethingElse() ;

Now that I have the import function correct, I got this to work

Thanks again to both of you! ++