use strict; use threads; use threads::shared; use Thread::Pool::Simple; use Getopt::Long; # read parameters use Pod::Usage; use Log2t::Common; use DateTime::TimeZone; use Digest::MD5; use Time::HiRes; #### # prepare thread pool my $pool = Thread::Pool::Simple->new( min => 2, # at least 2 workers max => 10, # at most 10 workers load => 3, do => [\&parse_artifact] ) || print "couldn't create thread pool: $!\n";; #### # load all format files eval { # include the format foreach( keys %formats ) { require $format_dir . '/' . $formats{$_}->{'file'}; } }; #### # now we need to recursively go through every file and directory in that we got provided as an input and verify if we can parse it (and then parse the file) parse_dir( $dir ); #### # wait for thread pool to empty $pool->join(); #### # we have the artifact here, it's verified so we just need to parse it sub parse_artifact() { my ($format, $file) =@_; my $t_line; my @args = undef; print Log2t::Common::get_version(); my $description = Log2t::input::iehistory::get_description(); print "##this was the IE get_description() output: $description \n"; # load the log file (prepare, action provided here depends on the format in question) print "parse_artifact fired; format passed is: $format->{'name'}; file passed is $file\n";