I'm confused by the answers you have received so far in this thread.

Firstly, if the Module in question is a OO style module, then the only time you need to use the full module name is when you instanciate it:

my $BUGA = Bric::Util::Grp::Asset->new();

from that point on, every method you call upon that instance, you call with the syntax:   $BUGA->method( @args );

Where modules have procedural interfaces (or class methods), then the usual mechanisms for importing individual entrypoints or predefined groups of enterypoints is to use the use Module IMPORT-LIST; syntax (See perlfunc:use.

A breif look at the Bricolage stuff shows that many of the (many, many!) modules support this syntax for importing individual api's or in groups through the use of group selectors ':standard', ':all' and others.

So, in answer to your question: Shouldn't use do this?, I would say the answer is: Yes, and it does:).

Of course, it requires that the modules in question support the syntax, but in the case of Bricolage, it seems that most if not all of them do in as far as it makes sense to.

As for why the Bricolage documentation doesn't exemplify this, choosing to show every call in the full

Module::Submodule::SubSubMod::SubSubSubMod::function()

form (and yes, they really do go that deep!:), I can only speculate at. I did notice that there seems to be an uncommonly large amount of re-use of namespace at different levels of the hierachy, (eg. Asset.pm, Addr.pm, Auth.pm, Contact.pm, Data.pm all appearing twice in the tree, Action.pm appearing 3 times etc.)

Maybe they use the fully qualified names to ensure distinction. Maybe also, if you import :all from two or more of the individual modules you end up with namespace clashes?

If this is the case, then using an auto-import-everything-from-this-module routine is only going to compound matters further as you are likely to import similarly named private routines from the modules too.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller

In reply to Re: Pragma (more) like Java's 'import'? by BrowserUk
in thread Pragma (more) like Java's 'import'? by djantzen

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.