hakamadare / webservice-pushover

WebService-Pushover - Perl support for Pushover API
http://search.cpan.org/dist/WebService-Pushover
7 stars 6 forks source link

Status not documented #20

Open frioux opened 8 years ago

frioux commented 8 years ago

The docs say: "message() sends a message to Pushover and returns a scalar reference representation of the message status." By testing it I found that it's actually a hash reference. More importantly, the Pushover api docs mention checking for 500's (https://pushover.net/api#friendly) and I cannot see how to do that with this tool. Ideas?

hakamadare commented 8 years ago

hello! i apologize for the delay in reponse :(

the bad news is that i can't immediately see an easy way for you to inspect the HTTP response code; that is hidden under several layers of abstraction. however, the good news is that iirc a 500 response will not include valid JSON, which means the JSON parser will fail to decode it, and then it will croak. you can run message() inside an eval and inspect the return value to see if it succeeded.