xml' && $format ne 'json' && $format ne 'ref' ) {
$self->error("cPanel::PublicAPI::whm_api_request() was called with an invalid data format, the only valid format are 'json', 'ref' or 'xml'");
die $self->{'error'};
}
if ( defined $opts_hr->{'format'} && ( $opts_hr->{'format'} eq 'json' || $opts_hr->{'format'} eq 'xml' ) ) {
return ${ $opts_hr->{'data'} };
}
else {
[ 'JSON::Syck', 'json', 'Load' ],
[ 'JSON', 'json', 'decode_json' ],
[ 'JSON::XS', 'json', 'decode_json' ],
[ 'JSON::PP', 'json', 'decode_json' ],
package cPanel::PublicAPI::JSONAPI;
# Copyright (c) 2015, cPanel, Inc.
# All rights reserved.
# http://cpanel.net
#
# Redistribution and use in source and binary forms, with or without
# modification
blicAPI ();
our $VERSION = '2.3';
package cPanel::PublicAPI;
use cPanel::PublicAPI::WHM::API ();
foreach my $sub ( grep ( /^api_/, keys %cPanel::PublicAPI:: ) ) {
*{"json$sub"} = *$sub;
}
1;
someuser', 'password' => 's0m3P4$$w()Rd' } );
# Return JSON from xml-api (rather than a hash reference)
$cp->whm_api('version', undef, 'json');
# Perform an API2 query
$cp->cpanel_api2_reques
der that it will fall back on serialization modules is:
=over
=item * JSON::Syck
=item * JSON
=item * JSON::XS
=item * JSON::PP
=back
If you installed this module via CPAN, this should never be
you are wishing to use this
module on a system where you do not have access to compiled modules, JSON::PP is the recommended serializer.
=head1 Two-Factor Authentication (2FA)
cPanel version 54 and