You are here: Re: TCL/PHP/XML problem: I need to convert an XML file into a TCL list « All PHP « IT news, forums, messages
Re: TCL/PHP/XML problem: I need to convert an XML file into a TCL list

Posted by comp.lang.tcl on 11/25/06 18:11

Bryan Oakley wrote:
> comp.lang.tcl wrote:
> > set cannotRunPHP [catch {exec "echo '$php' | php" >@stdout
> > 2>&stderr} errorMsg]
>
> You need to re-read the man page on exec. The first argument to exec is
> a filename that will be exec'd; it is not a command line. If you want to
> run a command line you should exec a command line processor (/bin/sh,
> command.com, whatever).
>
> Since "php" is what you want to exec, and $php is what you want to send
> to its stdin, use "<<" (documented on the exec man page):
>
> if {[catch {exec php << $php} result]} {
> puts "error exec'ing php: $resulut"
> } else {
> puts "php result: $result"
> }


Now I get this error:

couldn't execute "php": no such file or directory

When I try this:

[TCL]
set cannotRunPHP [catch {exec exec php << $php >@stdout 2>&stderr}
errorMsg]
if {$cannotRunPHP} {
puts $errorMsg
return {}
} else {
if {![IS_LIST $contentsList]} { set contentsList [split
$contentsList] }
if {[llength $contentsList] == 0} { lappend contentsList {?} }
return [lrange $contentsList [expr {[lsearch -exact $contentsList
"?"] + 1}] end]
}

[/TCL]

Wow this should only take an hour, it's taken 3 days so far!

Phil
>
> You can read a wiki page on the subject here: http://mini.net/tcl/exec

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация