I'm still learning Perl and CLASS::DBI. I have a script that does a bunch of lookups and I only want to insert the new items that are found by the lookups. I created a composite key for username,created_at and I'm using the following code to insert that in to the table.
Everything works, but I would like to know whether the record was found or whether it created the record. I suspect there's an easy way to do this, but apparently I don't know the right terminology to search for.
Please help.
Thanks!
eval {
FEED::COLLECTION->find_or_create({
username => $user->{username},
created_at => $status->{created_at},
status => $status->{text}
});
};
if ($@) {
warn $@;
}