File Coverage

blib/lib/LaTeX/TikZ/Set/Line.pm
Criterion Covered Total %
statement 22 24 91.6
branch n/a
condition n/a
subroutine 8 10 80.0
pod 3 4 75.0
total 33 38 86.8


line stmt bran cond sub pod time code
1             package LaTeX::TikZ::Set::Line;
2              
3 10     10   37 use strict;
  10         11  
  10         277  
4 10     10   37 use warnings;
  10         12  
  10         316  
5              
6             =head1 NAME
7              
8             LaTeX::TikZ::Set::Line - A set object representing a line.
9              
10             =head1 VERSION
11              
12             Version 0.03
13              
14             =cut
15              
16             our $VERSION = '0.03';
17              
18 10     10   31 use LaTeX::TikZ::Set::Point;
  10         13  
  10         153  
19              
20 10     10   29 use LaTeX::TikZ::Interface;
  10         8  
  10         123  
21 10     10   29 use LaTeX::TikZ::Functor;
  10         12  
  10         137  
22              
23 10     10   34 use Mouse;
  10         19  
  10         44  
24              
25             =head1 RELATIONSHIPS
26              
27             This class consumes the L role, and as such implements the L method.
28              
29             =cut
30              
31             with 'LaTeX::TikZ::Set::Path';
32              
33             =head1 ATTRIBUTES
34              
35             =head2 C
36              
37             The first endpoint of the line, as a L object.
38              
39             =cut
40              
41             has 'from' => (
42             is => 'ro',
43             isa => 'LaTeX::TikZ::Set::Point',
44             required => 1,
45             coerce => 1,
46             );
47              
48             =head2 C
49              
50             The second endpoint of the line, also as a L object.
51              
52             =cut
53              
54             has 'to' => (
55             is => 'ro',
56             isa => 'LaTeX::TikZ::Set::Point',
57             required => 1,
58             coerce => 1,
59             );
60              
61             =head1 METHODS
62              
63             =head2 C
64              
65             =cut
66              
67             sub path {
68 9     9 1 8 my $set = shift;
69              
70 9         27 $set->from->path(@_) . ' -- ' . $set->to->path(@_);
71             }
72              
73             =head2 C
74              
75             =cut
76              
77 0     0 1 0 sub begin { $_[0]->from->begin }
78              
79             =head2 C
80              
81             =cut
82              
83 0     0 1 0 sub end { $_[0]->to->end }
84              
85             LaTeX::TikZ::Interface->register(
86             line => sub {
87 3     3 0 1159 shift;
88              
89 3         25 __PACKAGE__->new(from => $_[0], to => $_[1]);
90             },
91             );
92              
93             LaTeX::TikZ::Functor->default_rule(
94             (__PACKAGE__) => sub {
95             my ($functor, $set, @args) = @_;
96             $set->new(map { $_ => $set->$_->$functor(@args) } qw)
97             }
98             );
99              
100             __PACKAGE__->meta->make_immutable;
101              
102             =head1 SEE ALSO
103              
104             L, L.
105              
106             =head1 AUTHOR
107              
108             Vincent Pit, C<< >>, L.
109              
110             You can contact me by mail or on C (vincent).
111              
112             =head1 BUGS
113              
114             Please report any bugs or feature requests to C, or through the web interface at L.
115             I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
116              
117             =head1 SUPPORT
118              
119             You can find documentation for this module with the perldoc command.
120              
121             perldoc LaTeX::TikZ
122              
123             =head1 COPYRIGHT & LICENSE
124              
125             Copyright 2010,2011,2012,2013,2014,2015 Vincent Pit, all rights reserved.
126              
127             This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
128              
129             =cut
130              
131             1; # End of LaTeX::TikZ::Set::Line