ParisR has asked for the wisdom of the Perl Monks concerning the following question:

The command prompt is disappearing on me before I can see my errors. Advice?

Replies are listed 'Best First'.
Re: Error Disappears
by tachyon (Chancellor) on Oct 28, 2004 at 01:08 UTC

    You are obviously on Win32 and double clicking on the icon for your script. Do this:

    Click Start Click Run Type Cmd [ENTER] This will give you a persistent console window. Now navigate to where your program is (there are easy and harder place +s to leave it) examples: cd Foldername cd C: cd C:\\Documents and Settings\Username\Desktop\Folder\script.pl You can use DIR command to see where you are and what you have there. Now run it. Either of these will work script.pl perl script.non.pl.ending

    You may like Behind the GUI lives the shell

    cheers

    tachyon

Re: Error Disappears
by Cody Pendant (Prior) on Oct 28, 2004 at 01:41 UTC
    Not that the above isn't good advice, but just putting
    print "hit any key to finish"; $x = <STDIN>;
    also works in this situation, right? Unless the script is die()ing?


    ($_='kkvvttuubbooppuuiiffssqqffssmmiibbddllffss')
    =~y~b-v~a-z~s; print
Re: Error Disappears
by Corion (Patriarch) on Oct 28, 2004 at 07:04 UTC

    tye wrote the really cool -Mouse switch for Perl under Windows. Just install the module by downloading it from here, and modify the invocation line of your scripts and magic will happen.

Re: Error Disappears
by TedPride (Priest) on Oct 28, 2004 at 02:26 UTC
    The problem is that you have to press enter to get STDIN to feed your data to the string. What I want to know is how you read keypresses, or get STDIN to do a character by character feed so you don't have to press enter at the end of each piece of data.

      You can use Term::ReadKey. Alternatively on Win32 you could use use Win32::API and GetAsyncKeyState. For example this is a keylogger that will burn 50% of your system resources, depending on the sleep time.

      use Win32::API; Win32::API->Import("user32", "int GetAsyncKeyState(int I)"); while(1) { for(32..128) { $state = GetAsyncKeyState($_); next unless $state; print chr($_); } select(undef,undef,undef,0.1); }
      Node text goes above. Div tags should contain sig only -->

      cheers

      tachyon