| 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
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | 53 | ▶ | open my $regfile, "<", $filename or croak "Unable to open '$filename': $!"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 58 | 53 | sysread($regfile, my $sig, 4); | |||||||||||||||||||||||||||
| 59 | 53 | ▶ | if (!defined($sig) || length($sig) != 4) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not defined $sig or length $sig != 4
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
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||