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

This is just what I am trying to do in detail, I want to use console window and having the cursor spin. I will appreciate any sample code on this. 1) Draw the current cursor character. 2) Pause for a little while. 3) Backspace. 4) Choose the next cursor character. 5) Go back to step 1.
  • Comment on I want to use console window and having the cursor spin

Replies are listed 'Best First'.
Re: I am creating Perl Cursor
by roboticus (Chancellor) on Mar 13, 2010 at 11:51 UTC

    manjaro:

    If you're referring to using a console window and having the cursor spin, then I can help you out. The way we do that is to draw the cursor, erase it, redraw it in its next position, etc.

    So first, you need to decide on the character sequence for your cursor. The most commonly used appears to be: - \ | /

    You can erase the character by simply backspacing and drawing the next character.

    So your program should perform some variation of the steps:

    1) Draw the current cursor character. 2) Pause for a little while. 3) Backspace. 4) Choose the next cursor character. 5) Go back to step 1.

    Of course, you'll have to perform that sequence while doing whatever other tasks your program is doing. But this is a start.

    Also, when you write the program, it may not appear to work, or work only in "bursts". To solve that problem, be sure to read Suffering from Buffering. If you need any more help, let us know.

    ...roboticus

Re: I am creating Perl Cursor
by Marshall (Canon) on Mar 13, 2010 at 10:52 UTC
    Being new to Perl is fine. But "I am creating Perl program that will make cursor appear spin" does not make sense. Can you give a better explanation of what you want?

      Not sure, but maybe he's referring to the mouse cursor shape that GUIs often use to indicate that something is busy — formerly known as "hour glass" cursor, but having more recently been replaced with all kinds of animated other shapes, in an attempt to make GUIs look more stylish...

      Note to the OP: never assume that people can read your mind and automagically will know what you're talking about... The shorter the question, the less context there is, and the more ambiguous terms often are for the reader.