blib/lib/Medusa/XS.pm

filter: Statementstmt 100% 24 / 24 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod n/a totaltotal 100% 31 / 31 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« lib/Medusa/XS.xs ↑ Summary blib/lib/Medusa/XS/Logger.pm »
1 package Medusa::XS;
2  
3 15 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 15 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 15 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 15 our $VERSION = '0.03';
8  
9 15 require XSLoader;
10 15 XSLoader::load('Medusa::XS', $VERSION);
11  
12 # Configuration hash - kept in Perl for user customizability
13 # All LOGIC is in XS, this is just configuration data
14 15 our %LOG;
15 15 our %AUDITED;
16  
17 15 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
18 %LOG = (
19 LOGGER => 'Medusa::XS::Logger',
20 LOG_LEVEL => 'debug',
21 LOG_FILE => 'audit.log',
22 3 ▶ LOG_INIT => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
23 3 (my $module = $LOG{LOGGER}) =~ s/::/\//g;
24 3 require $module . '.pm';
25 $LOG{LOGGER}->new(
26 file => $LOG{LOG_FILE},
27 3 );
28 },
29 15 TIME => 'gmtime',
30 TIME_FORMAT => 'default',
31 LOG => undef,
32 QUOTE => '†',
33 OPTIONS => {
34 date => 1,
35 guid => 1,
36 guid_version => 4, # UUID version: 1-8, 0=NIL, -1=MAX
37 guid_namespace => undef, # For v3/v5: dns, url, oid, x500, or UUID string
38 guid_name => undef, # For v3/v5: arbitrary name string
39 level => 1,
40 elapsed_call => 1,
41 caller => 1,
42 colour => 1, # 0=off, 1=on, 'auto'=detect terminal
43 colour_theme => 'default', # Loo theme: default, light, monokai, none
44 },
45 LOG_FUNCTIONS => {
46 error => 'error',
47 info => 'info',
48 debug => 'debug',
49 },
50 # Default FORMAT_MESSAGE - wrapper around XS xs_format_message
51 # Users can override with their own sub
52 FORMAT_MESSAGE => \&xs_format_message
53 );
54 }
55  
56 # import(), MODIFY_CODE_ATTRIBUTES(), and FETCH_CODE_ATTRIBUTES()
57 # are implemented in XS for maximum performance
58  
59 # On Perl < 5.14, newATTRSUB overwrites our :Audit wrapper after
60 # MODIFY_CODE_ATTRIBUTES returns. Re-install deferred wraps once
61 # the entire compilation unit has finished compiling.
62 # The eval registers a CHECK block at compile time; no warnings suppresses
63 # "Too late to run CHECK block" if the module is loaded at runtime.
64 15 ▶{ no warnings; eval 'CHECK { Medusa::XS::_apply_deferred_wraps() }' }
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine CHECK: called CC=1 SCAR=0.0
65  
66 15 1;
67  
68 __END__
« lib/Medusa/XS.xs ↑ Summary blib/lib/Medusa/XS/Logger.pm »