Don't forget to say

use strict; use warnings;
at the beginning of your modules and scripts, unless you have a very good reason not to do it.

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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.