[kw-pm] potentially dumb perl question regarding packages

Quantum Mechanic quantum.mechanic.1964 at gmail.com
Thu Oct 27 13:45:04 PDT 2005


To broach a pun, the author may have been "packaging" a number of modules
into a single file, simply by concatenating the files together. That would
also help explain the "1;" in your example.

On 10/27/05, Robert P. J. Day <rpjday at mindspring.com> wrote:
>
>
> some perl code i've inherited has a number of ".pl" files with the
> following structure -- consider a sample file fred.pl:
>
> =============================
>
> #!/usr/bin/perl
> ...
>
> package fred;
>
> ... executable code ...
>
> 1;
>
> ==============================
>
> i understand the concept of defining a package name in a .pm file,
> but this is just a regular executable file and it doesn't appear to
> need to be part of any package.
>
> what is the rationale for defining a package for a top-level
> executable file?
>
> rday
>
> p.s. this file *does* "use" a number of module files, but they have
> no relation to the above package name in any way.
> _______________________________________________
> kw-pm mailing list
> kw-pm at pm.org
> http://mail.pm.org/mailman/listinfo/kw-pm
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/kw-pm/attachments/20051027/c99ce479/attachment.html


More information about the kw-pm mailing list