from http://www.greglondon.com/iperl/html/iperl.html#9_The_use_Statement_Formally

The "use" statement can be formally defined as this:

     use MODULENAME ( LISTOFARGS );

The "use" statement is exactly equivalent to this:

     BEGIN

     {

           require MODULENAME;

           MODULENAME->import( LISTOFARGS );

     }

So, functionally, the difference is your :one_piece is
part of LISTOFARGS that then gets passed to the
import method if an import method is defined
and this will cause additional behaviour to occur
based on :one_piece.

This allows all users of a module to get a default
behaviour, plus any additional behaviour that is
caused by the import method and any arguments passed
into the 'use' statement.

I think you can avoid duplicating code this way
because you don't have to have
Module::First
Module::Second
Module::Third

instead you can have Module and pass in First,Second,
and/or Third when you use Module.




Timothy Kohl said:
> This is almost certainly RTFM but
> what is the rationale behind
> something like this.
>
> use Blah qw(:one_piece);
>
> 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;
>
> Inquiring mind(s) would like to know.
>
>                 -T
>
>
>       **********************************************************
>       * Dr. Timothy Kohl                                       *
>       * Boston University                                      *
>       * Office of Information Technology                       *
>       * 111 Cummington Street                                  *
>       * Boston, MA 02215                                       *
>       **********************************************************
>       * Computer Consultant/Lecturer - Mathematics Department  *
>       **********************************************************
>       * Office: MCS 235       Phone: (617) 353-8203            *
>       * email: [EMAIL PROTECTED]   FAX:   (617) 353-8100       *
>       * http://math.bu.edu/people/tkohl                        *
>       **********************************************************
>
> _______________________________________________
> Boston-pm mailing list
> [EMAIL PROTECTED]
> http://mail.pm.org/mailman/listinfo/boston-pm
>
>


-- 
"Impatient Perl"
A GNU-FDL training manual for the hyperactive.
Free HTML/PDF downloads at greglondon.com/iperl
Paperback/coilbound available for $8.50+s&h

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

Reply via email to