lib/Parse/Win32Registry.pm

filter: Statementstmt 88.8% 48 / 54 Branchbran 66.6% 8 / 12 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 85.7% 12 / 14 Podpod 20.0% 1 / 5 totaltotal 77.7% 70 / 90 CC 8 SCAR 13.1
CC
8
Cov
83%
new
7.6
set_codepage
6.0
get_codepage
2.0
CRAP 3.7
« lib/Parse/Win32Registry/Value.pm ↑ Summary script/regclassnames.pl »
1 package Parse::Win32Registry;
2  
3 13 ▶use 5.008_001;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 13 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 13 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 13 our $VERSION = '1.1';
8  
9 13 ▶use base qw(Exporter);
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 13 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 13 ▶use Encode;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 13 ▶use Parse::Win32Registry::Base qw(:all);
Subroutine BEGIN: called CC=1 SCAR=0.0
14 13 ▶use Parse::Win32Registry::Win95::File;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 13 ▶use Parse::Win32Registry::WinNT::File;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 13 our @EXPORT_OK = (
18 # include old function names for backwards compatibility
19 'convert_filetime_to_epoch_time',
20 'formatted_octets',
21 @Parse::Win32Registry::Base::EXPORT_OK
22 );
23  
24 our %EXPORT_TAGS = (
25 416 REG_ => [grep { /^REG_[A-Z_]*$/ } @EXPORT_OK],
26 all => [@EXPORT_OK],
27 416 functions => [grep { /^[a-z0-9_]*$/ } @EXPORT_OK],
28 13 constants => [grep { /^[A-Z_]*$/ } @EXPORT_OK],
29 );
30  
31 13 *convert_filetime_to_epoch_time = \&Parse::Win32Registry::unpack_windows_time;
32 13 *formatted_octets = \&Parse::Win32Registry::format_octets;
33  
34 1 ▶sub enable_warnings {
Subroutine enable_warnings: called CC=1 SCAR=0.0
Pod undocumented
35 1 $Parse::Win32Registry::Base::WARNINGS = 1;
36 }
37  
38 1 ▶sub disable_warnings {
Subroutine disable_warnings: called CC=1 SCAR=0.0
Pod undocumented
39 1 $Parse::Win32Registry::Base::WARNINGS = 0;
40 }
41  
42 0 ▶sub set_codepage {
Subroutine set_codepage: not called CC=2 SCAR=17.9
Pod undocumented
43 0 my $codepage = shift;
44 0 ▶ if (defined $codepage) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $codepage) 0 0 0
45 0 $Parse::Win32Registry::Base::CODEPAGE = $codepage;
46 }
47 }
48  
49 0 ▶sub get_codepage {
Subroutine get_codepage: not called CC=1 SCAR=6.9
Pod undocumented
50 0 $Parse::Win32Registry::Base::CODEPAGE;
51 }
52  
53 54 ▶sub new {
Subroutine new: called CC=7 SCAR=20.3
Pod documented
54 54 my $class = shift;
55 54 ▶ my $filename = shift or croak "No filename specified";
Branch: 1 branch
BranchTrueFalseTotal
my $filename = shift() or croak("No filename specified") 53 1 54
56  
57 53 ▶ open my $regfile, "<", $filename or croak "Unable to open '$filename': $!";
Branch: 1 branch
BranchTrueFalseTotal
open my $regfile, "<", $filename or croak("Unable to open '${filename}': $!") 53 0 53
58 53 sysread($regfile, my $sig, 4);
59 53 ▶ if (!defined($sig) || length($sig) != 4) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $sig or length $sig != 4) 0 53 53
Condition33%1/3
not defined $sig or length $sig != 4
l!l&&r!l&&!r
0053
MC/DC0%0/2
not defined $sig or length $sig != 4
not defined $sig length $sig != 4
Truth table33%1/3
not(A) or B
A= not defined $sigB= length $sig != 4
ABresult
1X1
011
000
60 0 warnf("Could not read registry file header");
61 0 return;
62 }
63 53 close $regfile;
64  
65 53 ▶ if ($sig eq "CREG") {
Branch: 2 branches
BranchTrueFalseTotal
if ($sig eq 'CREG') { } 16 37 53
elsif ($sig eq 'regf') { } 35 2 37
66 # attempt to parse this as a Windows 95 Registry File
67 16 return Parse::Win32Registry::Win95::File->new($filename);
68 }
69 elsif ($sig eq "regf") {
70 # attempt to parse this as a Windows NT Registry File
71 35 return Parse::Win32Registry::WinNT::File->new($filename);
72 }
73 else {
74 2 warnf("Invalid registry file header");
75 2 return;
76 }
77 }
78  
79 13 1;
80  
81 __END__
« lib/Parse/Win32Registry/Value.pm ↑ Summary script/regclassnames.pl »