Add an example for Mouse error checking
[gitmo/Mouse.git] / example / warns.pl
CommitLineData
950f02e5 1#!perl
2package Point;
3use Mouse;
4
5# extra 'unknown_attr' is supplied (WARN)
6has 'x' => (isa => 'Int', is => 'rw', required => 1, unknown_attr => 1);
7
8# mandatory 'is' is not supplied (WARN)
9has 'y' => (isa => 'Int', required => 1);
10
11sub clear {
12 my $self = shift;
13 $self->x(0);
14 $self->y(0);
15}
16
17__PACKAGE__->meta->make_immutable(strict_constructor => 1);
18
19package main;
20
21# extra 'z' is supplied (FATAL)
22my $point1 = Point->new(x => 5, y => 7, z => 9);