Closed mdom closed 6 years ago
Lol. I noticed this in several places when porting stuff from the plugin version; previously parse_feed() returned undef or a hashref, now we always return an object.
In some places I checked if a field is defined (i.e if ($feed->description) { ... }
)
I'll switch to using is_valid throughout.
Related: should parse return undef if the feed isn't valid? Currently it will return a Mojo::Feed object which stringifies to whatever XML/HTML it was given (and returns false if is_valid is called).
My opinion is "yes", i.e, you could construct an invalid Mojo::Feed object with Mojo::Feed->new(body => '
That sounds reasonable!
Maybe we were a little bit too lazy. Without this change any successful http request will result in a valid Mojo::Feed object.