| 1 | =head1 Name | ||
| 2 | |||
| 3 | qbit::Log - Functions to logging | ||
| 4 | |||
| 5 | =cut | ||
| 6 | |||
| 7 | package qbit::Log; | ||
| 8 | 8 | $qbit::Log::VERSION = '2.5'; | |
| 9 | 8 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | 8 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | 8 | ▶ | use utf8; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | |||
| 13 | 8 | ▶ | use base qw(Exporter); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 14 | 8 | ▶ | use Data::Dumper; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 15 | |||
| 16 | BEGIN { | ||
| 17 | 8 | ▶ | our (@EXPORT, @EXPORT_OK); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 18 | |||
| 19 | 8 | @EXPORT = qw( | |
| 20 | l ldump | ||
| 21 | ); | ||
| 22 | 8 | @EXPORT_OK = @EXPORT; | |
| 23 | } | ||
| 24 | |||
| 25 | |||
| 26 | =head1 Functions | ||
| 27 | |||
| 28 | =head2 l | ||
| 29 | |||
| 30 | B<Arguments:> | ||
| 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 | ▶ | print STDERR join(' ', @_) . "\n"; |
|
Subroutine
l: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 46 | } | ||
| 47 | |||
| 48 | =head2 ldump | ||
| 49 | |||
| 50 | B<Arguments:> | ||
| 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 | ▶ | local $Data::Dumper::Indent = 2; |
|
Subroutine
ldump: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 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; | |
| 70 | 0 | print STDERR $dump; | |
| 71 | } | ||
| 72 | |||
| 73 | 8 | 1; | |