1Test::Smoke::Util::LoadUAsJeSrONC(o3n)tributed Perl DocuTmeesntt:a:tSimoonke::Util::LoadAJSON(3)
2
3
4
6 Test::Smoke::Util::LoadAJSON - A JSON:PP/JSON::XS Factory Class
7
9 use Test::Smoke::Util::LoadAJSON;
10 my $json = Test::Smoke::Util::LoadAJSON->new->utf8->pretty->encode(\%data);
11
13 This is purely a fallback factory class that helps keep our code clean.
14
15 This is for people with a clean perl 5.14+ install that have JSON::PP
16 but not JSON. Also people that installed JSON::XS on a pre-5.14 system.
17
18 Also checks for $ENV{PERL_JSON_BACKEND} to force either of the two.
19
20 my $class = Test::Smoke::Util::LoadAJSON->find_base_class()
21 On success returns one of: JSON::XS, JSON::PP
22
23 Returns undef on failure.
24
25 my $obj = Test::Smoke::Util::LoadAJSON->new(<arguments>)
26 If a base class is found, will return an instantiated object.
27
28 This will die() if no base class could be found.
29
31 (c) 2014, All rights reserved.
32
33 * Abe Timmerman <abeltje@cpan.org>
34
35 This library is free software; you can redistribute it and/or modify it
36 under the same terms as Perl itself.
37
38 See:
39
40 · <http://www.perl.com/perl/misc/Artistic.html>
41
42 · <http://www.gnu.org/copyleft/gpl.html>
43
44 This program is distributed in the hope that it will be useful, but
45 WITHOUT ANY WARRANTY; without even the implied warranty of
46 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
47
48
49
50perl v5.30.0 2019-08-19 Test::Smoke::Util::LoadAJSON(3)