The use of the colon (:) in these 2 contexts is not at all related!

1) Package delimiter - ::
:: is THE delimiter for package scoping, as defined by Perl's official
syntax.  LWP::Simple refers to a package Simple which is contained
within the LWP package.  This is expressed at the filesystem level by
making each component of the package namespace it's own subdirectory. 
So then you get things like .../LWP/Simple.pm.

2) Exporter tag lists - :
When you say "use CGI qw(:cgi-lib);" this does not mean there is a
package called CGI::cgi-lib.  This :small-part syntax is indeed just a
convention originating with the Exporter package (check the Exporter
documentation for more info).  When you "use" a package with a list of
parameters, those parameters get passed to the import() function in that
package.  Usually this parameter list is used to specify which symbols
the caller wants exported into its own namespace for convenience. 
Exporter provides an import() function that lets a package author
specify common groups of symbols to export together, to make life easier
on the package user.  A group name is distinguished from an individual
symbol name by prefixing it with a single colon.  This was just the
convention that the author of Exporter chose and is not official Perl
syntax.  Now CGI.pm actually throws a curveball here and implements
their own import() function which does things similarly to Exporter
(including using colon as a group flag), but does not actually use
Exporter.

Sorry, that might be a little bit heavy, but read it again after looking
at the documentation for Exporter and perlmod and it might make more
sense.


 -- Jeremy


On Wed, 2004-07-21 at 15:48, Timothy Kohl wrote:

> By digging into CGI.pm, I do see the differences (thanks to all who
> responded btw). My main puzzlement was the :small-piece syntax.

> 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.


_______________________________________________
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to