• Strange problem with print

    From gamo@21:1/5 to All on Sat May 22 20:43:36 2021
    I have a program like this:

    #!/usr/bin/perl -w

    $|=1;

    while (1){
    blah();
    if ($success){
    localsearch();
    report(); # this is OK
    }
    }

    exit 1;

    sub report {
    system "clear";
    print "this $value \n";
    print FILE "this $value \n";
    return;
    }

    sub localsearch {
    doimprove();
    report(); # this is not OK, doesn't seems to work
    return;
    }

    Do you have an explanation to that bahavior?
    Thanks!



    --
    http://gamo.sdf-eu.org/
    perl -E 'say "Want a reverse joke? Yes? Begin to laugh.";'

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ben Bacarisse@21:1/5 to gamo on Sat May 22 21:59:09 2021
    gamo <gamo@telecable.es> writes:

    I have a program like this:

    #!/usr/bin/perl -w

    $|=1;

    while (1){
    blah();
    if ($success){
    localsearch();
    report(); # this is OK
    }
    }

    exit 1;

    sub report {
    system "clear";
    print "this $value \n";
    print FILE "this $value \n";
    return;
    }

    sub localsearch {
    doimprove();
    report(); # this is not OK, doesn't seems to work
    return;
    }

    Do you have an explanation to that bahavior?

    Something is wrong in a part of the program you are not showing us.

    Post as short a complete example as you can and trt to say what you mean
    by doesn't seem to work.

    --
    Ben.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From gamo@21:1/5 to All on Sun May 23 00:57:24 2021
    El 22/5/21 a las 22:59, Ben Bacarisse escribió:
    gamo <gamo@telecable.es> writes:

    I have a program like this:

    #!/usr/bin/perl -w

    $|=1;

    while (1){
    blah();
    if ($success){
    localsearch();
    report(); # this is OK
    }
    }

    exit 1;

    sub report {
    system "clear";
    print "this $value \n";
    print FILE "this $value \n";
    return;
    }

    sub localsearch {
    doimprove();
    report(); # this is not OK, doesn't seems to work
    return;
    }

    Do you have an explanation to that bahavior?

    Something is wrong in a part of the program you are not showing us.

    Post as short a complete example as you can and trt to say what you mean
    by doesn't seem to work.


    Sorry Ben, but I think I wrote the basic structure and the result is
    that the screen does not blink at the spected rate.

    --
    http://gamo.sdf-eu.org/
    perl -E 'say "User error. Insert another user.";'

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From gamo@21:1/5 to All on Sun May 23 02:09:52 2021
    El 23/5/21 a las 1:43, $Bill escribió:
    On 05/22/2021 15:57, gamo wrote:

    Sorry Ben, but I think I wrote the basic structure and the result is
    that the screen does not blink at the spected rate.

    If he can't run it (insufficient code provided), how do you expect him to debug it for you?

    You need to provide the smallest running and failing example possible.
    In the process of creating that, you'll probably fix it yourself.  ;)




    Thanks, Bill, that's a good idea, but I could go the other way around
    trying to find a replacement to

    system "clear";

    which I think is the weak point of the chain, and see what happens.

    ;)

    --
    http://gamo.sdf-eu.org/
    perl -E 'say "Error: The temperature entered is below absolute zero.";'

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From $Bill@21:1/5 to gamo on Sat May 22 16:43:31 2021
    On 05/22/2021 15:57, gamo wrote:

    Sorry Ben, but I think I wrote the basic structure and the result is
    that the screen does not blink at the spected rate.

    If he can't run it (insufficient code provided), how do you expect him to
    debug it for you?

    You need to provide the smallest running and failing example possible.
    In the process of creating that, you'll probably fix it yourself. ;)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ben Bacarisse@21:1/5 to gamo on Sun May 23 02:16:41 2021
    gamo <gamo@telecable.es> writes:

    El 23/5/21 a las 1:43, $Bill escribió:
    On 05/22/2021 15:57, gamo wrote:

    Sorry Ben, but I think I wrote the basic structure and the result is
    that the screen does not blink at the spected rate.

    If he can't run it (insufficient code provided), how do you expect him to
    debug it for you?

    You need to provide the smallest running and failing example possible.
    In the process of creating that, you'll probably fix it yourself.  ;)

    Thanks, Bill, that's a good idea, but I could go the other way around
    trying to find a replacement to

    system "clear";

    which I think is the weak point of the chain, and see what happens.

    You may be able to capture the control sequence that clear uses so you
    don't have to run a command every time:

    my $cls = `clear`;
    ...
    print $cls, "this $value\n";

    or you can use $cls = `tput clear` if you have the tput command.

    But I imagine the problem is to do with the timing since you are
    probably relying on a software emulation of a terminal.

    --
    Ben.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From gamo@21:1/5 to All on Sun May 23 03:35:50 2021
    El 23/5/21 a las 3:16, Ben Bacarisse escribió:
    Thanks, Bill, that's a good idea, but I could go the other way around
    trying to find a replacement to

    system "clear";

    which I think is the weak point of the chain, and see what happens.
    You may be able to capture the control sequence that clear uses so you
    don't have to run a command every time:

    my $cls = `clear`;
    ...
    print $cls, "this $value\n";

    or you can use $cls = `tput clear` if you have the tput command.

    But I imagine the problem is to do with the timing since you are
    probably relying on a software emulation of a terminal.


    I found a good alternative that does the job with no blink at all:

    printf "\033c";

    Thanks!

    --
    http://gamo.sdf-eu.org/
    perl -E 'say "free + return give me the setence: FISH RAM";'

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)