I'm not sure if this is what you meant, but if you want to import "everything" into your own namespace by just one "use" statement, you can put this in Everything.pm:

package main; # mixin use IO::File qw(whatever); use Net::..... use SomethingElse; use EtCetera; 1;

This will put everything in the main namespace, which may be good enough for you. If, however, you want to call this from a different namespace and want everything imported there, you need some more magic than a (naive) mixin:

package Everything; sub import { my $pkg = caller; eval qq{ package $pkg; use This; use That; use And::So::On; 1; } or die $@; } 1;

That said, this is probably a bad idea if taken to the extreme. You'll have "namespace pollution", that is, the modules you use will fight for each other's subroutine names.

(Anyone know how to do this without the eval?)


In reply to Re: External script to hold common procedure calls by gaal
in thread External script to hold common procedure calls by bubbagump

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.