]> git.vpit.fr Git - perl/modules/LaTeX-TikZ.git/blobdiff - lib/LaTeX/TikZ/Mod/Pattern/Dots.pm
Enforce the non-negativity of some attributes with anonymous types
[perl/modules/LaTeX-TikZ.git] / lib / LaTeX / TikZ / Mod / Pattern / Dots.pm
index b029915d02c60b3b506ebcd4c2780ee9a6b1892d..45714b1f3b0a5c71d1949594b0329067e85f8f48 100644 (file)
@@ -18,18 +18,19 @@ our $VERSION = '0.01';
 use Sub::Name ();
 
 use Any::Moose;
+use Any::Moose 'Util::TypeConstraints';
 
 extends 'LaTeX::TikZ::Mod::Pattern';
 
 has 'dot_width' => (
  is      => 'ro',
- isa     => 'Int',
+ isa     => subtype('Num' => where { LaTeX::TikZ::Tools::numcmp($_, 0) >= 0 }),
  default => 1,
 );
 
 has 'space_width' => (
  is      => 'ro',
- isa     => 'Int',
+ isa     => subtype('Num' => where { LaTeX::TikZ::Tools::numcmp($_, 0) >= 0 }),
  default => 1,
 );