| | 1180 | } |
|---|
| | 1181 | |
|---|
| | 1182 | =pod |
|---|
| | 1183 | |
|---|
| | 1184 | =head2 $object->getFilename() |
|---|
| | 1185 | |
|---|
| | 1186 | =over 4 |
|---|
| | 1187 | |
|---|
| | 1188 | Returns the file name associated with the current Parser B<$object>. |
|---|
| | 1189 | |
|---|
| | 1190 | I<Output>: Returns the file name in use. |
|---|
| | 1191 | |
|---|
| | 1192 | =back |
|---|
| | 1193 | |
|---|
| | 1194 | =begin testing |
|---|
| | 1195 | |
|---|
| | 1196 | my ($filename); |
|---|
| | 1197 | my $test_registry_file = $ENV{PWD} . "/" . getVar(name => "registry_file", |
|---|
| | 1198 | namespace => "HoneyClient::Agent::Integrity::Registry::Parser::Test"); |
|---|
| | 1199 | |
|---|
| | 1200 | # Create a generic Parser object, with test state data. |
|---|
| | 1201 | my $parser = HoneyClient::Agent::Integrity::Registry::Parser->init(input_file => $test_registry_file); |
|---|
| | 1202 | |
|---|
| | 1203 | $filename = $parser->getFilename(); |
|---|
| | 1204 | |
|---|
| | 1205 | is($filename, $test_registry_file, "getFilename()") or diag("The getFilename() call failed."); |
|---|
| | 1206 | |
|---|
| | 1207 | =end testing |
|---|
| | 1208 | |
|---|
| | 1209 | =cut |
|---|
| | 1210 | |
|---|
| | 1211 | sub getFilename { |
|---|
| | 1212 | # Extract arguments. |
|---|
| | 1213 | my ($self, %args) = @_; |
|---|
| | 1214 | |
|---|
| | 1215 | # Log resolved arguments. |
|---|
| | 1216 | # Make Dumper format more terse. |
|---|
| | 1217 | $Data::Dumper::Terse = 1; |
|---|
| | 1218 | $Data::Dumper::Indent = 0; |
|---|
| | 1219 | $LOG->debug(Dumper(\%args)); |
|---|
| | 1220 | |
|---|
| | 1221 | return $self->YYData->{'filename'}; |
|---|
| | 1222 | } |
|---|
| | 1223 | |
|---|
| | 1224 | =pod |
|---|
| | 1225 | |
|---|
| | 1226 | =head2 $object->closeFileHandle() |
|---|
| | 1227 | |
|---|
| | 1228 | =over 4 |
|---|
| | 1229 | |
|---|
| | 1230 | Closes the file handle associated with the current Parser B<$object>. |
|---|
| | 1231 | |
|---|
| | 1232 | =back |
|---|
| | 1233 | |
|---|
| | 1234 | =begin testing |
|---|
| | 1235 | |
|---|
| | 1236 | my ($handle); |
|---|
| | 1237 | my $test_registry_file = $ENV{PWD} . "/" . getVar(name => "registry_file", |
|---|
| | 1238 | namespace => "HoneyClient::Agent::Integrity::Registry::Parser::Test"); |
|---|
| | 1239 | |
|---|
| | 1240 | # Create a generic Parser object, with test state data. |
|---|
| | 1241 | my $parser = HoneyClient::Agent::Integrity::Registry::Parser->init(input_file => $test_registry_file); |
|---|
| | 1242 | $parser->closeFileHandle(); |
|---|
| | 1243 | |
|---|
| | 1244 | # Verify Test Group #1 |
|---|
| | 1245 | my $nextGroup = $parser->nextGroup(); |
|---|
| | 1246 | my $expectedGroup = { |
|---|
| | 1247 | key => 'HKEY_CURRENT_USER\]Testing Group 1[', |
|---|
| | 1248 | entries => [ { |
|---|
| | 1249 | name => '@', |
|---|
| | 1250 | value => 'Default', |
|---|
| | 1251 | }, { |
|---|
| | 1252 | name => 'Foo', |
|---|
| | 1253 | value => 'Bar', |
|---|
| | 1254 | }, ], |
|---|
| | 1255 | }; |
|---|
| | 1256 | is_deeply($nextGroup, $expectedGroup, "closeFileHandle()") or diag("The closeFileHandle() call failed."); |
|---|
| | 1257 | |
|---|
| | 1258 | =end testing |
|---|
| | 1259 | |
|---|
| | 1260 | =cut |
|---|
| | 1261 | |
|---|
| | 1262 | sub closeFileHandle { |
|---|
| | 1263 | # Extract arguments. |
|---|
| | 1264 | my ($self, %args) = @_; |
|---|
| | 1265 | |
|---|
| | 1266 | # Log resolved arguments. |
|---|
| | 1267 | # Make Dumper format more terse. |
|---|
| | 1268 | $Data::Dumper::Terse = 1; |
|---|
| | 1269 | $Data::Dumper::Indent = 0; |
|---|
| | 1270 | $LOG->debug(Dumper(\%args)); |
|---|
| | 1271 | |
|---|
| | 1272 | $self->YYData->{'file_handle'} = undef; |
|---|