++ed by:
EMAZEP

1 PAUSE user

Vincent Pit

NAME

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

VERSION

Version 0.03

DESCRIPTION

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.

ATTRIBUTES

target

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.

handler

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.

is_role

True if and only if the target is a role.

is_set

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

METHODS

new

    my $rule = LaTeX::TikZ::Functor::Rule->new(
     target  => $target,
     handler => $handler,
    );

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

insert

    my $has_replaced = $rule->insert(
     into      => \@list,
     overwrite => $overwrite,
     replace   => $replace,
    );

Inserts the current rule into the list of rules @list. The list is expected to be ordered, in that each rule must come after all the rules that have a target that inherits or consumes the original rule's own target.

If $replace is false, then the rule will be inserted into @list after all the rules applying to the target's subclasses/subroles and before all its superclasses/superroles ; except if there is already 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.

Returns true if and only if an existent rule was replaced.

handles

    $rule->handles($obj);

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

SEE ALSO

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

AUTHOR

Vincent Pit, <perl at profvince.com>, http://www.profvince.com.

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

BUGS

Please report any bugs or feature requests to bug-latex-tikz at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=LaTeX-TikZ. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

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

    perldoc LaTeX::TikZ

COPYRIGHT & LICENSE

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.