For Programmers: Free Programming Magazines  


Home > Archive > Tcl > October 2006 > this is killing me









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author this is killing me
xvart

2006-10-06, 4:05 am

I am trying to use tclhttpd 3.5.1
I have modified tclhttpd.rc to contain "Config Auth {user,webmaster
password}"
I am trying to work out what happens to Config(Auth), it appears to
disappear, I can see it getting set but the auth.tcl file never see's
it.

I have placed a parray Config in config::init to try and trace this,
Specifically

array set Config [interp eval $i {array get Config}]
interp delete $i
set ConfigFile $config
parray Config
flush stdout
}

The parray produces no output.
If I loop through the elements a "foreach n [array .." thing it shows
data, this parray thing has happened before but I thought that was me,
the code was theaded that time.

WTF is going on, what am I doing wrong..

Is 8.4 broke, is there a buffer in 8.X that gets over written.

Ralf Fassel

2006-10-06, 4:05 am

* "xvart" <xvart@languid.me.uk>
| array set Config [interp eval $i {array get Config}]
| interp delete $i
| set ConfigFile $config
| parray Config
| flush stdout
| }
|
| The parray produces no output. If I loop through the elements a
| "foreach n [array .." thing it shows data,

You mean the 'parray' at that specific place in the code above does
not print anything, but if you replace that exact line (and not some
earlier line eg immediately after the 'array set') with a foreach
loop, it does show something in the array? Hard to imagine... If
this is indeed the case, 'parray' might have been redefined. What
happens if you move the parray immediately after the 'array set'?
Does [llength [array get Config]] show something > 0 at that place?
Might setting 'ConfigFile' trigger a trace which affects 'Config'?

R'


xvart

2006-10-06, 4:05 am


Ralf Fassel wrote:
> * "xvart" <xvart@languid.me.uk>
> | array set Config [interp eval $i {array get Config}]
> | interp delete $i
> | set ConfigFile $config
> | parray Config
> | flush stdout
> | }
> |
> | The parray produces no output. If I loop through the elements a
> | "foreach n [array .." thing it shows data,
>
> You mean the 'parray' at that specific place in the code above does
> not print anything, but if you replace that exact line (and not some
> earlier line eg immediately after the 'array set') with a foreach
> loop, it does show something in the array? Hard to imagine... If
> this is indeed the case, 'parray' might have been redefined. What
> happens if you move the parray immediately after the 'array set'?
> Does [llength [array get Config]] show something > 0 at that place?


This returns 72 so it does see the array

This is what the tail end of config.tcl config::init looks like
array set Config [interp eval $i {array get Config}]
interp delete $i
set ConfigFile $config
parray Config
puts [llength [array get Config]]
}

This is what happens when it's run

chroot /mnt/spike tclsh /var/local/tclhttpd3.5.1/bin/httpd.tcl -config
/var/local/tclhttpd3.5.1/bin/tclhttpd.rc -debug 1
72
auto_path:
/var/local/tclhttpd3.5.1/bin/../lib
/usr/lib/tcl8.4
/usr/lib
/usr/lib/tcllib1.8
/usr/lib/tcl8.4/tcllib1.8
/var/local/tclhttpd3.5.1/bin/../custom
can't find package limit
Running with default file descriptor limit


> Might setting 'ConfigFile' trigger a trace which affects 'Config'?
>
> R'


Alan Anderson

2006-10-06, 8:03 am

"xvart" <xvart@languid.me.uk> wrote:

> This is what the tail end of config.tcl config::init looks like


Is it copied and pasted directly, or is it retyped for our benefit? I
don't see anything wrong with it. Try adding something like
parray Env
just to make sure [parray] itself is working?

> array set Config [interp eval $i {array get Config}]
> interp delete $i
> set ConfigFile $config
> parray Config
> puts [llength [array get Config]]
> }

xvart

2006-10-06, 8:03 am


Alan Anderson wrote:[color=darkred]
> "xvart" <xvart@languid.me.uk> wrote:
>
>
> Is it copied and pasted directly, or is it retyped for our benefit? I
> don't see anything wrong with it. Try adding something like
> parray Env
> just to make sure [parray] itself is working?
>

I just pasted from the screen there is no printout from the parray the
72 is the length of the list.
tclhttpd has an issue in the auth.tcl file that prevents the Auth field
being accessed, this is what I was originally chasing. The parray as I
understand it should print, but it doesn't Config has content.

Bezoar

2006-10-06, 7:02 pm


xvart wrote:
> Alan Anderson wrote:
>
> I just pasted from the screen there is no printout from the parray the
> 72 is the length of the list.


See if its a problem with parray or with the array itself : instead of
parrray just print out Config as a list
and see if it works :

replace "parray Config"
with
puts "Config=\"[array get Config]\""

also you may want to try a parray or above code between the array set
and the interp delete to see
if you get any output.


> tclhttpd has an issue in the auth.tcl file that prevents the Auth field
> being accessed, this is what I was originally chasing. The parray as I
> understand it should print, but it doesn't Config has content.


Gerald W. Lester

2006-10-06, 7:02 pm

xvart wrote:
> I am trying to use tclhttpd 3.5.1
> I have modified tclhttpd.rc to contain "Config Auth {user,webmaster
> password}"
> I am trying to work out what happens to Config(Auth), it appears to
> disappear, I can see it getting set but the auth.tcl file never see's
> it.
>
> I have placed a parray Config in config::init to try and trace this,
> Specifically
>
> array set Config [interp eval $i {array get Config}]
> interp delete $i
> set ConfigFile $config
> parray Config
> flush stdout
> }
>
> The parray produces no output.


A quick search of the TclHttpd sources shows that in utils.tcl parray is
defined to return the information and not print it.

Try:

puts [parray Config]


--
+--------------------------------+---------------------------------------+
| Gerald W. Lester |
|"The man who fights for his ideals is the man who is alive." - Cervantes|
+------------------------------------------------------------------------+
suchenwi

2006-10-07, 8:05 am


Gerald W. Lester schrieb:
> A quick search of the TclHttpd sources shows that in utils.tcl parray is
> defined to return the information and not print it.
>
> Try:
>
> puts [parray Config]


Uh... I'd consider this a "broken interface" bug. Using the same name
with a different behavior is an unnecessary invitation for other
people's bugs... the "p" does indicate printing subtly at least. Why
can't they call their own thing "farray" (format) or so?

Gerald W. Lester

2006-10-07, 8:05 am

suchenwi wrote:
> Gerald W. Lester schrieb:
>
> Uh... I'd consider this a "broken interface" bug. Using the same name
> with a different behavior is an unnecessary invitation for other
> people's bugs... the "p" does indicate printing subtly at least. Why
> can't they call their own thing "farray" (format) or so?


The only answer is that if you use it in a .tml file it "prints" the array
to the .html that the view gets -- so for most people it does the "right thing".

Don't blame me, I just answered his question.

--
+--------------------------------+---------------------------------------+
| Gerald W. Lester |
|"The man who fights for his ideals is the man who is alive." - Cervantes|
+------------------------------------------------------------------------+
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com