File Coverage

blib/lib/GraphQL/Debug.pm
Criterion Covered Total %
statement 14 14 100.0
branch 1 2 50.0
condition n/a
subroutine 5 5 100.0
pod n/a
total 20 21 95.2


line stmt bran cond sub pod time code
1              
2             use 5.014;
3 22     22   335 use strict;
  22         74  
4 22     22   106 use warnings;
  22         47  
  22         487  
5 22     22   96 use Exporter 'import';
  22         35  
  22         593  
6 22     22   111  
  22         57  
  22         2495  
7             our @EXPORT_OK = qw(_debug);
8              
9             =head1 NAME
10              
11             GraphQL::Debug - debug GraphQL
12              
13             =cut
14              
15             =head1 SYNOPSIS
16              
17             use GraphQL::Debug qw(_debug);
18             use constant DEBUG => $ENV{GRAPHQL_DEBUG};
19             DEBUG and _debug('current_function', $value1, $value2);
20              
21             =head1 DESCRIPTION
22              
23             Creates debugging output when called. Intended to have its calls optimised
24             out when debugging not sought, using the construct shown above. The
25             values given will be passed through L<Data::Dumper/Dumper>.
26              
27             =cut
28              
29             # TODO make log instead of diag
30             my $func = shift;
31             require Test::More;
32 1     1   9237 Test::More::diag("$func: ", Test::More::explain(@_ == 1 ? @_ : [ @_ ]));
33 1         7 }
34 1 50       8  
35             1;