]> git.vpit.fr Git - perl/modules/LaTeX-TikZ.git/blobdiff - lib/LaTeX/TikZ/Set/Arrow.pm
This is 0.02
[perl/modules/LaTeX-TikZ.git] / lib / LaTeX / TikZ / Set / Arrow.pm
index cc10eab2bd35bb85aed5b513a402f758854d1f4c..d870cafb90576db72eb60a04dfea4ae77b55f11c 100644 (file)
@@ -9,11 +9,11 @@ LaTeX::TikZ::Set::Arrow - A combined set object representing an arrow.
 
 =head1 VERSION
 
-Version 0.01
+Version 0.02
 
 =cut
 
-our $VERSION = '0.01';
+our $VERSION = '0.02';
 
 use Carp;
 
@@ -21,33 +21,41 @@ use LaTeX::TikZ::Point;
 
 use LaTeX::TikZ::Set::Line;
 
+use LaTeX::TikZ::Interface;
+
 use Any::Moose 'Util::TypeConstraints' => [ 'find_type_constraint' ];
 
 my $ltp_tc = find_type_constraint('LaTeX::TikZ::Point::Autocoerce');
 
-use LaTeX::TikZ::Interface arrow => sub {
- shift;
-
- Carp::confess('Not enough arguments') unless @_ >= 2;
-
- my $from = $ltp_tc->coerce(shift);
-
- my $to;
- if ($_[0] eq 'dir') {
-  my $dir = $ltp_tc->coerce($_[1]);
-  $to = LaTeX::TikZ::Point->new(
-   x => $from->x + $dir->x,
-   y => $from->y + $dir->y,
-  );
- } else {
-  $to = $_[0];
- }
-
- LaTeX::TikZ::Set::Line->new(
-  from => $from,
-  to   => $to,
- )->mod('->');
-};
+LaTeX::TikZ::Interface->register(
+ arrow => sub {
+  shift;
+
+  Carp::confess('Not enough arguments') unless @_ >= 2;
+
+  my $from = $ltp_tc->coerce(shift);
+
+  my $to;
+  if ($_[0] eq 'dir') {
+   my $dir = $ltp_tc->coerce($_[1]);
+   $to = LaTeX::TikZ::Point->new(
+    x => $from->x + $dir->x,
+    y => $from->y + $dir->y,
+   );
+  } else {
+   $to = $_[0];
+  }
+
+  LaTeX::TikZ::Set::Line->new(
+   from => $from,
+   to   => $to,
+  )->mod('->');
+ },
+);
+
+=head1 SEE ALSO
+
+L<LaTeX::TikZ>, L<LaTeX::TikZ::Set>.
 
 =head1 AUTHOR