Vincent Pit


LaTeX::TikZ::Functor::Rule - An object that specifies how functors should handle a certain kind of set or mod.


Version 0.02


A rule specifies how functors (LaTeX::TikZ::Functor objects) should handle a certain kind of set or mod. A functor is basically an ordered collection of rules.



A class or role name against which set or mod candidates will be matched. It must consume either LaTeX::TikZ::Set or LaTeX::TikZ::Mod, directly or through inheritance.


The code reference executed when the rule handles a given set or mod object. It is called with the LaTeX::TikZ::Functor object as its first argument, the set/mod object as its second, and then the arguments passed to the functor itself.


True if and only if the target is a role.


True when the target does the LaTeX::TikZ::Set role, and false when it does LaTeX::TikZ::Mod.


new target => $target, handler => $handler

Constructs a new rule object with target $target and handler $handler.

insert into => \@list, overwrite => $overwrite, replace => $replace

Inserts the current rule into the list of rules @list.

If $replace is false, then the rule will be appended to the @list ; except if there already is an existent entry for the same target, in which case it will be overwritten if $overwrite is true, or an exception will be thrown if it is false.

If $replace is true, then the rule will replace the first rule in the list that is a subclass or that consumes the role denoted by the target. All the subsequent rules in the list that inherit or consume the target will be removed.

handles $obj

Returns true if and only if the current rule can handle the object or class/role name $obj.


LaTeX::TikZ, LaTeX::TikZ::Functor.


Vincent Pit, <perl at>,

You can contact me by mail or on (vincent).


Please report any bugs or feature requests to bug-latex-tikz at, or through the web interface at I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.


You can find documentation for this module with the perldoc command.

    perldoc LaTeX::TikZ


Copyright 2010 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.

Hosting generously
sponsored by Bytemark