Don't forget to say
at the beginning of your modules and scripts, unless you have a very good reason not to do it.use strict; use warnings;
Probably, method1 from one.pm is not getting called, but instead a stub that does nothing -- this is a "goodness" of not using strict (a promiscuous way to being too forgiven with unresolved symbols).
You will realize that if use strict; use warnings; were added, this will work as you expect, printing "its heremethod1 greets hellohere". But it is not right yet. The remaining issue is that to tell a package is inheriting the exporter capabilities from Exporter, you need
require Exporter; our @ISA = qw(Exporter); our @EXPORT = qw(method1);
The require statement will load Exporter.pm for you. (And our will be need if you're "strict".) Why does it work only inserting use strict; use warnings; in two.pl? Because some of these load Exporter and it becomes accessible as a side effect to the remaining of the script. This is not a thing to rely on. So I suggest you do the right thing: being strict, calling for warnings, requiring what you need. This will work always, not sometimes.
In reply to Re: Issue with Exporter
by ferreira
in thread Issue with Exporter
by palette
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |