(PL);
use Lingua::EN::PluralToSingular qw(to_singular);
use POSIX qw(strftime);
use Readonly;
use JSON;
our $VERSION = q[2025.06.07];
Readonly::Scalar our $DBI_CACHE_OVERWRITE => 3;
our $EXPERIMENT
}
sub as_json {
my ($self, $cb) = @_;
# $self->read;
my $obj = {
map { $_ => $self->{$_} } ($self->fields)
};
if($cb) {
$cb->($obj);
}
return JSON->new->enco
:SS for gmtime
my $sISODate = $oModel->isodate();
=head2 as_json - JSON representation of this object
my $sJSON = $oModel->as_json();
=head2 as_xml - XML representation of this object
my $o
$content = qq[<?xml version='1.0'?>\n<error>Error: $escaped</error>];
} elsif($aspect =~ /json$/smx) {
my $escaped = $self->tt_filters->{js_string}->($errstr);
$content = qq[{"error":"
ML::Simple qw(XMLin);
use utf8;
use ClearPress::Localize;
use MIME::Base64 qw(encode_base64);
use JSON;
use Readonly;
our $VERSION = q[2025.06.07];
our $DEBUG_OUTPUT = 0;
our $DEBUG_L10N
s|atom|ajax|xml)$/smx)?'text/xml':q[];
$self->{content_type} ||= ($aspect =~ /(?:js|json)$/smx)?'application/json':q[];
$self->{content_type} ||= ($aspect =~ /_svg$/smx)?'image/svg+xml':q[];
$se
);
if($reqdata) {
utf8::decode($reqdata);
eval {
my $json = JSON->new->utf8;
eval {
$params = $json->decode($reqdata);
1;
} or do {
$params = XMLi
' => q[_jpg]},
{'.rss' => q[_rss]},
{'.atom' => q[_atom]},
{'.js' => q[_json]},
{'.json' => q[_json]},
{'.ical' => q[_ical]},
{'.txt' => q[_txt]},
{'.xls' => q[_xls]},
{'
,
];
}
sub accept_headers {
return [
# {'text/html' => q[]},
{'application/json' => q[_json]},
{'text/xml' => q[_xml]},
];
}
sub new {
my ($class, $self) = @_;
$self
ceptedExtensions = $oController->accept_extensions();
[
{'.ext' => '_aspect'},
{'.js' => '_json'},
]
=head2 accept_headers - data structure of accept_header-to-aspect mappings (e.g. 'text/xm