|
Posted by comp.lang.tcl on 03/09/06 00:34
I wrote this PHP function in the hopes that it would properly use a TCL
proc I wrote about 4 years ago:
if (!function_exists('proper_case')) {
/**
* Ths function will convert a string into a proper case format using
the customized TCL proc "PROPER_CASE" from the included TCL string
tools libraries
*
* @access public
* @param mixed $text
* @param mixed $tclLibPath Path to TCL Library files
* @param DBActionPerformer $dbAP You must generate a descendant of
MethodGeneratorForActionPerformer to retrieve customized command-line
formatting to call TCL shell
* @return mixed $text properly formatted in Proper Case Form
* @see DBActionPerformer
* @uses tcl_string_tools::PROPER_CASE
*/
function &proper_case($text, $tclLibPath, $dbAP) {
if (!is_object($dbAP)) $dbAP =& new DBActionPerformer(); // NO NEED TO
CONNECT NOR DISCONNECT
list('tclKommand', 'tclRedirect') =
@array_values($dbAP->getKommandOSArray('tcl'));
$tclSourceString = @tcl_lib_include($tclLibPath);
if (!preg_match('/;[\n\r\s\t]*$/i', $tclSourceString))
$tclSourceString .= ';'; // ADD ";" TO ADD ONE MORE TCL COMMAND TO THE
SINGLE LINE
$msg = exec("$tclKommand \"$tclSourceString puts [PROPER_CASE
{$text}]\" $tclRedirect");
if (preg_match('/^[eE](rror:)/i', $msg)) {
trigger_error("Error involving TCL proc \"PROPER_CASE\" on \"$text\":
" . nl2br($msg), E_USER_WARNING); // GENERATE WARNING ONLY
return $text;
} else {
return $msg;
}
}
}
-----------------------------
Problem is very simple: <b>tclsh</b>. I have no idea how to put all of
the TCL commands onto the same line as "tclsh" command. ELSE I have no
idea how to work with the generated <b>tclsh</b> environment from
Apache/PHP.
In short, I'm stuck. I have to get this up and running and rather than
rewriting an entire series of TCL procs into PHP, I need a faster and
more practical solution to this one!
thanx
Phil
Navigation:
[Reply to this message]
|