| 1 | package GraphQL::Debug; | ||||||||||
| 2 | |||||||||||
| 3 | 22 | ▶ | use 5.014; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 22 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 22 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 22 | ▶ | use Exporter 'import'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 22 | our @EXPORT_OK = qw(_debug); | |||||||||
| 9 | |||||||||||
| 10 | =head1 NAME | ||||||||||
| 11 | |||||||||||
| 12 | GraphQL::Debug - debug GraphQL | ||||||||||
| 13 | |||||||||||
| 14 | =cut | ||||||||||
| 15 | |||||||||||
| 16 | =head1 SYNOPSIS | ||||||||||
| 17 | |||||||||||
| 18 | use GraphQL::Debug qw(_debug); | ||||||||||
| 19 | use constant DEBUG => $ENV{GRAPHQL_DEBUG}; | ||||||||||
| 20 | DEBUG and _debug('current_function', $value1, $value2); | ||||||||||
| 21 | |||||||||||
| 22 | =head1 DESCRIPTION | ||||||||||
| 23 | |||||||||||
| 24 | Creates debugging output when called. Intended to have its calls optimised | ||||||||||
| 25 | out when debugging not sought, using the construct shown above. The | ||||||||||
| 26 | values given will be passed through L<Data::Dumper/Dumper>. | ||||||||||
| 27 | |||||||||||
| 28 | =cut | ||||||||||
| 29 | |||||||||||
| 30 | # TODO make log instead of diag | ||||||||||
| 31 | 1 | ▶ | sub _debug { | ||||||||
|
Subroutine
_debug: called CC=2 SCAR=7.1
| |||||||||||
| 32 | 1 | my $func = shift; | |||||||||
| 33 | 1 | require Test::More; | |||||||||
| 34 | 1 | ▶ | Test::More::diag("$func: ", Test::More::explain(@_ == 1 ? @_ : [ @_ ])); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 35 | } | ||||||||||
| 36 | |||||||||||
| 37 | 22 | 1; | |||||||||