I want to extract the timestamp from a MongoDB document's _id field in Perl. I've been trying to create a MongoDB::OID object from the _id string returned by a find_one, but it complains about illegal hexadecimal digits. What am I doing wrong?
my $object = $inventoryColl->find_one();
my $objID = MongoDB::OID->new(value => $object->{_id});
my $time = $objID->get_time; # this line produces an error
my $date = DateTime->from_epoch(epoch => $objID->get_time); # also produces error