Wapp

Added other packages for ”wapptclsh”?
Login

Added other packages for "wapptclsh"?

(1.1) By midijohnny on 2024-10-15 10:42:29 edited from 1.0 [source]

I'm new to TCL - so not got my head around package management.
If I use 'wapptclsh' - how can I 'install' ('import'?) other packages.
For instance tdom ?

Background:

There are a number of way of running a Wapp app - two of which I have got working.

Direct invocation with a shebang for my local tclsh installation, using 'source' like this:

#!/usr/bin/tclsh
source $env(HOME)/Documents/third-party-downloads/wapp/wapp.tcl
package require wapp
package require sqlite3
package require tdom
[...]

Note: I already have 'tdom' installed in my tcl env. I can run this with "./hello.tcl" and a webserver is magically started on a random port, and my browser launches and connects.

Using 'althttp' - same script, just with the right permissions, and right place.

This works the same - but I now get to just point at http://localhost:8080/hello.tcl (etc).

Using 'wapptclsh' - I launch the script like this:

#!/bin/bash
export APP=$HOME/Documents/third-party-downloads/wapp/wapptclsh
$APP hello.tcl

This also works: but doesn't find 'tdom':

[...]wapptclsh: can't find package tdom
    while executing
"package require tdom"

I tried adding this:

lappend auto_path "/usr/lib/tcltk/x86_64-linux-gnu/tdom0.9.2"

(2) By Sudheer Apte (skiask) on 2025-01-08 15:49:35 in reply to 1.1 [link] [source]

Were you able to solve the problem of not being able to find packages from wapptclsh?

You might be running into a limitation of wapptclsh, if I understand it correctly. The wapptclsh executable somehow changes the normal tcl "package require" processing to quickly load "wapp" as a special case. This might be causing it to not find "tdom"?

(3.3) By Vetelko (vetelko) on 2025-01-13 11:59:02 edited from 3.2 in reply to 1.1 [link] [source]

$auto_path variable and some procedures like parray are definitely not working in wapptclsh