Commit | Line | Data |
---|---|---|
857f87a7 | 1 | |
2 | package MOP::Immutable::Point; | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | use metaclass; | |
7 | ||
8 | __PACKAGE__->meta->add_attribute('x' => (accessor => 'x')); | |
9 | __PACKAGE__->meta->add_attribute('y' => (accessor => 'y')); | |
10 | ||
11 | sub new { | |
12 | my $class = shift; | |
13 | $class->meta->new_object(@_); | |
14 | } | |
15 | ||
16 | sub clear { | |
17 | my $self = shift; | |
18 | $self->x(0); | |
19 | $self->y(0); | |
20 | } | |
21 | ||
22 | __PACKAGE__->meta->make_immutable; | |
23 | ||
24 | 1; | |
25 | ||
26 | __END__ |