You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rivet-dev@tcl.apache.org by Massimo Manghi <mx...@apache.org> on 2012/03/22 00:23:50 UTC

introspection with the ::rivet::info command

I've been thinking recently to add some introspection in Rivet coding a
::rivet::info command similar to PHP's phpinfo(). A natural way to use this
command could be reading values of configuration parameters and other stuff.
 
For example ::rivet::info should return the value of configuration parameters 
that now are stored in 3 undocumented arrays RivetServerConf, RivetDirConf and 
RivetUserConf. 

My idea is to store internally the configuration parameters in a
dictionary and let ::rivet::info be an interface to this dictionary

 ::rivet::info ?<parameter_class>? ?<parameter_name>?

examples

 puts [::rivet::info server child_init]
<== <ChildInitScript value>


in case SeparateVirtualInterps is off

 puts [::rivet::info server separate_virtual_interps]
<== 0

puts [::rivet::info dir]
<== <dictionary of per-dir configuration params>

puts [::rivet::info]
<== <whole configuration parameters dictionary>

current way of storing these parameters could be emulated by
adding lines to Rivet's conf file such as

array set RivetServerConf [::rivet::info server]

to store in an array the per server parameter values,

in a BeforeScript directive this command

array set RivetDirConf [::rivet::info dir]

would get per dir parameter values into an array.

a dictionary would be OK because has better flexibility by 
organizing parameters in different classes 
(first argument to the command) and it could be extended 
easily to other parameters classes and values

introspection through the ::rivet::info command will be safer and it
should save the developer from doing trivial errors such as resetting or
changing variables in the global arrays where parameters are now (I
think basically they had been stored there only for debugging purposes)

 

 -- Massimo
  





---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-dev-help@tcl.apache.org


Re: introspection with the ::rivet::info command

Posted by Harald Oehlmann <ha...@elmicron.de>.
Am 22.03.2012 00:23, schrieb Massimo Manghi:
> I've been thinking recently to add some introspection in Rivet coding a
> ::rivet::info command similar to PHP's phpinfo(). A natural way to use this
> command could be reading values of configuration parameters and other stuff.
>  
> For example ::rivet::info should return the value of configuration parameters 
> that now are stored in 3 undocumented arrays RivetServerConf, RivetDirConf and 
> RivetUserConf. 
> 
> My idea is to store internally the configuration parameters in a
> dictionary and let ::rivet::info be an interface to this dictionary

That sounds good !
I like dictionaries. I would also like to modify the whole rivet
standard library to use dicts where arrays are used today.
But first, security must be raised...

About entities: I have no opinion on the name. As the main task is
encoding, I would prefer to have a short name for encoding but a longer
one for decoding:
::rivet::entities
::rivet::entities_to_utf8

Enjoy,
Harald

---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-dev-help@tcl.apache.org