Commit | Line | Data |
5f7fd749 |
1 | package SQL::Translator::Schema::Role::Compare; |
2 | use Moo::Role; |
3 | |
4 | sub equals { |
5 | |
6 | =pod |
7 | |
8 | =head2 equals |
9 | |
10 | Determines if this object is the same as another. |
11 | |
12 | my $isIdentical = $object1->equals( $object2 ); |
13 | |
14 | =cut |
15 | |
16 | my $self = shift; |
17 | my $other = shift; |
18 | |
19 | return 0 unless $other; |
20 | return 1 if overload::StrVal($self) eq overload::StrVal($other); |
21 | return 0 unless $other->isa( ref($self) ); |
22 | return 1; |
23 | } |
24 | |
25 | sub _compare_objects { |
26 | # my ($self, $obj1, $obj2) = @_; |
27 | |
28 | my $result = ( |
29 | Data::Dumper->new([$_[1]])->Terse(1)->Indent(0)->Deparse(1)->Sortkeys(1)->Maxdepth(0)->Dump |
30 | eq |
31 | Data::Dumper->new([$_[2]])->Terse(1)->Indent(0)->Deparse(1)->Sortkeys(1)->Maxdepth(0)->Dump |
32 | ); |
33 | # if ( !$result ) { |
34 | # use Carp qw(cluck); |
35 | # cluck("How did I get here?"); |
36 | # use Data::Dumper; |
37 | # $Data::Dumper::Maxdepth = 1; |
38 | # print "obj1: ", Dumper($obj1), "\n"; |
39 | # print "obj2: ", Dumper($obj2), "\n"; |
40 | # } |
41 | return $result; |
42 | } |
43 | |
44 | 1; |