From: Vincent Pit Date: Mon, 6 Dec 2010 13:08:08 +0000 (+0100) Subject: Sanitize LaTeX::TikZ::Set::{layer,clip} X-Git-Tag: rt87282~22 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=58ac8fce7c7d1d825f90340434ca71b1b9da843b;p=perl%2Fmodules%2FLaTeX-TikZ.git Sanitize LaTeX::TikZ::Set::{layer,clip} --- diff --git a/lib/LaTeX/TikZ/Set.pm b/lib/LaTeX/TikZ/Set.pm index 47363a4..cf2386d 100644 --- a/lib/LaTeX/TikZ/Set.pm +++ b/lib/LaTeX/TikZ/Set.pm @@ -148,11 +148,12 @@ This is a shortcut for C<< $set->mod(Tikz->layer($layer)) >>. =cut sub layer { - return $_[0] unless @_ > 1; + my $set = shift; - my $layer = $_[1]; + return $set unless @_; - $_[0]->mod( + my $layer = $_[0]; + $set->mod( $ltml_tc->check($layer) ? $layer : LaTeX::TikZ::Mod::Layer->new(name => $layer) ) @@ -166,12 +167,14 @@ This is a shortcut for C<< $set->mod(Tikz->clip($path)) >>. =cut sub clip { - return $_[0] unless @_ > 1; + my $set = shift; + + return $set unless @_; - $_[0]->mod( + $set->mod( map { $ltmc_tc->check($_) ? $_ : LaTeX::TikZ::Mod::Clip->new(clip => $_) - } @_[1 .. $#_] + } @_ ) }