From: Vincent Pit Date: Sun, 1 Aug 2010 20:34:05 +0000 (+0200) Subject: LT::Functor: don't process the mods at all if the new set is the same as the old one X-Git-Tag: v0.02~12 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FLaTeX-TikZ.git;a=commitdiff_plain;h=70bf7dc15c8554386d2eb47fbc3d8233e5d52928 LT::Functor: don't process the mods at all if the new set is the same as the old one --- diff --git a/lib/LaTeX/TikZ/Functor.pm b/lib/LaTeX/TikZ/Functor.pm index efa66a0..4ccfd32 100644 --- a/lib/LaTeX/TikZ/Functor.pm +++ b/lib/LaTeX/TikZ/Functor.pm @@ -144,9 +144,10 @@ sub new { } } } - my $new_set = $rule ? $rule->handler->($self, $set, @_) - : $set; - my $is_new = $new_set ne $set; + return $set unless $rule; + + my $new_set = $rule->handler->($self, $set, @_); + return $set if $new_set eq $set; my @new_mods; MOD: @@ -163,8 +164,7 @@ MOD: push @new_mods, $rule ? $rule->handler->($self, $mod, @_) : $mod; } - - $new_set->mod(@new_mods) if $is_new; + $new_set->mod(@new_mods); return $new_set; }, $class;