From: "Paul Cochrane" <[EMAIL PROTECTED]>
Date: Tue, 24 Oct 2006 11:49:23 +0200
Amos and Chris,
Thanks for the feedback! I've updated the patch to use C<require>
instead of C<use>, and it is attached to this email.
Further to my question:
so do C<eval { use My::Class; };> and C<eval "use My::Class;";> get
evaluated at different times? I'm trying to understand why one
generates a compile-time error, whereas the other generates the
expected output (i.e. skips the tests and supplies the reason) but
that the docs say they are (almost) the same thing.
Here is the difference:
eval "use My::Class;"; does the following:
1. Sets up the run-time error-catching mechanism.
2. Compiles the expression (which tries to load My::Class).
3. Executes the rest of the expression (which does nothing).
4. Tears down the run-time error-catching mechanism.
eval { use My::Class; }; tries to do the following:
1. Compiles the expression (while compiling the containing block).
2. Sets up the run-time error-catching mechanism.
3. Executes the rest of the expression (which does nothing).
4. Tears down the run-time error-catching mechanism.
Since 'use' happens entirely at compile time, the eval-block case can't
catch any errors from 'use', and it fails in step 1.
-- Bob Rogers
http://rgrjr.dyndns.org/