This is essentially the same answer as others have provided but if you don't understand their answers perhaps this manner of expressing them will help...

'use Mymodule ();' causes Mymodule to be loaded without calling its import() subroutine. This makes the subroutines of the module available and will cause BEGIN, UNITCHECK, CHECK and INIT blocks to be executed if they exist.

The import() subroutine of many (not all) modules will add variables or subroutines to the callers name space.

You sometimes want to load the module but do not want it to add anything to your name space. For example - you may have your own subroutines of the same name as the module would create (import) if its import() subroutine was called.

Having loaded the module, you can access its subroutines using fully qualified subroutine or method calls. For example, Mymodule::some_subroutine() or Mymodule->some_method.

In some modules the import() subroutine does other things as well as or instead of importing names into the callers name space. If the module is doing initialization in its import() subroutine, then it may not work as expected when you prevent the subroutine being called. You should read the documentation or the code of the module you are using to be sure.


In reply to Re: Module usage by ig
in thread Module usage by vinoth.ree

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.