There are two reasons why you can do what you do, both of which are bad.
First you try to import methods from your parent class ... for some reason. You may have misunderstood how OO works. You do not need to do this. Just call the inherited methods as methods, and if these methods don't do something awkward, it will work fine.
Most likely, this is a mixed module, where some of them are methods, and some of them are imported functions. And for this you can do ...
use base 'Foo::Base'; use Foo::Base;
And you correctly noticed that it looks strange ... because it is rather strange. A class that also exports mixes idioms and this will lead to weird usage patterns.
Itโs best to redo the class instead of exporting the functions, or to separate the functions into your own module, or make them class methods. If functions really do not have much to do with the class, then it is best to unscrew them. If they belong to a class, then make them class methods.
use base 'Foo::Base'; Foo::Base->some_function_that_used_to_be_exported;
This eliminates interface mismatch, and as a bonus, subclasses can override class method behavior like any other method.
package Bar; use base 'Foo::Base'; # override sub some_function_that_used_to_be_exported { my($class, @args) = @_; ...do something extra maybe... $class->SUPER::some_function_that_used_to_be_exported(@args); ...and maybe something else... }
If you don't have control over the base class, you can still make the interface smart by writing a subclass that turns exported functions into methods.
package SaneFoo; use base 'Foo::Base';