in reply to Re^3: An Interesting Gotcha With use/require
in thread An Interesting Gotcha With use/require

Th thing I find interesting is that one useful solution to this problem that I can think of has everything to do with import. If the op had written:

use File::BaseName qw(basename)

then Perl could add a sanity check to its internal import() call to throw an error if import is missing but args have been provided as its almost certainly an error of some sort. Of course it doesnt right now, but it IMO it should.

---
demerphq

Replies are listed 'Best First'.
Re^5: An Interesting Gotcha With use/require
by Anonymous Monk on Feb 10, 2005 at 09:17 UTC
    That only helps for modules that export anything. OO-modules typically export nothing, and hence, don't have an import module.
Re^5: An Interesting Gotcha With use/require
by Anonymous Monk on Feb 10, 2005 at 11:07 UTC
    But in order to know an import is missing, Perl first needs to compile the module. However, if Perl compiles the module, the "subroutine redefined" warnings are being thrown.

    You suggested check would have thrown another warning/error, but it wouldn't have eliminated the ones the OP was getting. I'm not sure that a warning "File::BaseName::import not found" would have been very helpful.