Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^3: Attribute does not pass Type Constraint

by PerlSufi (Friar)
on Apr 03, 2014 at 21:13 UTC ( #1081009=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Attribute does not pass Type Constraint
in thread Attribute does not pass Type Constraint

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 :)


Comment on Re^3: Attribute does not pass Type Constraint
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1081009]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (7)
As of 2015-07-02 01:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (25 votes), past polls