From: Vincent Pit Date: Sun, 22 Aug 2010 13:52:13 +0000 (+0200) Subject: LaTeX::TikZ::Tools::type_constraint shouldn't croak when it can't find the .pm file X-Git-Tag: rt87282~33 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=04d3984b7e9310f2d825c6458620a8c131bf3030;p=perl%2Fmodules%2FLaTeX-TikZ.git LaTeX::TikZ::Tools::type_constraint shouldn't croak when it can't find the .pm file --- diff --git a/lib/LaTeX/TikZ/Tools.pm b/lib/LaTeX/TikZ/Tools.pm index 4650acf..54e5009 100644 --- a/lib/LaTeX/TikZ/Tools.pm +++ b/lib/LaTeX/TikZ/Tools.pm @@ -51,7 +51,7 @@ sub numround { =head2 C -Find the type constraint for C<$class> by loading the relevant F<.pm> file beforehand. +Find the type constraint for C<$class> by first trying to load the relevant F<.pm> file. =cut @@ -61,7 +61,13 @@ sub type_constraint { my $file = $class; $file =~ s{::}{/}g; $file .= '.pm'; - require $file; + unless ($INC{$file}) { + local $@; + eval { + local $SIG{__DIE__}; # See LaTeX::TikZ::Meta::TypeConstraint::Autocoerce + require $file; + } + } find_type_constraint($class); }