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

perl syntax check, once more

Expand Messages
  • birgit.kellner@aon.at
    Browsing the list archives, I realized that capturing the output of a perl -c -command to StdError.Err involves problems (which I also experienced). I was
    Message 1 of 12 , Aug 5, 2001
    • 0 Attachment
      Browsing the list archives, I realized that capturing the output of
      a "perl -c"-command to StdError.Err involves problems (which I also
      experienced).

      I was wondering whether, to check the syntax of a perl script, you
      could just open the Windows command line (cmd.exe) with "perl -c ^**"
      as text. I tried, but the problem is that the command line window
      closes as soon as the syntax check is done. Is there any way to force
      it to stay open until the user presses enter?

      Birgit Kellner
    • Jody
      Hi Birgit, Try ^!ShellWait: ^!ShellWait CommandLine (added in v4.82) Similar to the ^!Shell command, but waits until the launched program is terminated before
      Message 2 of 12 , Aug 5, 2001
      • 0 Attachment
        Hi Birgit,

        Try ^!ShellWait:

        ^!ShellWait CommandLine (added in v4.82)
        Similar to the ^!Shell command, but waits until the launched
        program is terminated before moving to the next Clip instruction.
        Unlike the ^!Wait command, you can continue editing files in
        NoteTab while the application is running.
        Example: ^!ShellWait WordPad c:\autoexec.bat

        >Browsing the list archives, I realized that capturing the output of
        >a "perl -c"-command to StdError.Err involves problems (which I also
        >experienced).
        >
        >I was wondering whether, to check the syntax of a perl script, you
        >could just open the Windows command line (cmd.exe) with "perl -c ^**"
        >as text. I tried, but the problem is that the command line window
        >closes as soon as the syntax check is done. Is there any way to force
        >it to stay open until the user presses enter?
        >
        >Birgit Kellner
        >
        >
        >
        >
        >
        >Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/


        Happy Clip'n!
        Jody

        http://www.notetab.net

        Subscribe, UnSubscribe, Options
        mailto:Ntb-Clips-Subscribe@yahoogroups.com
        mailto:Ntb-Clips-UnSubscribe@yahoogroups.com
        http://www.egroups.com/group/ntb-clips
      • Alan C.
        Hi, Birgit, did you get ^!shellwait to keep the console open? On some of my .pl files that are associated with the windows shell I tinkered with ^!shellwait,
        Message 3 of 12 , Aug 5, 2001
        • 0 Attachment
          Hi,

          Birgit, did you get ^!shellwait to keep the console open?

          On some of my .pl files that are associated with the windows shell
          I tinkered with ^!shellwait, ^!shell, and ^!dos Ntab clip language commands
          but I not yet arrive at a way in which it (the shell commands) works so as
          to keep the console window open with Perl.

          If anyone either already uses or gets the above to keep the console window
          open, I'd like to see the method.

          If the following is of any use to anyone, for console to stay open, I've
          been utilize Ntab ability send keystrokes to another app as the following
          clip does so.

          (strike shift key closes console) be aware that Ntab is locked into a
          repeating loop until strike the shift key (even so, probably occupies a
          negligible amount of resources) or just do away with the last 5 lines of
          the clip.

          For .pl files need edit the following and change all occurrences of .plx to .pl

          For syntax check, ^!Keyboard #perl ^%curdoc%# ENTER

          need become

          ^!Keyboard #perl -c ^%curdoc%# ENTER

          H="runPerl_CurrDoc"
          ^!IfSame ^$Getext(^**)$ .plx Skip_2
          ^!Info [L]^**^%nl% is not a .plx file and will not run under DOS.
          ^!Goto Exit
          ^!Set %curdoc%=^**
          ^!IfAppOpen "C:\WINNT\System32\cmd.exe" skip_2
          ^!cmd.exe
          ^!Delay 3
          ^!FocusApp "C:\WINNT\System32\cmd.exe"
          ^!Keyboard #perl ^%curdoc%# ENTER

          ^!SetHintInfo Shift key closes console app . . .
          ^!IfTrue ^$IsShiftKeyDown$ skip_2
          ^!delay 1
          ^!Goto skip_-2
          ^!Keyboard #exit# ENTER
          ; ----<end clip<<

          >could just open the Windows command line (cmd.exe) with "perl -c ^**"
          >as text. I tried, but the problem is that the command line window
          >closes as soon as the syntax check is done. Is there any way to force
          >it to stay open until the user presses enter?
        • Don Passenger
          I don t fully understand what you are trying to do Alan, but in Wayne s Note Awk Library he has a clip which checks the syntax of a perl script and reports the
          Message 4 of 12 , Aug 5, 2001
          • 0 Attachment
            I don't fully understand what you are trying to do Alan, but in Wayne's Note
            Awk Library he has a clip which checks the syntax of a perl script and
            reports the result back. You can get his library from a link on notetab
            site as I recall.

            ---
            Don Passenger
            mailto:dpasseng@...
            personal: http://www.iserv.net/~dpasseng
            work: http://www.grcourt.org
            ----- Original Message -----
            From: "Alan C." <acummings@...>
            To: <ntb-clips@yahoogroups.com>
            Sent: Sunday, August 05, 2001 7:47 PM
            Subject: Re: [Clip] perl syntax check, once more


            > Hi,
            >
            > Birgit, did you get ^!shellwait to keep the console open?
            >
            > On some of my .pl files that are associated with the windows shell
            > I tinkered with ^!shellwait, ^!shell, and ^!dos Ntab clip language
            commands
            > but I not yet arrive at a way in which it (the shell commands) works so as
            > to keep the console window open with Perl.
            >
            > If anyone either already uses or gets the above to keep the console window
            > open, I'd like to see the method.
            >
            > If the following is of any use to anyone, for console to stay open, I've
            > been utilize Ntab ability send keystrokes to another app as the following
            > clip does so.
            >
            > (strike shift key closes console) be aware that Ntab is locked into a
            > repeating loop until strike the shift key (even so, probably occupies a
            > negligible amount of resources) or just do away with the last 5 lines of
            > the clip.
            >
            > For .pl files need edit the following and change all occurrences of .plx
            to .pl
            >
            > For syntax check, ^!Keyboard #perl ^%curdoc%# ENTER
            >
            > need become
            >
            > ^!Keyboard #perl -c ^%curdoc%# ENTER
            >
            > H="runPerl_CurrDoc"
            > ^!IfSame ^$Getext(^**)$ .plx Skip_2
            > ^!Info [L]^**^%nl% is not a .plx file and will not run under DOS.
            > ^!Goto Exit
            > ^!Set %curdoc%=^**
            > ^!IfAppOpen "C:\WINNT\System32\cmd.exe" skip_2
            > ^!cmd.exe
            > ^!Delay 3
            > ^!FocusApp "C:\WINNT\System32\cmd.exe"
            > ^!Keyboard #perl ^%curdoc%# ENTER
            >
            > ^!SetHintInfo Shift key closes console app . . .
            > ^!IfTrue ^$IsShiftKeyDown$ skip_2
            > ^!delay 1
            > ^!Goto skip_-2
            > ^!Keyboard #exit# ENTER
            > ; ----<end clip<<
            >
            > >could just open the Windows command line (cmd.exe) with "perl -c ^**"
            > >as text. I tried, but the problem is that the command line window
            > >closes as soon as the syntax check is done. Is there any way to force
            > >it to stay open until the user presses enter?
            >
            >
            >
            >
            >
            > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
            >
            >
          • birgit.kellner@aon.at
            ... Wayne s Note ... and ... notetab ... Hm, I downloaded the library, but it doesn t seem to contain a clip for syntax checking - did I miss something? The
            Message 5 of 12 , Aug 5, 2001
            • 0 Attachment
              --- In ntb-clips@y..., "Don Passenger" <dpasseng@i...> wrote:
              > I don't fully understand what you are trying to do Alan, but in
              Wayne's Note
              > Awk Library he has a clip which checks the syntax of a perl script
              and
              > reports the result back. You can get his library from a link on
              notetab
              > site as I recall.

              Hm, I downloaded the library, but it doesn't seem to contain a clip
              for syntax checking - did I miss something?

              The clip that Alan posted works fine for me: the command line window
              waits until I hit the shift button. The only thing I would like to
              add is to have the NoteTab-window focused after the command line
              window closes.

              Thanks,

              Birgit Kellner
            • Jason Waugh
              ... Go to the Clip Repository at www.notetab.com and download the PerlDE clip library. That s one I made to deal with All Things Perl. I ve actually done a
              Message 6 of 12 , Aug 5, 2001
              • 0 Attachment
                On 05/08/2001 at 4:47 PM Alan C. wrote:
                >On some of my .pl files that are associated with the windows shell
                >I tinkered with ^!shellwait, ^!shell, and ^!dos Ntab clip language
                >commands
                >but I not yet arrive at a way in which it (the shell commands) works so as
                >to keep the console window open with Perl.


                Go to the Clip Repository at www.notetab.com and download the PerlDE clip library. That's one I made to deal with All Things Perl. I've actually done a lot of revamping of the clips in that library, and added a few more useful ones (jump to subroutine, run code through the Perl profiler) - let me package that up and make it available on my FTP server. I'll post a link tomorrow. For now, though, the clip that's already at the Notetab site does what you want to do... http://www.notetab.com/scripting.htm


                Thanks,
                Jason Waugh.
              • Don Passenger
                glad you have it solved it is under the use your own script section about the fourth one down says .... check syntax however it outputs to a notetab document
                Message 7 of 12 , Aug 5, 2001
                • 0 Attachment
                  glad you have it solved
                  it is under the use your own script section
                  about the fourth one down
                  says .... "check syntax"

                  however it outputs to a notetab document titled StdError.err
                  which you seemed to indicate as I read futher may be causing you some
                  problem

                  it works great for me and I use it all the time

                  I am anxious to see what Jason has to offer too.
                  I would like to get a copy of his revamped library.

                  ---
                  Don Passenger
                  mailto:dpasseng@...
                  personal: http://www.iserv.net/~dpasseng
                  work: http://www.grcourt.org
                  ----- Original Message -----
                  From: <birgit.kellner@...>
                  To: <ntb-clips@yahoogroups.com>
                  Sent: Sunday, August 05, 2001 9:53 PM
                  Subject: Re: [Clip] perl syntax check, once more


                  > --- In ntb-clips@y..., "Don Passenger" <dpasseng@i...> wrote:
                  > > I don't fully understand what you are trying to do Alan, but in
                  > Wayne's Note
                  > > Awk Library he has a clip which checks the syntax of a perl script
                  > and
                  > > reports the result back. You can get his library from a link on
                  > notetab
                  > > site as I recall.
                  >
                  > Hm, I downloaded the library, but it doesn't seem to contain a clip
                  > for syntax checking - did I miss something?
                  >
                  > The clip that Alan posted works fine for me: the command line window
                  > waits until I hit the shift button. The only thing I would like to
                  > add is to have the NoteTab-window focused after the command line
                  > window closes.
                  >
                  > Thanks,
                  >
                  > Birgit Kellner
                  >
                  >
                  >
                  >
                  >
                  > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
                  >
                  >
                • Jason Waugh
                  You can get the latest Perl Development Environment clip library at this link: ftp://apsyrtes.dns2go.com/perlde.zip I would appreciate it if anybody makes any
                  Message 8 of 12 , Aug 5, 2001
                  • 0 Attachment
                    You can get the latest Perl Development Environment clip library at this link:

                    ftp://apsyrtes.dns2go.com/perlde.zip


                    I would appreciate it if anybody makes any useful changes to it, I be notified so I can benefit too! Also, if anybody thinks anything should be added that isn't there.... let me know.


                    (And yes, this will Syntax Check etc. by launching a command window which won't disappear until you press a key....)

                    Also, please note, that most of the HELP functions (and package management functions) work in one of two ways: either launch the clip, and you will be prompted.... or select some text and the clip will use that as its input. (i.e. if you are looking at some code, and you see a JOIN function, just select the word join... double-click the "Function Help" and it will show you the help for JOIN. Alternatively, you can just double-click the "Function Help" clip with nothing selected, and you will be prompted... at which point you can type JOIN.)

                    Also, I'm not sure how much of this library will work for users of anything other than Activestate's Perl build....


                    Enjoy,
                    Jason Waugh.
                  • Alan C.
                    Hi, Jason, Birgit (1/2 way down), Hey this is a really neat .clb Thanks Jason. ... Jason, follows perhaps is noteworthy, perhaps not. H= Run ^!ChDir
                    Message 9 of 12 , Aug 5, 2001
                    • 0 Attachment
                      Hi,

                      Jason, Birgit (1/2 way down),

                      Hey this is a really neat .clb Thanks Jason.
                      ---------------------------

                      Jason, follows perhaps is noteworthy, perhaps not.

                      H=" Run"
                      ^!ChDir ^$GetShort("^$GetPath("^##")$")$
                      ^!Set %curdoc%=^$GetShort("^**")$
                      ^!Shell "^$GetLibraryPath$launch.bat" "^$GetPerlExe$ ^%curdoc%"

                      (perhaps could also wrap the shell line just like the chdir line and retain
                      only two lines of code instead of three)

                      I keep all my perl files near the root of c:\ (under c:\perl) and I also
                      have short directory names *without any spaces in them* So I personally
                      do not need like the above.

                      However, just for kicks, (save into any directory that has a space in the
                      filename) I saved one of my perl files into c:\program files

                      And, from that dir, your run clip as well as some your other clips which
                      are without the ^$GetShort("")$ would not launch, said/reported couldn't
                      find or something similar.

                      I know that ^$GetShort("")$ is safe it always works.
                      ---------------------------


                      Birgit,

                      >The clip that Alan posted works fine for me: the command line window
                      >waits until I hit the shift button. The only thing I would like to
                      >add is to have the NoteTab-window focused after the command line
                      >window closes.

                      Doesn't act that way on mine. On mine, Ntab window IS in focus after
                      console closes. But to make yours be in focus U could add the following
                      line as a last line in the clip:

                      ^!FocusApp "NoteTab*"

                      Probably, like me, you'll prefer to use Jason's .clb rather than my clip.

                      Oh, by the way, I think my clip also has the same ^$GetShort("")$ issue as
                      like the above.

                      Regards. Alan.
                    • birgit.kellner@aon.at
                      ... Yes, I was actually using that library, but for some reason the syntax check wouldn t work. Running a script doesn t work either - the shell tells me that
                      Message 10 of 12 , Aug 7, 2001
                      • 0 Attachment
                        --- In ntb-clips@y..., "Jason Waugh" <jwaugh26@h...> wrote:
                        > You can get the latest Perl Development Environment clip library at
                        this link:
                        >
                        > ftp://apsyrtes.dns2go.com/perlde.zip

                        Yes, I was actually using that library, but for some reason the
                        syntax check wouldn't work. Running a script doesn't work either -
                        the shell tells me that the syntax of the file name, the directory
                        name etc. is wrong. I suspect that this is to do with a wrong perl
                        path I typed the first time I used the library - any way to change
                        that?

                        By the way, one thing I changed in the library was the behaviour of
                        auto-completion of "else". My "else" loops never make use of
                        parentheses, so I deleted those and shifted the cursor positioning to
                        in between the braces.

                        Best regards,

                        Birgit Kellner
                      • wheeler54321@yahoo.com
                        Hi Birgit! If you are using Windows NT/2000- ^!Chdir does not work with Windows NT/2000 when using Perl (ActivePerl). You can either pass the path to Perl
                        Message 11 of 12 , Aug 7, 2001
                        • 0 Attachment
                          Hi Birgit!

                          If you are using Windows NT/2000-

                          ^!Chdir does not work with Windows NT/2000 when using Perl
                          (ActivePerl). You can either pass the path to Perl using "^!
                          TextToFile ..." and use "chdir $path;" in Perl itself...or something
                          like that...

                          wheeler


                          > Yes, I was actually using that library, but for some reason the
                          > syntax check wouldn't work. Running a script doesn't work either -
                          > the shell tells me that the syntax of the file name, the directory
                          > name etc. is wrong. I suspect that this is to do with a wrong perl
                          > path I typed the first time I used the library - any way to change
                          > that?
                        • Jason Waugh
                          Of course Chdir works with 2000... I use 2000! Alan C. had it correct, it has to do with the spaces in folder names. I keep all my scripts and my perl
                          Message 12 of 12 , Aug 7, 2001
                          • 0 Attachment
                            Of course Chdir works with 2000... I use 2000!

                            Alan C. had it correct, it has to do with the spaces in folder names. I keep all my scripts and my perl installation in directories w/out spaces in the names, so didn't notice - however, if I try and run a script from a directory with a space (like PROGRAM FILES\whatever) it bombs.... Alan was correct with the GetShort.

                            As for not using braces with else statements.... all I can say is Birgit, tsk tsk. I think braces and brackets should ALWAYS be used for anything... even one liners should be properly formatted... just so to make it super readable for those who come behind you. Of course, this is a matter of personal style... I wouldn't expect those autocomplete clips to be perfect for anybody but myself. ;)



                            On 07/08/2001 at 5:35 PM wheeler54321@... wrote:
                            >If you are using Windows NT/2000-
                            >
                            >^!Chdir does not work with Windows NT/2000 when using Perl
                            >(ActivePerl). You can either pass the path to Perl using "^!
                            >TextToFile ..." and use "chdir $path;" in Perl itself...or something
                            >like that...
                            >
                            >> Yes, I was actually using that library, but for some reason the
                            >> syntax check wouldn't work. Running a script doesn't work either -
                            >> the shell tells me that the syntax of the file name, the directory
                            >> name etc. is wrong. I suspect that this is to do with a wrong perl
                            >> path I typed the first time I used the library - any way to change
                            >> that?
                          Your message has been successfully submitted and would be delivered to recipients shortly.