> From: Chris Devers <[EMAIL PROTECTED]>
> On Wed, 21 Jul 2004, Timothy Kohl wrote:
>
> > for example
> >
> > use CGI qw(:cgi-lib)
> >
> > I realize this is for grabbing a portion of a larger .pm
> > file, but how does it differ from say
> >
> > use LWP::Simple;
>
> You mean aside from being completely different libraries? :-)
>
> You've basically got it: by specifying what parts of a module you want
> to import into your own code, you're explicitly using only the aspects
> of the library that are relevant to what you want to do.
>
> This can keep your runtime code a bit smaller, and by extension faster.
> It can also keep things cleaner, in that you're less likely to have
> conflicts between your own variables & functions and the ones that came
> from parts of the module you aren't interested in.
>
> It's a funny question, now that you ask it -- isn't it just intuitively
> obvious that restricting & specifying things this way is a good habit?
>
By digging into CGI.pm, I do see the differences (thanks to all who
responded btw). My main puzzlement was the :small-piece syntax.
Looking at CGI.pm, I see, for example
%EXPORT_TAGS = (
.
.
.
':cgi-lib' => [qw/ReadParse PrintHeader HtmlTop HtmlBot SplitParam Vars/],
etc.
)
so that the ':' is a convention.
I understand LWP::Simple a little better in that
contained within the library area of the Perl tree
is LWP.pm as well as a subdirectory LWP wherein is
a separate Simple.pm file. I don't know if this too
is a convention, but it's a sensible convetion if it is.
-T
_______________________________________________
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm