Wapp

package require: can’t find package
Login

package require: can't find package

(1) By ATK (akoroma) on 2020-09-29 05:31:06 [link] [source]

proc wapp-default {} {
 wapp-trim {
 <form method='POST' action="/testpackage">
  <fieldset>
   <legend>Card Payment Details:</legend>
   <input type='text' name='cfname' placeholder='FirstName' required=1/>
   <input type='text' name='clname' placeholder='LastName' required=1/><br>
   <input type='email' name='cemail' placeholder='Email@Address.dot' required=1/><br><br>
   <input type='submit' value='Connect' primary=1/><input type='reset' value='resetAll'/><br>
  </fieldset>
 </form>	
  }
}

proc wapp-page-testpackage {} {
	package require nats
	
	set conn [nats::connection new "iNATS"]
	[$conn cget -logger]::setlevel info
	$conn configure -servers nats://localhost:4222		
	$conn connect
	wapp-trim{<p>Connected\(%string($conn))</p>}
}

========================
The server error output;
========================
xxx@hostname:/export/apps/wapp$ ./wapptclsh /home/dev/payment/webNATS.tcl --server 8080
Listening for HTTP requests on TCP port 8080
ERROR: can't find package nats
    while executing
"package require nats"
    (procedure "wapp-page-testpackage" line 2)
    invoked from within
"wapp-page-$mname"

=====================
However, from tclsh;
=====================
xxx@hostname:/export/apps/wapp$ tclsh
% 
% package require nats
0.9
% 

There are too many dependencies so I can't source the nats package directly into my script as a work-around. 

I cannot access any of my installed packages, any insights will be appreciated

(2) By D. Richard Hipp (drh) on 2020-09-29 11:01:42 in reply to 1 [source]

The wapptclsh program links against just the C-code for TCL. It does not include the auxiliary TCL scripts. So commands that are implemented using TCL scripts are not included in the default wapptclsh build. Those commands include:

  • clock
  • package
  • paarray

And probably others.