Aman Vidura
Aman Vidura

Reputation: 85

Perl : inheritance - base and child class

Is it possible to import a base class having the same name as that of the package name in another location ?

package Foo;
use base 'Foo';

I have to use 'Foo' as the base class located in another location. Is it possible ?

Upvotes: 0

Views: 73

Answers (1)

Borodin
Borodin

Reputation: 126742

No you can't do that. A base class is the place Perl looks for a method that isn't defined in the current package.

If you wrote things like this and Perl failed to find Foo::method then it would look in the base class Foo::method and so the search would be endless.

Upvotes: 3

Related Questions