in reply to Re^3: multi-threaded win32::console
in thread multi-threaded win32::console

Perhaps I'm more of an Initiate (not even a Novice) than I thought. Am I not using strict in all examples (even the admittedly horrible original post) above? In Re^4: multi-threaded win32::console it behaves (produces results without errors or warnings) as I expect. The problem is only when I introduce Win32::console.

Which of the above versions of the code produced the line numbers in your warnings / errors?

Is there a platform or Perl version difference that is causing the problems? I'm on:

C:\chas_sandbox>perl -version This is perl, v5.8.8 built for MSWin32-x86-multi-thread (with 33 registered patches, see perl -V for more detail) Copyright 1987-2006, Larry Wall Binary build 819 [267479] provided by ActiveState http://www.ActiveSta +te.com Built Aug 29 2006 12:42:41 Perl may be copied only under the terms of either the Artistic License + or the GNU General Public License, which may be found in the Perl 5 source ki +t. Complete documentation for Perl, including FAQ lists, should be found +on this system using "man perl" or "perldoc perl". If you have access to + the Internet, point your browser at http://www.perl.org/, the Perl Home Pa +ge. C:\chas_sandbox>ver Microsoft Windows XP [Version 5.1.2600] C:\chas_sandbox>

Replies are listed 'Best First'.
Re^5: multi-threaded win32::console
by BrowserUk (Patriarch) on Aug 14, 2007 at 04:17 UTC
    Am I not using strict in all examples (even the admittedly horrible original post) above?

    You are putting it in the code you post, but you obviously aren't using it when you run the code on your machine, else you would be seeing and correcting these errors and warnings--not me.

    Trust me when I say that the versions of Perl and XP will not be causing the warnings I reported in the code from the post to which I replied.

    When I correct the logic errors I detailed, then I get this output:

    C:\test>632320 same values, different keys: A->b same values, different keys: A->h same values, different keys: A->s same values, different keys: A->t same values, different keys: A->d same values, different keys: A->f same values, different keys: A->h same values, different keys: A->w same values, different keys: A->c same values, different keys: A->d same values, different keys: A->f same values, different keys: A->p same values, different keys: A->c same values, different keys: A->g same values, different keys: A->o same values, different keys: A->v same values, different keys: A->o same values, different keys: A->g same values, different keys: A->j same values, different keys: A->n 1/177 .

    And if I comment out the print line producing that "same values, ..." output I get

    C:\test>632320 1/177 . 11/0

    That's obviously only the final state when the program ends. I see the values changing as the program progresses. And that I think is the answer to your original question. Mixing consoleIO and prints means that the latter is overlaying the former and causing the screen to scroll.

    You should opt for using one or the other. Or, clear the screen first, write your status information to the top line whilst saving and restoring the current cursor postion before and after each write, and then your print statements can scroll down the screen and the status information stays fixed.

    Personally, I think that avoiding mixing them is the easiest option.


    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.

      I feel I must protest. Copying the code from Re^2: multi-threaded win32::console into a new file and running it yields for me:

      C:\chas_sandbox>test.pl 1/177 . 5/8 7/5 4/23 C:\chas_sandbox>

      and I see no errors or warnings.

      Please tell me why you see more errors and warnings than I do. (I'm sure that you see some errors and warnings like the lack of $k because of your advanced wisdom; please tell me why your PERL shows you more than my PERL shows me.) I surely don't expect you to be debugging compare for me - I sincerely thought it was working on my system without problem.

      Perhaps if I can learn this wisdom, I won't post bad code so much.