]> git.vpit.fr Git - perl/modules/LaTeX-TikZ.git/blobdiff - lib/LaTeX/TikZ/Point.pm
This is 0.03
[perl/modules/LaTeX-TikZ.git] / lib / LaTeX / TikZ / Point.pm
index 3c2446915862b778d360e4530ad29281022b9df6..54a158e3662cc7c0ab3389365c6480df53208c42 100644 (file)
@@ -9,20 +9,26 @@ LaTeX::TikZ::Point - Internal representation of what LaTeX::TikZ consider as 2D
 
 =head1 VERSION
 
-Version 0.01
+Version 0.03
 
 =cut
 
-our $VERSION = '0.01';
+our $VERSION = '0.03';
 
-use Any::Moose;
-use Any::Moose 'Util::TypeConstraints' => [ qw/
- coerce
- from
- via
+use Mouse;
+use Mouse::Util::TypeConstraints qw<
+ coerce from via
  find_type_constraint
  register_type_constraint
-/ ];
+>;
+
+=head1 ATTRIBUTES
+
+=head2 C<x>
+
+The abscissa of the point.
+
+=cut
 
 has 'x' => (
  is       => 'ro',
@@ -30,6 +36,12 @@ has 'x' => (
  required => 1,
 );
 
+=head2 C<y>
+
+The ordinate of the point.
+
+=cut
+
 has 'y' => (
  is       => 'ro',
  isa      => 'Num',
@@ -41,7 +53,7 @@ use LaTeX::TikZ::Meta::TypeConstraint::Autocoerce;
 register_type_constraint(
  LaTeX::TikZ::Meta::TypeConstraint::Autocoerce->new(
   name   => 'LaTeX::TikZ::Point::Autocoerce',
-  parent => find_type_constraint(__PACKAGE__),
+  target => find_type_constraint(__PACKAGE__),
  ),
 );
 
@@ -49,8 +61,20 @@ coerce 'LaTeX::TikZ::Point::Autocoerce'
     => from 'LaTeX::TikZ::Point'
     => via { $_ };
 
+coerce 'LaTeX::TikZ::Point::Autocoerce'
+    => from 'Num'
+    => via { LaTeX::TikZ::Point->new(x => $_, y => 0) };
+
+coerce 'LaTeX::TikZ::Point::Autocoerce'
+    => from 'ArrayRef'
+    => via { LaTeX::TikZ::Point->new(x => $_->[0], y => $_->[1]) };
+
 __PACKAGE__->meta->make_immutable;
 
+=head1 SEE ALSO
+
+L<LaTeX::TikZ>.
+
 =head1 AUTHOR
 
 Vincent Pit, C<< <perl at profvince.com> >>, L<http://www.profvince.com>.
@@ -70,7 +94,7 @@ You can find documentation for this module with the perldoc command.
 
 =head1 COPYRIGHT & LICENSE
 
-Copyright 2010 Vincent Pit, all rights reserved.
+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.