| | 1025 | } |
|---|
| | 1026 | |
|---|
| | 1027 | =pod |
|---|
| | 1028 | |
|---|
| | 1029 | =head2 $object->getFilename() |
|---|
| | 1030 | |
|---|
| | 1031 | =over 4 |
|---|
| | 1032 | |
|---|
| | 1033 | Returns the file name associated with the current Parser B<$object>. |
|---|
| | 1034 | |
|---|
| | 1035 | I<Output>: Returns the file name in use. |
|---|
| | 1036 | |
|---|
| | 1037 | =back |
|---|
| | 1038 | |
|---|
| | 1039 | =begin testing |
|---|
| | 1040 | |
|---|
| | 1041 | my ($filename); |
|---|
| | 1042 | my $test_registry_file = $ENV{PWD} . "/" . getVar(name => "registry_file", |
|---|
| | 1043 | namespace => "HoneyClient::Agent::Integrity::Registry::Parser::Test"); |
|---|
| | 1044 | |
|---|
| | 1045 | # Create a generic Parser object, with test state data. |
|---|
| | 1046 | my $parser = HoneyClient::Agent::Integrity::Registry::Parser->init(input_file => $test_registry_file); |
|---|
| | 1047 | |
|---|
| | 1048 | $filename = $parser->getFilename(); |
|---|
| | 1049 | |
|---|
| | 1050 | is($filename, $test_registry_file, "getFilename()") or diag("The getFilename() call failed."); |
|---|
| | 1051 | |
|---|
| | 1052 | =end testing |
|---|
| | 1053 | |
|---|
| | 1054 | =cut |
|---|
| | 1055 | |
|---|
| | 1056 | sub getFilename { |
|---|
| | 1057 | # Extract arguments. |
|---|
| | 1058 | my ($self, %args) = @_; |
|---|
| | 1059 | |
|---|
| | 1060 | # Log resolved arguments. |
|---|
| | 1061 | # Make Dumper format more terse. |
|---|
| | 1062 | $Data::Dumper::Terse = 1; |
|---|
| | 1063 | $Data::Dumper::Indent = 0; |
|---|
| | 1064 | $LOG->debug(Dumper(\%args)); |
|---|
| | 1065 | |
|---|
| | 1066 | return $self->YYData->{'filename'}; |
|---|
| | 1067 | } |
|---|
| | 1068 | |
|---|
| | 1069 | =pod |
|---|
| | 1070 | |
|---|
| | 1071 | =head2 $object->closeFileHandle() |
|---|
| | 1072 | |
|---|
| | 1073 | =over 4 |
|---|
| | 1074 | |
|---|
| | 1075 | Closes the file handle associated with the current Parser B<$object>. |
|---|
| | 1076 | |
|---|
| | 1077 | =back |
|---|
| | 1078 | |
|---|
| | 1079 | =begin testing |
|---|
| | 1080 | |
|---|
| | 1081 | my ($handle); |
|---|
| | 1082 | my $test_registry_file = $ENV{PWD} . "/" . getVar(name => "registry_file", |
|---|
| | 1083 | namespace => "HoneyClient::Agent::Integrity::Registry::Parser::Test"); |
|---|
| | 1084 | |
|---|
| | 1085 | # Create a generic Parser object, with test state data. |
|---|
| | 1086 | my $parser = HoneyClient::Agent::Integrity::Registry::Parser->init(input_file => $test_registry_file); |
|---|
| | 1087 | $parser->closeFileHandle(); |
|---|
| | 1088 | |
|---|
| | 1089 | # Verify Test Group #1 |
|---|
| | 1090 | my $nextGroup = $parser->nextGroup(); |
|---|
| | 1091 | my $expectedGroup = { |
|---|
| | 1092 | key => 'HKEY_CURRENT_USER\]Testing Group 1[', |
|---|
| | 1093 | entries => [ { |
|---|
| | 1094 | name => '@', |
|---|
| | 1095 | value => 'Default', |
|---|
| | 1096 | }, { |
|---|
| | 1097 | name => 'Foo', |
|---|
| | 1098 | value => 'Bar', |
|---|
| | 1099 | }, ], |
|---|
| | 1100 | }; |
|---|
| | 1101 | is_deeply($nextGroup, $expectedGroup, "closeFileHandle()") or diag("The closeFileHandle() call failed."); |
|---|
| | 1102 | |
|---|
| | 1103 | =end testing |
|---|
| | 1104 | |
|---|
| | 1105 | =cut |
|---|
| | 1106 | |
|---|
| | 1107 | sub closeFileHandle { |
|---|
| | 1108 | # Extract arguments. |
|---|
| | 1109 | my ($self, %args) = @_; |
|---|
| | 1110 | |
|---|
| | 1111 | # Log resolved arguments. |
|---|
| | 1112 | # Make Dumper format more terse. |
|---|
| | 1113 | $Data::Dumper::Terse = 1; |
|---|
| | 1114 | $Data::Dumper::Indent = 0; |
|---|
| | 1115 | $LOG->debug(Dumper(\%args)); |
|---|
| | 1116 | |
|---|
| | 1117 | $self->YYData->{'file_handle'} = undef; |
|---|