So you would prefer for it to work like an array? Have an
"apache_table exists tableName key" and make "apache_table get
tableName key" force an error ?
On Apr 29, 2009, at 4:13 AM, Massimo Manghi wrote:
The syntax you have depicted here seems to be a very natural
approach to
the problem: easy to read and easy to use. This command has to
signal a few
potential error conditions though: table-key-value not existing, but
also more specifically
improper table names or not existing key in a valid table.
I welcomed the new 'try/catch/finally' construct recently
introduced for
Tcl8.6. I wonder if it's possible to adopt a style for raising
errors that might
encourage the programmer to exploit it. Personally I don't like the
idea of checking
for an empty string in order to understand if a key-value pair
exists (but i'm sure long
time Tcl programmers will shrug at my attitude)
-- Massimo
Karl Lehenbauer wrote:
Hi Guys,
I last brought this up a little over a year ago and other
priorities intervened but I have now implemented an "apache_table"
command and I want to get y'alls' feedback on it.
apache_table as currently implemented provides read/write access to
four tables in Apache: notes, headers_in, headers_out,
err_headers_out and subprocess_env.
Here's the syntax of the command:
apache_table get tableName key
returns the value of the specified key or an empty string
apache_table set tableName keyValueList
apache_table set tableName key value
In the first case, takes zero or more key-value pairs in
keyValueList and sets each key in the table with its corresponding
value.
In the second case, takes one key and one value and sets that
key and value into the specified table.
apache_table unset tableName key
Unsets the specified key-value pair from the table. It is not
an error to unset a key that doesn't exist.
apache_table names tableName
Returns a list of all the keys in the specified table.
apache_table array_get tableName
Returns the key-value pairs of the specified table as a list,
suitable for array set. For instance:
array set notes [apache_table array_get notes]
apache_table clear tableName
Invokes apr_table_clear to clear the contents of the specfied
table.
I think the above syntax is pretty reasonable. The part that's
questionable is providing access to headers_in, headers_out,
err_headers_out and subprocess_env. I know we already have a
mechanism for access to subprocess_env and would be more than
willing to remove any or all of these, or potentially add access to
other tables, although I'm not aware of other tables that would be
candidates.
---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscr...@tcl.apache.org
For additional commands, e-mail: rivet-dev-h...@tcl.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscr...@tcl.apache.org
For additional commands, e-mail: rivet-dev-h...@tcl.apache.org