X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=lib%2FLaTeX%2FTikZ%2FFunctor.pm;h=ac51ccf73d2d763331a2b6693fd1bf8050395677;hb=61a93a58351bf2d238dcf81a1a557112b0c0ee85;hp=f71ce6cd5a03fb90c6b44c43e5b1ba1407dbda5d;hpb=49f458095574464e32c53c24bea8657f452b7f25;p=perl%2Fmodules%2FLaTeX-TikZ.git diff --git a/lib/LaTeX/TikZ/Functor.pm b/lib/LaTeX/TikZ/Functor.pm index f71ce6c..ac51ccf 100644 --- a/lib/LaTeX/TikZ/Functor.pm +++ b/lib/LaTeX/TikZ/Functor.pm @@ -80,7 +80,11 @@ BEGIN { =head1 METHODS -=head2 C<< new rules => [ $spec1 => $handler1, $spec2 => $handler2, ... ] >> +=head2 C + + my $functor = LaTeX::TikZ::Functor->new( + rules => [ $spec1 => $handler1, $spec2 => $handler2, ... ], + ); Creates a new functor object that will use both the default and the user-specified rules. The functor is also a code reference that expects to be called against L objects. @@ -91,7 +95,7 @@ The default set and mod rules clone their relevant objects, so you get a clone f my $clone = Tikz->functor; my $dup = $set->$clone; -If there is already a default rule for one of the C<$spec>s, it is replaced by the new one ; otherwise, the user rule is appended to the list of default rules. +If there is already a default rule for one of the C<$spec>s, it is replaced by the new one ; otherwise, the user rule is inserted into the list of default rules after all its descendants' rules and before all its ancestors' rules. # A translator my $translate = Tikz->functor( @@ -204,11 +208,13 @@ LaTeX::TikZ::Interface->register( }, ); -=head2 C<< default_rule $spec => $handler >> +=head2 C + + LaTeX::TikZ::Functor->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 default rules. +An exception is thrown if there is already a default rule for C<$spec> ; otherwise, the new rule is inserted into the current list of default rules after all its descendants' rules and before all its ancestors' 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. @@ -256,7 +262,7 @@ You can find documentation for this module with the perldoc command. =head1 COPYRIGHT & LICENSE -Copyright 2010 Vincent Pit, all rights reserved. +Copyright 2010,2011,2012,2013,2014,2015 Vincent Pit, all rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.