From: Vincent Pit Date: Sun, 1 Aug 2010 22:58:23 +0000 (+0200) Subject: Localize the die handler when requiring for autocoercion X-Git-Tag: v0.02~5 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=a8c5cc8217c83c853306a8f89879471c09b84210;p=perl%2Fmodules%2FLaTeX-TikZ.git Localize the die handler when requiring for autocoercion This speeds up things vastly when a slow die handler (e.g. \&Carp::confess) is set. --- diff --git a/lib/LaTeX/TikZ/Meta/TypeConstraint/Autocoerce.pm b/lib/LaTeX/TikZ/Meta/TypeConstraint/Autocoerce.pm index 9c65f36..165794c 100644 --- a/lib/LaTeX/TikZ/Meta/TypeConstraint/Autocoerce.pm +++ b/lib/LaTeX/TikZ/Meta/TypeConstraint/Autocoerce.pm @@ -121,7 +121,14 @@ sub load { return 0 if $INC{$pm}; # already loaded local $@; - eval { require $pm; 1 }; + eval { + # We die often here, even though we're not really interested in the error. + # However, if a die handler is set (e.g. to \&Carp::confess), this can get + # very slow. Resetting the handler shows a 10% total time improvement for the + # geodyn app. + local $SIG{__DIE__}; + require $pm; + }; return 0; }