# ABSTRACT: Adds a TO_JSON method to DateTime
package DateTimeX::TO_JSON;
$DateTimeX::TO_JSON::VERSION = '0.0.2';
use strict;
use warnings;
use Class::Load;
use Carp;
sub import {
my ($class, @a
:TO_JSON = sub {
$args{formatter}->format_datetime($_[0]);
}
}
elsif ( $args{formatter} ) {
Class::Load::load_class $args{formatter};
*DateTime::TO_JSON = s
lse {
*DateTime::TO_JSON = sub {
$_[0]->datetime;
}
}
}
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
DateTimeX::TO_JSON - Adds a TO_JSON method to DateTime
=head1