I
think I may have figured it out. I made the following changes:
class_type 'DateTime';
subtype 'DT' => as 'Maybe[DateTime]';
coerce 'DT',
from 'Str',
via { DateTime::Format::DateParse->parse_datetime($_) };
coerce 'DT',
from 'Int',
via { DateTime->from_epoch( epoch => $_ ) };
...
has created_time => (
is => 'rw',
isa => 'DT',
required => 0,
coerce => 1,
);
# and then in the subroutine I posted earlier:
...
for my $post_id ( keys %$post_response ) { # changed to unblessed
...
But I'm now getting an error about something else in the module. So I will follow up as necessary :)