nysus has asked for the wisdom of the Perl Monks concerning the following question:
I wish to compare two objects to determine if the attribute values are the same. I'm finding very little guidance on this issue anywhere. There is the Data::Compare module but from what I gather I will need to write my own plugin module to do the comparison. I'd be stunned if there is nothing out there that makes it trivial to compare the attributes of two objects against one another but I can't find it.
Any ideas?
Update
Here are the class attributes (written with Moose syntax)
has 'start_time' => ( is => 'rw', isa => 'Time::Piece', ); has 'end_time' => ( is => 'rw', isa => 'Time::Piece', ); has 'title' => ( is => 'rw', isa => 'Str', ); has 'location' => ( is => 'rw', isa => 'Str', ); has 'address' => ( is => 'rw', isa => 'Str', ); has 'document_url' => ( is => 'rw', isa => 'Str', ); has 'event_url' => ( is => 'rw', isa => 'Str', ); has 'event_id' => ( is => 'rw', isa => 'Str', ); has 'status' => ( is => 'rw', isa => 'Str', ); has 'post_id' => ( is => 'rw', isa => 'Int', );
$PM = "Perl Monk's";
$MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate";
$nysus = $PM . ' ' . $MCF;
Click here if you love Perl Monks
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Best way to compare two objects?
by Your Mother (Archbishop) on Mar 22, 2016 at 18:56 UTC | |
by nysus (Parson) on Mar 22, 2016 at 19:13 UTC | |
|
Re: Best way to compare two objects?
by stevieb (Canon) on Mar 22, 2016 at 19:16 UTC | |
|
Re: Best way to compare two objects?
by jeffa (Bishop) on Mar 22, 2016 at 19:16 UTC | |
by nysus (Parson) on Mar 22, 2016 at 19:29 UTC | |
by 1nickt (Canon) on Mar 23, 2016 at 00:53 UTC | |
by nysus (Parson) on Mar 23, 2016 at 15:07 UTC | |
|
Re: Best way to compare two objects?
by GotToBTru (Prior) on Mar 22, 2016 at 18:48 UTC | |
|
Re: Best way to compare two objects?
by nysus (Parson) on Mar 22, 2016 at 21:11 UTC | |
by Anonymous Monk on Mar 22, 2016 at 21:40 UTC |