TCL Packages

  • Creator
    Topic
  • #49884
    James Sedlmeyer
    Participant

    I want to create a tcl package of common ODBC tcl code that I can access from another tcl proc. Can anyone out there point me in the right direction?

Viewing 4 reply threads
  • Author
    Replies
    • #64001
      Nate Kruse
      Participant

      Are you looking for pointers on how to create a package or looking for ideas on what ODBC tcl scripts to include?

    • #64002
      James Sedlmeyer
      Participant

      I’m looking for pointers on creating the packages.

      Thanks

    • #64003
      Nate Kruse
      Participant

      Here is an example for the format of a package:

      package provide shmc_email [lindex {Revision: 1.0 } 1]

      namespace eval shmc_email {

         namespace export email

         proc email {aEmail aSubject aMessage} {

             ….

         }

      }

      Here is how to use/call the package from another tcl script:

      package require shmc_email

      if [catch {shmc_email::email $email $subject $message} err] {

         echo “Error Calling SHMC_Email –$err”

      }

      You will need to add the package file to the ../../integrator/tclprocs/lib directory.  

      Also, add a line to the pkgIndex.tcl file so the system knows about the package:

      package ifneeded shmc_email 1.0

        ]

        I hope this helps.  It’s been a few months since I’ve done one and while mine works, it may not be the exact way others do it.

        Nate.

      1. #64004
        Russ Ross
        Participant

        To keep packages from being blown away here at MD Ancerson Cancer Center when doing a cloverleaf upgrade, we created a mda_global site and create the following directory to house our packages

        $HCIROOT/mda_global/tclprocs/packages

        then we create the following link as follows

        ln -sf   $HCIROOT/mda_global/tclprocs/packages   packages

        By the way, the pkg_mkIndex is a hcitcl command and not a standalone script like mktclindex so to run in our case we do the following:

        hcitcl -c “pkg_mkIndex -verbose — $HCIROOT/tclprocs/packages”

        which will create a file called

        pkgIndex.tcl

        Also a nice thing about packages is that you can associate a version with each package which will allow you to access an old version if specified; otherwise, you get the most recent version.

        Russ Ross
        RussRoss318@gmail.com

      2. #64005
        James Sedlmeyer
        Participant

        Thanks for everyones help. Much appreciated.

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

    Forum Statistics

    Registered Users
    5,126
    Forums
    28
    Topics
    9,296
    Replies
    34,439
    Topic Tags
    287
    Empty Topic Tags
    10