PHP calling TCL proc causes thousands of server errors - HELP

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • comp.lang.php

    PHP calling TCL proc causes thousands of server errors - HELP

    if (!function_exis ts('proper_case ')) {
    /**
    * Ths function will convert a string into a proper case format using
    the customized TCL proc "PROPER_CAS E" from the included TCL string
    tools libraries
    *
    * @access public
    * @param mixed $text
    * @param mixed $tclLibPath Path to TCL Library files
    * @param DBActionPerform er $dbAP You must generate a descendant of
    MethodGenerator ForActionPerfor mer to retrieve customized command-line
    formatting to call TCL shell
    * @return mixed $text properly formatted in Proper Case Form
    * @see DBActionPerform er
    * @uses tcl_string_tool s::PROPER_CASE
    */
    function &proper_case($t ext, $tclLibPath, $dbAP) {
    if (!is_object($db AP)) $dbAP =& new DBActionPerform er(); // NO NEED TO
    CONNECT NOR DISCONNECT
    list($tclKomman d, $tclRedirect) =
    @array_values($ dbAP->getKommandOSAr ray('tcl'));
    $tclSourceStrin g = tcl_lib_include ($tclLibPath);
    if ($tclSourceStri ng && !preg_match('/;[\n\r\s\t]*$/i',
    $tclSourceStrin g)) $tclSourceStrin g .= ';'; // ADD ";" TO ADD ONE MORE
    TCL COMMAND TO THE SINGLE LINE
    $tclSourceStrin g = str_replace(';' , ";\n", $tclSourceStrin g);
    $msg = exec("$tclKomma nd << ':eof'\n$tclSou rceString puts [PROPER_CASE
    \{$text}]\n:eof $tclRedirect");
    if (preg_match('/^[eE](rror:)/i', $msg) ||
    strcmp(strtolow er(trim($msg)), strtolower(trim ($text))) != 0) {
    trigger_error(" Error involving TCL proc \"PROPER_CAS E\" on \"$text\":
    " . nl2br($msg), E_USER_WARNING) ; // GENERATE WARNING ONLY
    return $text;
    } else {
    return $msg;
    }
    }
    }

    This is a PHP function that utilizes a prior-written TCL proc I wrote
    that converts a name to proper case.. however, upon running it, you get
    thousands of these lines:

    ":eof" No such file or directory

    What in the world am I doing wrong?

    Thanx
    Phil

  • NC

    #2
    Re: PHP calling TCL proc causes thousands of server errors - HELP

    comp.lang.php wrote:[color=blue]
    >
    > This is a PHP function that utilizes a prior-written TCL proc I wrote
    > that converts a name to proper case..[/color]

    And you are not using ucwords() because...
    [color=blue]
    > What in the world am I doing wrong?[/color]

    Not using ucwords(), of course... :) Check it out:

    Uppercase the first character of each word in a string


    Cheers,
    NC

    Comment

    • comp.lang.php

      #3
      Re: PHP calling TCL proc causes thousands of server errors - HELP


      NC wrote:[color=blue]
      > comp.lang.php wrote:[color=green]
      > >
      > > This is a PHP function that utilizes a prior-written TCL proc I wrote
      > > that converts a name to proper case..[/color]
      >
      > And you are not using ucwords() because...
      >[color=green]
      > > What in the world am I doing wrong?[/color]
      >
      > Not using ucwords(), of course... :) Check it out:
      >
      > http://www.php.net/ucwords[/color]


      print_r(ucwords ('rue de la paix')); // = "Rue De La Paix" which is
      wrong, should be "Rue de la Paix"

      My TCL proc does this:

      puts [PROPER_CASE {rue de la paix}]; # PRINTS "Rue de la Paix"

      That's why I want to use my TCL proc and not even ucwords()

      Phil[color=blue]
      >
      > Cheers,
      > NC[/color]

      Comment

      Working...