| 1 | package Test2::Tools::JSON; | ||
| 2 | 3 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 3 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 3 | our $VERSION = "0.06"; | |
| 6 | |||
| 7 | 3 | ▶ | use Carp (); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | 3 | ▶ | use JSON::MaybeXS qw/JSON/; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | |||
| 10 | 3 | ▶ | use Test2::Compare::JSON(); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | |||
| 12 | 3 | %Carp::Internal = ( | |
| 13 | %Carp::Internal, | ||
| 14 | 'Test2::Tools::JSON' => 1, | ||
| 15 | 'Test2::Compare::JSON' => 1, | ||
| 16 | ); | ||
| 17 | |||
| 18 | 3 | our @EXPORT = qw/json relaxed_json/; | |
| 19 | 3 | ▶ | use Exporter 'import'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 20 | |||
| 21 | 8 | ▶ | sub json ($) { |
|
Subroutine
json: called CC=1 SCAR=0.0
Pod
documented
| |||
| 22 | 8 | my @caller = caller; | |
| 23 | 8 | return Test2::Compare::JSON->new( | |
| 24 | file => $caller[1], | ||
| 25 | lines => [$caller[2]], | ||
| 26 | inref => $_[0], | ||
| 27 | json => JSON->new->utf8, | ||
| 28 | ); | ||
| 29 | } | ||
| 30 | |||
| 31 | 1 | ▶ | sub relaxed_json ($) { |
|
Subroutine
relaxed_json: called CC=1 SCAR=0.0
Pod
documented
| |||
| 32 | 1 | my @caller = caller; | |
| 33 | 1 | return Test2::Compare::JSON->new( | |
| 34 | file => $caller[1], | ||
| 35 | lines => [$caller[2]], | ||
| 36 | inref => $_[0], | ||
| 37 | json => JSON->new->utf8->relaxed(1), | ||
| 38 | ); | ||
| 39 | } | ||
| 40 | |||
| 41 | 3 | 1; | |
| 42 | __END__ | ||