At 02:52 PM 3/8/01 +0000, you wrote:
>On Thu, Mar 08, 2001 at 02:59:27PM +0000, Robert Price wrote:
>> I think the answer is that both the modules where the BEGINS are called
>> twice have "use" in them. "use" means "BEGIN {require Module}", so BEGIN is
>> being called once when the module is entered, and once when it is used. 
>> Rob
>- SNIP -
>Fraid not.. tried moving the use out of the BEGIN before and it
>made no difference:
>package LTest;
>use Test2;
>        warn "Test is beginning\n";


But you are still calling "use", and as I said earlier, that means there
are still 2 BEGIN blocks, so both are being called. Test2 only has the one
BEGIN call because it doesn't try to use. 

For example, your code is roughly the same as...

package LTest;

BEGIN {require Test2};

        warn "Test is beginning\n";

So you can see there are two BEGIN blocks that are being called.

Or am I talking out of my arse? :-)


Robert Price - Technical Manager - EMAP Digital Travel  | Tel: 0207 3092711
Priory Court, 30-32 Farringdon Lane, London, EC1R 3AW   | Fax: 0207 3092718

Reply via email to