http://www.perlmonks.org?node_id=1019963


in reply to Re^2: Creating thread to call Subroutines parallely
in thread Creating thread to call Subroutines parallely

I cannot see anything obvious that might cause your output file to be empty -- other than perhaps there were no events that matched your criteria. Is that possible?

This is the error i am getting since the file app_output.txt is empty couldn't read C:\log_parsing\app_output.txt - at log_windows_new.pl line 444.

That still doesn't isn't the full error message.

Line 444 is:

my @a = read_file($outputfile1) or die "couldn't read $outputfile1 - $!"; # ........................................^^

The $! should mean that the full error message would be something like:

couldn't read C:\log_parsing\app_output.txt - No such file or director +y at log_windows_new.pl line 444. #.............................................^^^^^^^^^^^^^^^^^^^^^^^^ +^

Or perhaps:code> couldn't read C:\log_parsing\app_output.txt - Permission denied at log_windows_new.pl line 444. #.............................................^^^^^^^^^^^^^^^^^ </code>

That piece of information would likely point to the source of the problem; but you haven't given us it?

I'd also suggest that you add $^E to line 44 (and other error messages). Ie:

my @a = read_file($outputfile1) or die "couldn't read $outputfile1 - $! [$^E]";

That may provide further clarification of the problem.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^4: Creating thread to call Subroutines parallely
by kar_thik82 (Novice) on Feb 21, 2013 at 15:48 UTC
    Event though if the criteria is not matched i am sending a dummy text to the file" as below atleast this message should write into that file. At the time of error when i open the app_output file it remains blank.
    if ($limit == 0) { $msg = "Common-App##Windows ".$eventSource." Event Log - Event log + has not increased in size since last run"; print $out_app $msg; }
      Event though if the criteria is not matched i am sending a dummy text to the file" as below atleast this message should write into that file.

      Hm. That covers teh situation where there are no new messages. What about where there are new messages, but none of them match your regexes?

      At the time of error when i open the app_output file it remains blank.

      An existing but empty file would not "fail to open" at line 444.

      But then your error message does not reflect the situation you are actually testing.

      If the file is empty, the open (inside File::Slurp::read_file() would succeed, but then the function would return no lines. Your code would detect the absence of any input and report it as an open failure.

      But you are still not supplying the full error message ($!)

      You better next time else I'm giving up on you.


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.