tcl and perl on Windows

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf tcl and perl on Windows

  • Creator
    Topic
  • #53452
    Kyle Mertens
    Participant

      I have a Perl script I want to execute from a tcl script that replaces the delimitors in a file.  I was able to do this years ago, but that was on a UNIX server.  I am trying it now on Windows and I am not having luck.  I know I am missing something simple, but can’t find it.

      I placed the tcl script under TPS Directory Parse under the Protocol Properties.  It works great on UNIX.  

      Here is the tcl code:

          keylget args MSGID mh

          set files [msgget $mh]

          set dir [file join $env(HCISITEDIR) inFile ]

          set script [file join $env(HCISITEDIR) scripts cleanup]

          foreach file $files {

               set filepath [file join $dir $file]

               exec $script $filepath

          }

          lappend dispList “CONTINUE $mh”

      Here is the Perl commands:

          perl -pi -e ‘s/n/r/g’ $1

          perl -pi -e ‘s/(.*)r/$1n/’ $1

          perl -pi -e ‘s/rMSH/nMSH/g’ $1

    Viewing 2 reply threads
    • Author
      Replies
      • #77740
        David Barr
        Participant

          You haven’t specified an interpreter, so this wouldn’t work on Unix unless you have a #!/usr/bin/perl header on the Perl script. On Windows I think you need to make sure that your script filename suffix (usually .pl) is associated with your Perl interpreter. Another alternative is to specify the interpreter on the exec line of the TCL script, so it would be something like “exec $::HciRoot/bin/perl.exe $script $filepath”.

        • #77741
          Charlie Bursell
          Participant

            Windows can only execute .exe, .com, or .bat scripts from Tcl.  It is a windows thing.

            To execute a perl script in Tcl from Windows, exec perl and pass it the full path of the perl script

          • #77742

            But … why do you need to call perl do do those things? All of that can easily be done right in tcl.

            -- Max Drown (Infor)

        Viewing 2 reply threads
        • The forum ‘Cloverleaf’ is closed to new topics and replies.