Thousand thanks for this very valuable lesson. Some pieces of code are
always better than reading 100s of docs. I am really understanding it now.
My previous problem is what will be the difference of use inside require,
require inside use, use inside use, and require inside require. The final
ans
On Jul 15, Connie Chan said:
>When Perl read my code, if in 'use' case, would it load everything
>existed in my modules, and won't care on how I defined the use
>and require method in my if (...) {...} case ?
Let's answer this by example. I'm going to produce several files here.
### ABC.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.
>
Thanks alot Jeff, I think I can target my question now...
What I want to ask
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
> > As what I've learnt, 'use' is working during the compile time,
> > where 'require' works at runtime, however, I have problem on
> > understand this..
> >
> > ### code ###
> > sub A
> > {my ($case) = shift;
> > if ($case == 0) { require "lib0.pl" ; use somePm; use
> > anotherPm
> -Original Message-
> From: Connie Chan [mailto:[EMAIL PROTECTED]]
> Sent: Monday, July 15, 2002 9:56 AM
> To: [EMAIL PROTECTED]
> Subject: require v. use
>
>
> As what I've learnt, 'use' is working during the compile time,
> where 'require' works at runtime, however, I have problem on