X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FLaTeX-TikZ.git;a=blobdiff_plain;f=lib%2FLaTeX%2FTikZ%2FFunctor.pm;h=1f4b4815ec2ba4bd50d8a06540257d6bc3d7e5d4;hp=7e64142f1402b9d5a3b7cc13df143fe8f313deb5;hb=e9a8988fafa35496f2a28987b492290f06e3bd54;hpb=594156dad44851e8a31499dfb83b9c6f089abdd4 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.