Loading ...
Sorry, an error occurred while loading the content.
 

Re: [NTS] Perl 5.8 vs. Notetab

Expand Messages
  • Sheri
    ... Hi Alec, 5.8.1? Maybe you re mistaken, what does perl -v report? I got the latest one on the ActiveState as of yesterday, and mine says: This is perl,
    Message 1 of 4 , Apr 3, 2003
      At 11:38 PM 4/2/03 -0500, Alec wrote:
      >Not recently. I've got Perl 5.8.1 (I needed it for latest version of
      >PopFile.)

      Hi Alec,

      5.8.1? Maybe you're mistaken, what does

      perl -v

      report?

      I got the latest one on the ActiveState as of yesterday, and mine says:

      This is perl, v5.8.0 built for MSWin32-x86-multi-thread
      (with 1 registered patch, see perl -V for more detail)

      Copyright 1987-2002, Larry Wall

      Binary build 805 provided by ActiveState Corp. http://www.ActiveState.com
      Built 18:08:02 Feb 4 2003


      >I just ran the line-number demo (in Sample clips) and got a block character
      >added at the end of the last line:
      >
      >>>00001 one
      >00002 two
      >00003 three
      >00004 four
      >00005 five
      >00006 six<<
      >
      >Is that what you're talking about?

      Yes that's it. If you select the character and run this clip command on it, it reports it is a decimal character 26.

      ^!Info ^$ChartoDec(^$GetSelection$)$

      I did some research and found out this is the same character MS-DOS uses as an end-of-file mark (Ctrl-Z).

      It doesn't necessarily come back as the last character printed to Notetab, e.g., a reverse sort in Perl will put it at the top. So its a character that really needs to be removed from Perl's standard input buffer. I don't know how to do that.

      Also Notetab Replace clip commands won't remove it from the output (although the Replace dialog will).

      The best I've come up with so far is to add this inside to the "while (<>)" loop of each of my Perl scripts that are fed by ^!RunPerl or ^!RunScript:

      if ($] > 5.006) {
      $badchar = chr(26);
      s/($badchar)$//;
      }

      But that way it runs on each input unit (e.g., line or paragraph) instead of just the last one (which would be more appropriate). I guess it doesn't matter, but I would like to know how to apply it to the last unit only.

      Or if there is some better way to approach it that wouldn't require changing each script or clip.

      Any ideas?

      Regards,
      Sheri
    • Sheri
      ... Found a way to apply it to the last record only, but still interested in better ideas: if (eof && $] 5.006) { $badchar = chr(26); s/($badchar)$//; }
      Message 2 of 4 , Apr 3, 2003
        At 11:01 AM 4/3/03 -0500, I wrote:

        >The best I've come up with so far is to add this inside to the "while (<>)" loop of each of my Perl scripts that are fed by ^!RunPerl or ^!RunScript:
        >
        >if ($] > 5.006) {
        > $badchar = chr(26);
        > s/($badchar)$//;
        >}
        >
        >But that way it runs on each input unit (e.g., line or paragraph) instead of just the last one (which would be more appropriate). I guess it doesn't matter, but I would like to know how to apply it to the last unit only.

        Found a way to apply it to the last record only, but still interested in better ideas:

        if (eof && $] > 5.006) {
        $badchar = chr(26);
        s/($badchar)$//;
        }

        Regards,
        Sheri
      • Grant MacKenzie
        I am not sure about this but think this is a problem to do with the Byte Order Mark (BOM) used in unicode in Perl 5.8 the Unicode model has completely
        Message 3 of 4 , Apr 7, 2003
          I am not sure about this but think this is a problem to do with the Byte
          Order Mark (BOM) used in unicode

          "in Perl 5.8 the Unicode model has completely changed: now the
          ``Unicodeness'' is bound to the data itself,"
          REF: perl documentation

          When using the WSH stdin stdOut i also ran into this so I do a regEx on the
          read stream.

          var stdin = WScript.StdIn;
          var stdout = WScript.StdOut;
          var inStr = stdin.ReadAll();
          inStr = inStr.replace(//g, " ");

          The box thing as I understand it a way MS deals with an unrecognised
          character.
          If you have got spare time on your hands you might want to look at.
          A tutorial on character code issues
          http://www.cs.tut.fi/%7Ejkorpela/chars.html




          > >>>00001 one
          > >00002 two
          > >00003 three
          > >00004 four
          > >00005 five
          > >00006 six<<
          > >
          > >Is that what you're talking about?
          >
          > Yes that's it. If you select the character and run this clip
          > command on it, it reports it is a decimal character 26.
          >
          > ^!Info ^$ChartoDec(^$GetSelection$)$
          >
          > I did some research and found out this is the same character
          > MS-DOS uses as an end-of-file mark (Ctrl-Z).
          >
          > It doesn't necessarily come back as the last character printed to
          > Notetab, e.g., a reverse sort in Perl will put it at the top. So
          > its a character that really needs to be removed from Perl's
          > standard input buffer. I don't know how to do that.
          >
          > Also Notetab Replace clip commands won't remove it from the
          > output (although the Replace dialog will).
          >
          > The best I've come up with so far is to add this inside to the
          > "while (<>)" loop of each of my Perl scripts that are fed by
          > ^!RunPerl or ^!RunScript:
          >
          > if ($] > 5.006) {
          > $badchar = chr(26);
          > s/($badchar)$//;
          > }
          >
          > But that way it runs on each input unit (e.g., line or paragraph)
          > instead of just the last one (which would be more appropriate).
          > I guess it doesn't matter, but I would like to know how to apply
          > it to the last unit only.
          >
          > Or if there is some better way to approach it that wouldn't
          > require changing each script or clip.
          >
          > Any ideas?
          >
          > Regards,
          > Sheri
          >
          >
          >
          > ntb-scripts-unsubscribe@yahoogroups.com
          >
          >
          >
          > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
          >
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.