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,
);
has 'line_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,
);
coerce => 1,
);
-subtype 'LaTeX::TikZ::Set::Circle::Radius'
- => as 'Num'
- => where { LaTeX::TikZ::Tools::numcmp($_, 0) >= 1 }
- => message { "$_ isn't a non-negative real number" };
-
has 'radius' => (
is => 'ro',
- isa => 'LaTeX::TikZ::Set::Circle::Radius',
+ isa => subtype('Num' => where { LaTeX::TikZ::Tools::numcmp($_, 0) > 0 }),
required => 1,
);
eval {
Tikz->circle($o => -1);
};
-like $@, qr/isn't a non-negative real number/,
+like $@, failed_valid('__ANON__'),
'creating a circle with a negative radius croaks';
# Arc