in reply to Re: Re: Calling a subroutine located in a module
in thread Calling a subroutine located in a module

May be it is out of the thread but I must say a word.

Be carefull with base pragma, it will only require your base modules, not use them! So import subroutines of the base modules will be ignored.

A spot from documentation:

----------- package Baz; use base qw(Foo Bar);
Roughly similar in effect to
BEGIN { require Foo; require Bar; push @ISA, qw(Foo Bar); } ----------

An example:

---------- ### File A.pm package A; sub import { warn "A imported"; } ---------- ### File X.pm package X; use base qw(A); sub import { warn "X imported"; } ---------- ### File Y.pm package Y; use A; use base qw(A); sub import { warn "Y imported"; } ----------- ### File Z.pm package Z; use A; @ISA = qw(A); sub import { warn "Z imported"; } ----------

And now:

bash$ perl -e 'use X' import X at X.pm line 7. bash$ perl -e 'use Y' import A at A.pm line 5. import Y at Y.pm line 8. bash$ perl -e 'use Z' import A at A.pm line 5. import Z at Z.pm line 9.

You can see base module A is not imported in the first case.

-- brother ab