'warn' produces additional output

From: Martin Kissner (news_at_chaos-net.de)
Date: 02/25/05

  • Next message: jl_post_at_hotmail.com: "Re: Read from keyboard"
    Date: Fri, 25 Feb 2005 15:08:47 +0100
    
    

    The following script produces a few lines of output on STDERR.
    Some of the lines are supposed to be red (works at least on zsh, bash
    and tcsh).

    First question:
    Why is there a trailing line after "Output line two" with a leading
    space character?
    " at ./warn.pl line 9."
    The only difference between the two warn statements is the position of
    the "\n".

    Second question:
    What are the general prerequisites which cause 'warn' to produce this
    additional output?

    ---- code ----

    #!/usr/bin/perl

    # use warnings;
    use strict;

    print "Output line one:\n";
    warn "\tMy statusmessage\n";
    print "Output line two:\n";
    warn "\033\[1;31m \tMy statusmessage\n\033\[1;00m"; # this is line 9
    print "Output line three:\n";
    warn "\033\[1;31m \tMy statusmessage\033\[1;00m\n";

    --- end code ---

    -- 
    perl -e '$|=1;&p(7.74.117.115.116.32);&s();&p(97.110.111);&p(116.104.101
    .114);&s;&p(32.112.101.114.108);&s();&p(32.104.97.99.107.101.114.10);sub
     s{sleep 1};sub p(){print "@_"}'
    

  • Next message: jl_post_at_hotmail.com: "Re: Read from keyboard"

    Relevant Pages

    • Re: warn produces additional output
      ... > The following script produces a few lines of output on STDERR. ... > Some of the lines are supposed to be red (works at least on zsh, ...
      (comp.lang.perl.misc)
    • Re: Output to file
      ... > Perhaps the output is going to stderr instead of stdout. ... Only with bash. ... zsh)). ...
      (comp.unix.shell)