File Coverage

blib/lib/LaTeX/TikZ/Mod.pm
Criterion Covered Total %
statement 12 12 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 16 16 100.0


line stmt bran cond sub pod time code
1             package LaTeX::TikZ::Mod;
2              
3 10     10   56 use strict;
  10         21  
  10         339  
4 10     10   54 use warnings;
  10         19  
  10         425  
5              
6             =head1 NAME
7              
8             LaTeX::TikZ::Mod - Base role for LaTeX::TikZ modifiers.
9              
10             =head1 VERSION
11              
12             Version 0.02
13              
14             =cut
15              
16             our $VERSION = '0.02';
17              
18             =head1 DESCRIPTION
19              
20             This role should be consumed by all the modifier classes.
21              
22             =cut
23              
24 10     10   52 use Any::Moose 'Role';
  10         19  
  10         57  
25 10     10   4122 use Any::Moose 'Util::TypeConstraints';
  10         21  
  10         43  
26              
27             =head1 METHODS
28              
29             These methods are required by the interface :
30              
31             =over 4
32              
33             =item *
34              
35             C<tag>
36              
37             Returns an identifier for the mod object.
38             It is used to gather mods together when calling C<covers> on them.
39              
40             =item *
41              
42             C<covers $mod>
43              
44             Returns true if and only if the effects of the mod C<$mod> are already ensured by the current mod object, in which case no actual TikZ code will be emitted for C<$mod>.
45             Both mod objects are guaranteed to have the same C<tag>.
46              
47             =item *
48              
49             C<declare $formatter>
50              
51             Returns an array reference of TikZ code lines required to declare this mod before using it, formatted by the L<LaTeX::TikZ::Formatter> object C<$formatter> ; or C<undef> if no declarations are needed for this mod.
52              
53             =item *
54              
55             C<apply $formatter>
56              
57             Returns the TikZ code that activates the current mod as a string formatted by the L<LaTeX::TikZ::Formatter> object C<$formatter>.
58              
59             =back
60              
61             =cut
62              
63             requires qw(
64             tag
65             covers
66             declare
67             apply
68             );
69              
70             coerce 'LaTeX::TikZ::Mod'
71             => from 'Str'
72             => via { LaTeX::TikZ::Mod::Raw->new(content => $_) };
73              
74             =head1 SEE ALSO
75              
76             L<LaTeX::TikZ>.
77              
78             =head1 AUTHOR
79              
80             Vincent Pit, C<< <perl at profvince.com> >>, L<http://www.profvince.com>.
81              
82             You can contact me by mail or on C<irc.perl.org> (vincent).
83              
84             =head1 BUGS
85              
86             Please report any bugs or feature requests to C<bug-latex-tikz at rt.cpan.org>, or through the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=LaTeX-TikZ>.
87             I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
88              
89             =head1 SUPPORT
90              
91             You can find documentation for this module with the perldoc command.
92              
93             perldoc LaTeX::TikZ
94              
95             =head1 COPYRIGHT & LICENSE
96              
97             Copyright 2010 Vincent Pit, all rights reserved.
98              
99             This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
100              
101             =cut
102              
103             1; # End of LaTeX::TikZ::Mod