On 12/4/06, Mug <[EMAIL PROTECTED]> wrote:
> BEGIN {
> unshift (@INC, "/special");
> unshift (@INC, "/special/packages");
> }
>
> use strict;
> use InitGlobal;

And if I didn't get mis-understood on what I've studied, 'use' still
comes earlier than 'BEGIN{}', so what is the mystery why this
method can do that ?

In this particular case BEGIN comes first and simply tells Perl to
look at /special and /special/packages BEFORE looking anywhere else
for the packages you wish to "use" in your various projects.

You still need to make sure the proper functions/sub-routines are
"exported" so that your code is called in preference over the Perl
code.

However, if you wish to control what is "required" -- say branch
logic, you will need to stick with te 'require' directive as "use"
packages referenced will always be brought in even if they are not
called.

HTH/-Sx-
--
WC (Bill) Jones -- http://youve-reached-the.endoftheinternet.org/

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to