arse matching lines into objects with named attributes.
# The default output format is one-line JSON.
cat lib/App/Pebble.pm | \
p 'P->match( regex => qr/^=head(\d+)\s+(.+)/, has => ["level", "te
ration helpers.
=head1 DESCRIPTION
Support DateTime::Duration "natively" by making sure they TO_JSON-ify
properly, and provide some useful extra helper methods.
=cut
package App::Pebble::Helpers::
no warnings "redefine";
=head2 METHODS
=cut
# Needed by Pebble::Object and JSON::XS
sub DateTime::Duration::TO_JSON {
my $self = shift;
###TODO: replace with format duration
$self->in
DateTime helpers.
=head1 DESCRIPTION
Support DateTime objects "natively" by making sure they TO_JSON-ify
properly, and provide some useful helper methods.
=cut
package App::Pebble::Helpers::DateTi
ings;
use DateTime;
use Carp;
=head2 METHODS
=cut
# Needed by Pebble::Object and JSON::XS
sub DateTime::TO_JSON {
my $self = shift;
"$self";
}
=head2 DateTime::round( $to_unit = "day" ) :