On Jul 15, Connie Chan said:

>sub A {
>  my ($case) = shift;
>  if ($case == 0) { require "lib0.pl" ; use somePm; use anotherPm ; &doSth(...) }
>  if ($case == 1) { require "lib1.pl" ; use somePm; use anotherPm ; &doSthEls(...) }
>  if ($case == 2) { require "lib2.pl" ; use somePm; use anotherPm ; 
>&doSthAnotherEls(...)}
>}
>
>sub B {
>  my ($case) = shift;
>  #  something similar to A
>}
>
>sub C {
>  my ($case) = shift;
>  #  something similar to A
>}

>Say, if above is called by require, then I think it probrably those
>inline reqire and use are calling when the sub is called and when the
>case is matched... however, what about the above finally becomes a .pm
>would those use, require will be loaded once I use the above pm ?

When the file is included, the 'use's are executed IMMEDIATELY.  The fact
that they're in functions doesn't matter.  The require()s will not be
executed until (and unless) the functions they are in are called.

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to