File Coverage

blib/lib/qbit/Log.pm
Criterion Covered Total %
statement 18 25 72.0
branch n/a
condition n/a
subroutine 6 8 75.0
pod 2 2 100.0
total 26 35 74.2


line stmt bran cond sub pod time code
1             =head1 Name
2              
3             qbit::Log - Functions to logging
4              
5             =cut
6              
7             package qbit::Log;
8             $qbit::Log::VERSION = '2.2';
9 8     8   29 use strict;
  8         8  
  8         199  
10 8     8   25 use warnings;
  8         9  
  8         152  
11 8     8   51 use utf8;
  8         10  
  8         44  
12              
13 8     8   239 use base qw(Exporter);
  8         10  
  8         492  
14 8     8   29 use Data::Dumper;
  8         9  
  8         4190  
15              
16             BEGIN {
17 8     8   832 our (@EXPORT, @EXPORT_OK);
18              
19 8         20 @EXPORT = qw(
20             l ldump
21             );
22 8         1254 @EXPORT_OK = @EXPORT;
23             }
24              
25              
26             =head1 Functions
27              
28             =head2 l
29              
30             B
31              
32             =over
33              
34             =item
35              
36             B<@args> - array of strings, messages;
37              
38             =back
39              
40             Print joined messsages to STDERR with new line at end.
41              
42             =cut
43              
44             sub l {
45 0     0 1   print STDERR join(' ', @_) . "\n";
46             }
47              
48             =head2 ldump
49              
50             B
51              
52             =over
53              
54             =item
55              
56             B<@args> - array, variables;
57              
58             =back
59              
60             Print variables dumps with Data::Dumper::Dumper to STDERR. Unicode sequenses will be converted to readable text.
61              
62             =cut
63              
64             sub ldump(@) {
65 0     0 1   local $Data::Dumper::Indent = 2;
66 0           local $Data::Dumper::Varname = '';
67              
68 0           my $dump = Dumper(@_);
69 0           $dump =~ s/\\x\{([a-f0-9]{2,})\}/chr(hex($1))/ge;
  0            
70 0           print STDERR $dump;
71             }
72              
73             1;