From: Vincent Pit Date: Sun, 1 Aug 2010 16:14:00 +0000 (+0200) Subject: In LaTeX::TikZ::Functor, move ->default_rule after ->new X-Git-Tag: v0.02~16 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=e9a8988fafa35496f2a28987b492290f06e3bd54;p=perl%2Fmodules%2FLaTeX-TikZ.git In LaTeX::TikZ::Functor, move ->default_rule after ->new --- diff --git a/lib/LaTeX/TikZ/Functor.pm b/lib/LaTeX/TikZ/Functor.pm index 7e64142..1f4b481 100644 --- a/lib/LaTeX/TikZ/Functor.pm +++ b/lib/LaTeX/TikZ/Functor.pm @@ -122,29 +122,6 @@ BEGIN { =head1 METHODS -=head2 C<< default_rule $spec => $handler >> - -Adds to all subsequently created functors a default rule for the class or role C<$spec>. - -An exception is thrown if there is already a default rule for C<$spec> ; otherwise, the new rule is appended to the current list of rules. -But if C<$spec> begins with C<'+'>, the rule will replace I default rules that apply to subclasses or subroles of C<$spec> (including C<$spec> itself). - -Returns true if and only if an existent rule was replaced. - -=cut - -sub default_rule { - shift; - - my $rule = $validate_rule->(@_); - - $insert_rule->( - $rule, - $rule->[4] ? \@default_set_rules : \@default_mod_rules, - 0, - ); -} - =head2 C<< new rules => [ $spec1 => $handler1, $spec2 => $handler2, ... ] >> Creates a new functor object that will use both the default and these user-specified rules. @@ -260,6 +237,29 @@ LaTeX::TikZ::Interface->register( }, ); +=head2 C<< default_rule $spec => $handler >> + +Adds to all subsequently created functors a default rule for the class or role C<$spec>. + +An exception is thrown if there is already a default rule for C<$spec> ; otherwise, the new rule is appended to the current list of rules. +But if C<$spec> begins with C<'+'>, the rule will replace I default rules that apply to subclasses or subroles of C<$spec> (including C<$spec> itself). + +Returns true if and only if an existent rule was replaced. + +=cut + +sub default_rule { + shift; + + my $rule = $validate_rule->(@_); + + $insert_rule->( + $rule, + $rule->[4] ? \@default_set_rules : \@default_mod_rules, + 0, + ); +} + =head1 SEE ALSO L.