The short answer is that TeamSite::Config is an object-oriented module whereas File::Copy is a functional module.

With your proprietory module, $handle becomes an object of class TeamSite::Config; you then call methods like this: $handle->method_name().

Here's some documentation that may be of help: search for Perl OO on the perl manpage. Update: also perlobj - Perl objects.

The details regarding the File::Copy side of things can be found in the documentation for the use function and the Exporter module. Here's a few notes regarding your specific case - this is an oversimplification so do read the doco for full details.

Some modules export functions automatically. If your code is written as:

use File::Copy;

Taking a quick peek at File::Copy's source code:

@EXPORT = qw(copy move); @EXPORT_OK = qw(cp mv);

You'll find move and copy are exported automatically (@EXPORT); while cp and mv are optional (@EXPORT_OK). You could choose to use the abbreviated names with: use File::Copy qw{cp mv}; or decide to disallow any exports with: use File::Copy ();.

Documentation for @EXPORT, @EXPORT_OK and %EXPORT_TAGS is often lacking; I typically check the source rather than rely on what the documentation is telling me.

Finally, just because TeamSite::Config is an object-oriented module does not mean it cannot also export functions or data. Check your in-house doco.

-- Ken


In reply to Re: Use of Handle to use subroutines in a module by kcott
in thread Use of Handle to use subroutines in a module by manishrathi

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.