Merged CMOP into Moose
[gitmo/Moose.git] / benchmarks / cmop / lib / Plain / Point.pm
1 #!/usr/bin/perl
2
3 package Plain::Point;
4
5 use strict;
6 use warnings;
7
8 sub new {
9     my ( $class, %params ) = @_;
10     
11     return bless {
12         x => $params{x} || 10,
13         y => $params{y},
14     }, $class;
15 }
16
17 sub x {
18     my ( $self, @args ) = @_;
19
20     if ( @args ) {
21         $self->{x} = $args[0];
22     }
23
24     return $self->{x};
25 }
26
27 sub y {
28     my ( $self, @args ) = @_;
29
30     if ( @args ) {
31         $self->{y} = $args[0];
32     }
33
34     return $self->{y};
35 }
36
37 sub clear {
38     my $self = shift;
39     @{$self}{qw/x y/} = (0, 0);
40 }
41
42 __PACKAGE__;
43
44 __END__
45