Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • \n or \r? (Score:4, Informative)

    In TCL Expect, I always had to use \r. I've still never mastered exactly when you have to do that for Expect.pm, and when you can get away with \n. Could it vary from system to system? What does the user get when he tries \r? Do we even know when we can use each and why?

    I'm debating whether or not to just put some of these things in a "known but inexplicable bugs" section and just release anyway.

    Do it. Standard manpages don't have a BUGS section for nothing, you know. You can fix them later, if

    --
    J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers
    • by djberg96 (2603) on 2003.04.29 10:38 (#19571) Journal
      In that case, I think I'll add a "terminator" option, which will default to "\n", but which the users can set to "\r" or "undef" (or whatever), as they prefer. It'll just have to be up to folks to figure out which one to use.

      Everything else works for me, including large files and globbing. I'm also debating whether to require 5.6, but I'm worried I'll piss too many people off. I wish I had done it from the start.

      • Re:\n or \r? (Score:3, Informative)

        Maybe the user set $\, which might output \n automatically if you are using print, and maybe two \n's were being sent ...
        • Worth checking, but I don't think so. The user explicitly said that removing the newline from the $scp->send call fixed the problem.
          • Right. If a newline is necessary, then including a newline with $\ = "\n" would send two newlines, and including no newline would send a single newline, since Expect->send uses print.
            • Oops - you're right. I spaced. Well, jdavidb's comment still warrants a "terminator" option I think, since I wasn't aware that a "\r" might be used.
              • I think the terminator to use depends on whether the terminal is in raw or cooked mode, so you might be able to check the mode and decide as appropriate. I think cooked mode translates \r to \n. I think I heard that \n should "always" work, for some value of always sufficiently less than or equal to 100%. :)

                But I really don't know.

                --
                J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers