Move Test::Simple from lib to ext.
[p5sagit/p5-mst-13.2.git] / ext / Test-Simple / t / lib / MyOverload.pm
CommitLineData
3e887aae 1package Overloaded; ##no critic (Modules::RequireFilenameMatchesPackage)
2
3use strict;
6b38a9b9 4
5sub new {
6 my $class = shift;
7 bless { string => shift, num => shift }, $class;
8}
9
6b38a9b9 10package Overloaded::Compare;
3e887aae 11
12use strict;
13our @ISA = qw(Overloaded);
6b38a9b9 14
15# Sometimes objects have only comparison ops overloaded and nothing else.
16# For example, DateTime objects.
17use overload
ccbd73a4 18 q{eq} => sub { $_[0]->{string} eq $_[1] },
19 q{==} => sub { $_[0]->{num} == $_[1] };
6b38a9b9 20
21package Overloaded::Ify;
3e887aae 22
23use strict;
24our @ISA = qw(Overloaded);
6b38a9b9 25
26use overload
ccbd73a4 27 q{""} => sub { $_[0]->{string} },
28 q{0+} => sub { $_[0]->{num} };
6b38a9b9 29
ccbd73a4 301;