f



'echo "": No such file or directory" error using "exec" to pipe in PHP script

[TCL]

set php {<? print_r("Hello World"); ?>}
puts $php; # PRINTS OUT <? print_r("Hello World"); ?>
puts [exec "echo '$php' | php -q"]

[/TCL]

When I try this within TCL I get the following error:

[quote]
 echo "": No such file or directory
[/quote]

I am unable to be able to use the CLI PHP "php -r" option due to my PHP
installations on various servers being CGI and not CLI SAPI, else, I
would just do that, so I'm trying an alternative that is choking TCL.

I am using a very simple example within the TCL $php variable; the
actual contents of $php will be a bit more complex and dynamic,
however, it's still choking on the simple PHP content.

So how on earth do I get TCL and PHP to play nice?

Thanx
Phil

0
12/1/2006 4:53:59 PM
comp.lang.php 32646 articles. 0 followers. Post Follow

27 Replies
1662 Views

Similar Articles

[PageSpeed] 32

comp.lang.tcl wrote:
> [TCL]
> 
> set php {<? print_r("Hello World"); ?>}
> puts $php; # PRINTS OUT <? print_r("Hello World"); ?>
> puts [exec "echo '$php' | php -q"]
> 
> [/TCL]
> 
> When I try this within TCL I get the following error:
> 
> [quote]
>  echo "": No such file or directory
> [/quote]
> 

"echo" is not a command you can exec. It is a "built-in" -- a command 
known only to the shell that implements it. Think of it more as a 
subcommand of sh/bash/ash/tcsh/etc. Much like those commands don't know 
about "proc".

You need to understand that 'exec' simply runs a file given to it as the 
first argument. It does a couple of shortcuts such as looking for the 
file within the directories in the PATH environment variable, and will 
look for both "foo.exe" and "foo" on windows. But the fact remains, it 
is a way to spawn the execution of a file rather than a command line.

If you're wanting to exec php and give it the contents of a variable on 
stdin, try this:

puts [exec php << $php]

You need to make sure that "php" is a valid command file on your 
machine, and that its location is in your PATH environment variable.
0
oakley (2075)
12/1/2006 5:02:38 PM
comp.lang.tcl wrote :
> [TCL]
> 
> set php {<? print_r("Hello World"); ?>}
> puts $php; # PRINTS OUT <? print_r("Hello World"); ?>
> puts [exec "echo '$php' | php -q"]
> 
> [/TCL]

Get rid of the "echo" stuff, which introduces all kind of escape issues, 
and directly pass any value using the "<<" syntax supported by exec 
command in Tcl:

puts [exec php -q << $php]

Also, not that exec needs a list of arguments, not a single one 
delimited by double quotes as in your sample code. Strict copy an dpaste 
of your code should actually have raised an error similar to:
   couldn't execute "echo '<? print_r("Hello World"); ?>' | php -q": no 
such file or directory

Last, since your problem has nothing specific to PHP, you should 
probably tries to not cross-post in several groups.

Regards,

Eric
0
hassold1 (29)
12/1/2006 5:07:18 PM
comp.lang.tcl wrote:
> [TCL]
> 
> set php {<? print_r("Hello World"); ?>}
> puts $php; # PRINTS OUT <? print_r("Hello World"); ?>
> puts [exec "echo '$php' | php -q"]

	puts [exec  echo $php | php -q ]

you might have even more fun with

	exec php -p <<$php
> 
> [/TCL]
> 
> When I try this within TCL I get the following error:
> 
> [quote]
>  echo "": No such file or directory
> [/quote]
> 
> I am unable to be able to use the CLI PHP "php -r" option due to my PHP
> installations on various servers being CGI and not CLI SAPI, else, I
> would just do that, so I'm trying an alternative that is choking TCL.
> 
> I am using a very simple example within the TCL $php variable; the
> actual contents of $php will be a bit more complex and dynamic,
> however, it's still choking on the simple PHP content.
> 
> So how on earth do I get TCL and PHP to play nice?
> 
> Thanx
> Phil
uwe

> 
0
12/1/2006 5:11:08 PM
Bryan Oakley wrote:
> comp.lang.tcl wrote:
> > [TCL]
> >
> > set php {<? print_r("Hello World"); ?>}
> > puts $php; # PRINTS OUT <? print_r("Hello World"); ?>
> > puts [exec "echo '$php' | php -q"]
> >
> > [/TCL]
> >
> > When I try this within TCL I get the following error:
> >
> > [quote]
> >  echo "": No such file or directory
> > [/quote]
> >
>
> "echo" is not a command you can exec. It is a "built-in" -- a command
> known only to the shell that implements it. Think of it more as a
> subcommand of sh/bash/ash/tcsh/etc. Much like those commands don't know
> about "proc".
>
> You need to understand that 'exec' simply runs a file given to it as the
> first argument. It does a couple of shortcuts such as looking for the
> file within the directories in the PATH environment variable, and will
> look for both "foo.exe" and "foo" on windows. But the fact remains, it
> is a way to spawn the execution of a file rather than a command line.
>
> If you're wanting to exec php and give it the contents of a variable on
> stdin, try this:
>
> puts [exec php << $php]
>
> You need to make sure that "php" is a valid command file on your
> machine, and that its location is in your PATH environment variable.

Ok this is what I did:

[TCL]
 set contentsList [exec $valPHPPath << $php]; # $valPHPPath IS THE PATH
TO "php"
[/TCL]

And here is the error message I now get:

Status: 404 X-Powered-By: PHP/4.4.4 Content-type: text/html No input
file specified. child process exited abnormally while executing "exec
$valPHPPath << $php" (procedure "XML_GET_ALL_ELEMENT_ATTRS" line 36)

I even tried a variant:

[TCL]
set contentsList [exec $valPHPPath << '[regsub -all {'} $php {\\'} php;
set php]']
[/TCL]

And got this error message

Status: 404 X-Powered-By: PHP/4.4.4 Content-type: text/html No input
file specified. child process exited abnormally while executing "exec
$valPHPPath << '[regsub -all {'} $php {\\'} php; set php]'" (procedure
"XML_GET_ALL_ELEMENT_ATTRS" line 36)

And even this:

[TCL]
set contentsList [exec $valPHPPath << '<? print_r("Hello World"); ?>']
[/TCL]

To no avail, getting the following error message:

Status: 404 X-Powered-By: PHP/4.4.4 Content-type: text/html No input
file specified. child process exited abnormally while executing "exec
$valPHPPath << '

I am not sure where to go going forward with this at this point, sorry,
you may have to make it a bit more simple for me to understand how to
make this work properly

Phil

0
12/1/2006 5:23:38 PM
comp.lang.tcl wrote:
> Bryan Oakley wrote:
> 
>>comp.lang.tcl wrote:
>>
>>>[TCL]
>>>
>>>set php {<? print_r("Hello World"); ?>}
>>>...
>>>[/TCL]

>>If you're wanting to exec php and give it the contents of a variable on
>>stdin, try this:
>>
>>puts [exec php << $php]
>>
>>You need to make sure that "php" is a valid command file on your
>>machine, and that its location is in your PATH environment variable.
> 
> 
> Ok this is what I did:
> 
> [TCL]
>  set contentsList [exec $valPHPPath << $php]; # $valPHPPath IS THE PATH
> TO "php"
> [/TCL]
> 

In the above, is $php the string you showed earlier or does it contain 
something else?

> And here is the error message I now get:
> 
> Status: 404 X-Powered-By: PHP/4.4.4 Content-type: text/html No input
> file specified. child process exited abnormally while executing "exec
> $valPHPPath << $php" (procedure "XML_GET_ALL_ELEMENT_ATTRS" line 36)
> 

I'm not sure what the problem is, if all you say is true. When I type in 
the equivalent, I get back "Hello World":

     $ tclsh
     % set php {<? print_r("Hello World"); ?>}
     <? print_r("Hello World"); ?>
     % exec php << $php
     Hello World

So... the only conclusion I can draw is that your php command doesn't 
work the same way as mine. That, or you're putting something different 
in $php. Unfortunately I am not able to exactly duplicate your 
environment since you're executing tcl from with a web page served by 
some tcl-enabled web server, and I don't have that web server (what web 
server is that, BTW?)

The only thing I can suggest at this point is that the problem is no 
longer a Tcl problem but rather a php or web server problem.

Is it possible that your php script prints to stderr instead of / in 
addition to stdout? If exec detects output on stderr it will throw an 
error unless stderr is redirected (this is all documented on the exec 
man page)


> I even tried a variant:
> 
> [TCL]
> set contentsList [exec $valPHPPath << '[regsub -all {'} $php {\\'} php;
> set php]']
> [/TCL]
> 

Are you aware that single quotes are not a valid quoting mechanism for 
Tcl? Any time you try to use single quotes to quote something in Tcl 
you're bound to be disappointed.
0
oakley (2075)
12/1/2006 5:48:17 PM
Bryan Oakley wrote:
> comp.lang.tcl wrote:
> > Bryan Oakley wrote:
> >
> >>comp.lang.tcl wrote:
> >>
> >>>[TCL]
> >>>
> >>>set php {<? print_r("Hello World"); ?>}
> >>>...
> >>>[/TCL]
>
> >>If you're wanting to exec php and give it the contents of a variable on
> >>stdin, try this:
> >>
> >>puts [exec php << $php]
> >>
> >>You need to make sure that "php" is a valid command file on your
> >>machine, and that its location is in your PATH environment variable.
> >
> >
> > Ok this is what I did:
> >
> > [TCL]
> >  set contentsList [exec $valPHPPath << $php]; # $valPHPPath IS THE PATH
> > TO "php"
> > [/TCL]
> >
>
> In the above, is $php the string you showed earlier or does it contain
> something else?
>
> > And here is the error message I now get:
> >
> > Status: 404 X-Powered-By: PHP/4.4.4 Content-type: text/html No input
> > file specified. child process exited abnormally while executing "exec
> > $valPHPPath << $php" (procedure "XML_GET_ALL_ELEMENT_ATTRS" line 36)
> >
>
> I'm not sure what the problem is, if all you say is true. When I type in
> the equivalent, I get back "Hello World":
>
>      $ tclsh
>      % set php {<? print_r("Hello World"); ?>}
>      <? print_r("Hello World"); ?>
>      % exec php << $php
>      Hello World

When I went into command-line and tried it (again I'm using HP-UX
apparently):

[quote]
set php
<?
            error_reporting(E_ALL & ~E_NOTICE);
            $xml = preg_replace('/(>)[\\n\\r\\\s\\t]+(<)/', '$1$2',
$argv[1]); /* STRIP OUT WHITESPACE xml_parser_set_option() MIGHT MANGLE
XML */
            $parser = @xml_parser_create();
            @xml_parse_into_struct($parser, $xml, $xmlArray, $tags);
            @xml_parser_free_parser($parser);
            for ($i = 1; $i < @sizeof($xmlArray) - 1; $i++) \{
             foreach ($xmlArray[$i]['attributes'] as $attr => $val)
              $tclList .= $attr . ' \{' . str_replace('\{', '&#123;',
str_replace('\}', '&#125;', $val)) . '\} '; /* ESCAPED CURLY BRACES FOR
TCL LIST */
            \}
            echo trim($tclList);
          ?>
% exec /usr/local/bin/php -q << $php
<br />
<b>Warning</b>:  Unexpected character in input:  '\' (ASCII=92) state=1
in <b>-</b> on line <b>7</b><br />
<br />
<b>Warning</b>:  Unexpected character in input:  '\' (ASCII=92) state=1
in <b>-</b> on line <b>10</b><br />
child process exited abnormally

[/quote]

I realize I am getting PHP errors, so at this point I don't know if
this is a TCL problem with the way I'm creating $php, or a PHP problem
with the way TCL handles PHP.  So I believe cross-posting is essential
for this to be solved at this point.

>
> So... the only conclusion I can draw is that your php command doesn't
> work the same way as mine. That, or you're putting something different
> in $php. Unfortunately I am not able to exactly duplicate your
> environment since you're executing tcl from with a web page served by
> some tcl-enabled web server, and I don't have that web server (what web
> server is that, BTW?)

Apache 2.0.53

>
> The only thing I can suggest at this point is that the problem is no
> longer a Tcl problem but rather a php or web server problem.
>
> Is it possible that your php script prints to stderr instead of / in
> addition to stdout? If exec detects output on stderr it will throw an
> error unless stderr is redirected (this is all documented on the exec
> man page)
>
>
> > I even tried a variant:
> >
> > [TCL]
> > set contentsList [exec $valPHPPath << '[regsub -all {'} $php {\\'} php;
> > set php]']
> > [/TCL]
> >
>
> Are you aware that single quotes are not a valid quoting mechanism for
> Tcl? Any time you try to use single quotes to quote something in Tcl
> you're bound to be disappointed.

Yes, but I was assuming that I needed to encase $php in single quotes
not for TCL exec but for the shell statement that is served by TCL
exec, if that makes sense.

Phil

0
12/1/2006 6:00:48 PM
comp.lang.tcl wrote:
> When I went into command-line and tried it (again I'm using HP-UX
> apparently):
> 
> [quote]
> set php
> <?
>             error_reporting(E_ALL & ~E_NOTICE);
 > ...

You are obviously paraphrasing; the above is invalid tcl and can't 
possibly be what you are actually doing or  you would get different 
error messages. When you are reporting results, please try to be exact. 
Show us *precisely* what you type.


>             $xml = preg_replace('/(>)[\\n\\r\\\s\\t]+(<)/', '$1$2',
> $argv[1]); /* STRIP OUT WHITESPACE xml_parser_set_option() MIGHT MANGLE
> XML */
>             $parser = @xml_parser_create();
>             @xml_parse_into_struct($parser, $xml, $xmlArray, $tags);
>             @xml_parser_free_parser($parser);
>             for ($i = 1; $i < @sizeof($xmlArray) - 1; $i++) \{
>              foreach ($xmlArray[$i]['attributes'] as $attr => $val)
>               $tclList .= $attr . ' \{' . str_replace('\{', '&#123;',
> str_replace('\}', '&#125;', $val)) . '\} '; /* ESCAPED CURLY BRACES FOR
> TCL LIST */
>             \}
>             echo trim($tclList);
>           ?>
> % exec /usr/local/bin/php -q << $php
> <br />
> <b>Warning</b>:  Unexpected character in input:  '\' (ASCII=92) state=1
> in <b>-</b> on line <b>7</b><br />
> <br />
> <b>Warning</b>:  Unexpected character in input:  '\' (ASCII=92) state=1
> in <b>-</b> on line <b>10</b><br />
> child process exited abnormally
> 
> [/quote]
> 
> I realize I am getting PHP errors, so at this point I don't know if
> this is a TCL problem with the way I'm creating $php, or a PHP problem
> with the way TCL handles PHP. 

What happens if you cut and paste that exact data into a file and 
execute it via php? And by "exact" I mean *exact*, minus the leading and 
trailing {} (assuming you're using {} when assigning the php script to 
the php variable).

>>
>>Are you aware that single quotes are not a valid quoting mechanism for
>>Tcl? Any time you try to use single quotes to quote something in Tcl
>>you're bound to be disappointed.
> 
> 
> Yes, but I was assuming that I needed to encase $php in single quotes
> not for TCL exec but for the shell statement that is served by TCL
> exec, if that makes sense.

Tcl's exec doesn't have anything to do with a "shell statement". In the 
way you are using it you aren't executing a shell, not even magically 
under the covers. You're executing php directly. It is important you are 
aware of that fact.


0
oakley (2075)
12/1/2006 6:26:11 PM
In article <1164996048.727448.61880@f1g2000cwa.googlegroups.com>,
comp.lang.tcl <phillip.s.powell@gmail.com> wrote:
			.
		[lots of other 
		matters Bryan
		handles more-
		than-expertly]
			.
			.
>> in $php. Unfortunately I am not able to exactly duplicate your
>> environment since you're executing tcl from with a web page served by
>> some tcl-enabled web server, and I don't have that web server (what web
>> server is that, BTW?)
>
>Apache 2.0.53
			.
			.
			.
Hmmm!  You have an unadorned Apache 2.0.53, built for PHP
interpretation and CGI, and your Tcl is simply CGI--is that
right?  What's the Tcl executable installed under HP-UX?  Is
it the one from ActiveState?

I'm narrowing follow-ups.
0
claird (2363)
12/1/2006 7:24:09 PM
Cameron Laird wrote:
> In article <1164996048.727448.61880@f1g2000cwa.googlegroups.com>,
> comp.lang.tcl <phillip.s.powell@gmail.com> wrote:
> 			.
> 		[lots of other 
> 		matters Bryan
> 		handles more-
> 		than-expertly]
> 			.
> 			.
> 
>>>in $php. Unfortunately I am not able to exactly duplicate your
>>>environment since you're executing tcl from with a web page served by
>>>some tcl-enabled web server, and I don't have that web server (what web
>>>server is that, BTW?)
>>
>>Apache 2.0.53
> 
> 			.
> 			.
> 			.
> Hmmm!  You have an unadorned Apache 2.0.53, built for PHP
> interpretation and CGI, and your Tcl is simply CGI--is that
> right?  What's the Tcl executable installed under HP-UX?  Is
> it the one from ActiveState?

I didn't think he was doing CGI. His examples always look like this:

     [TCL]
     some code
     [/TCL]

.... or is that just a typographic convention on his part?
0
oakley (2075)
12/1/2006 8:29:22 PM
Bryan Oakley wrote:
> Cameron Laird wrote:
> > In article <1164996048.727448.61880@f1g2000cwa.googlegroups.com>,
> > comp.lang.tcl <phillip.s.powell@gmail.com> wrote:
> > 			.
> > 		[lots of other
> > 		matters Bryan
> > 		handles more-
> > 		than-expertly]
> > 			.
> > 			.
> >
> >>>in $php. Unfortunately I am not able to exactly duplicate your
> >>>environment since you're executing tcl from with a web page served by
> >>>some tcl-enabled web server, and I don't have that web server (what web
> >>>server is that, BTW?)
> >>
> >>Apache 2.0.53
> >
> > 			.
> > 			.
> > 			.
> > Hmmm!  You have an unadorned Apache 2.0.53, built for PHP
> > interpretation and CGI, and your Tcl is simply CGI--is that
> > right?  What's the Tcl executable installed under HP-UX?  Is
> > it the one from ActiveState?
>
> I didn't think he was doing CGI. His examples always look like this:
>
>      [TCL]
>      some code
>      [/TCL]
>
> ... or is that just a typographic convention on his part?

The [TCL][/TCL] stuff is my own convention; just adding that in so that
the reader can more easily spot the code

And am using CGI

Phil

0
12/1/2006 8:32:58 PM
Bryan Oakley wrote:
> comp.lang.tcl wrote:
> > When I went into command-line and tried it (again I'm using HP-UX
> > apparently):
> >
> > [quote]
> > set php
> > <?
> >             error_reporting(E_ALL & ~E_NOTICE);
>  > ...
>
> You are obviously paraphrasing; the above is invalid tcl and can't
> possibly be what you are actually doing or  you would get different
> error messages. When you are reporting results, please try to be exact.
> Show us *precisely* what you type.

set php {<?
            error_reporting(E_ALL & ~E_NOTICE);
            $xml = preg_replace('/(>)[\\n\\r\\\s\\t]+(<)/', '$1$2',
$argv[1]); /* STRIP OUT WHITESPACE xml_parser_set_option() MIGHT MANGLE
XML */
            $parser = @xml_parser_create();
            @xml_parse_into_struct($parser, $xml, $xmlArray, $tags);
            @xml_parser_free_parser($parser);
            for ($i = 1; $i < @sizeof($xmlArray) - 1; $i++) \{
             foreach ($xmlArray[$i]['attributes'] as $attr => $val)
              $tclList .= $attr . ' \{' . str_replace('\{', '&#123;',
str_replace('\}', '&#125;', $val)) . '\} '; /* ESCAPED CURLY BRACES FOR
TCL LIST */
            \}
            echo trim($tclList);
          ?>}

 global valPHPPath
 if {![info exists valPHPPath]} {
  if {![array exists env]} { global env }
  source cgi_globals.tcl
  global valPHPPath
 }
 set contentsList [exec $valPHPPath << $php]


-----------
There you go, exactly what I typed
-----------

This is the error I get:

Status: 404 X-Powered-By: PHP/4.4.4 Content-type: text/html No input
file specified. child process exited abnormally while executing "exec
$valPHPPath -q << $php" (procedure "XML_GET_ALL_ELEMENT_ATTRS" line 37)



>
>
> >             $xml = preg_replace('/(>)[\\n\\r\\\s\\t]+(<)/', '$1$2',
> > $argv[1]); /* STRIP OUT WHITESPACE xml_parser_set_option() MIGHT MANGLE
> > XML */
> >             $parser = @xml_parser_create();
> >             @xml_parse_into_struct($parser, $xml, $xmlArray, $tags);
> >             @xml_parser_free_parser($parser);
> >             for ($i = 1; $i < @sizeof($xmlArray) - 1; $i++) \{
> >              foreach ($xmlArray[$i]['attributes'] as $attr => $val)
> >               $tclList .= $attr . ' \{' . str_replace('\{', '&#123;',
> > str_replace('\}', '&#125;', $val)) . '\} '; /* ESCAPED CURLY BRACES FOR
> > TCL LIST */
> >             \}
> >             echo trim($tclList);
> >           ?>
> > % exec /usr/local/bin/php -q << $php
> > <br />
> > <b>Warning</b>:  Unexpected character in input:  '\' (ASCII=92) state=1
> > in <b>-</b> on line <b>7</b><br />
> > <br />
> > <b>Warning</b>:  Unexpected character in input:  '\' (ASCII=92) state=1
> > in <b>-</b> on line <b>10</b><br />
> > child process exited abnormally
> >
> > [/quote]
> >
> > I realize I am getting PHP errors, so at this point I don't know if
> > this is a TCL problem with the way I'm creating $php, or a PHP problem
> > with the way TCL handles PHP.
>
> What happens if you cut and paste that exact data into a file and
> execute it via php? And by "exact" I mean *exact*, minus the leading and
> trailing {} (assuming you're using {} when assigning the php script to
> the php variable).

I get warnings on the lines where I have "\{" and "\}", but don't I
have to escape curly braces found within strings encased in curly
braces?

>
> >>
> >>Are you aware that single quotes are not a valid quoting mechanism for
> >>Tcl? Any time you try to use single quotes to quote something in Tcl
> >>you're bound to be disappointed.
> >
> >
> > Yes, but I was assuming that I needed to encase $php in single quotes
> > not for TCL exec but for the shell statement that is served by TCL
> > exec, if that makes sense.
>
> Tcl's exec doesn't have anything to do with a "shell statement". In the
> way you are using it you aren't executing a shell, not even magically
> under the covers. You're executing php directly. It is important you are
> aware of that fact.

I think I understand.. that's as far as I can go right now

0
12/1/2006 8:38:52 PM
Bryan Oakley wrote:
> comp.lang.tcl wrote:
> > When I went into command-line and tried it (again I'm using HP-UX
> > apparently):
> >
> > [quote]
> > set php
> > <?
> >             error_reporting(E_ALL & ~E_NOTICE);
>  > ...
>
> You are obviously paraphrasing; the above is invalid tcl and can't
> possibly be what you are actually doing or  you would get different
> error messages. When you are reporting results, please try to be exact.
> Show us *precisely* what you type.

Oh and I also tried this to, also to no avail:

% set php
<?
            error_reporting(E_ALL & ~E_NOTICE);
            $xml = preg_replace('/(>)[\n\r\\s\t]+(<)/', '$1$2',
$argv[1]); /* STRIP OUT WHITESPACE xml_parser_set_option() MIGHT MANGLE
XML */
            $parser = @xml_parser_create();
            @xml_parse_into_struct($parser, $xml, $xmlArray, $tags);
            @xml_parser_free_parser($parser);
            for ($i = 1; $i < @sizeof($xmlArray) - 1; $i++) {
             foreach ($xmlArray[$i]['attributes'] as $attr => $val)
              $tclList .= $attr . ' {' . str_replace('{', '&#123;',
str_replace('}', '&#125;', $val)) . '} '; /* ESCAPED CURLY BRACES FOR
TCL LIST */
            }
            echo trim($tclList);
          ?>
% exec php -q << $php
child process exited abnormally
% exec php << $php
X-Powered-By: PHP/4.4.4
Content-type: text/html

child process exited abnormally
% exec php -q << <? print_r("Hello World"); ?>
No input file specified.
child process exited abnormally
% exec php << <? print_r("hello world"); ?>
Status: 404
X-Powered-By: PHP/4.4.4
Content-type: text/html

No input file specified.
child process exited abnormally


>
>
> >             $xml = preg_replace('/(>)[\\n\\r\\\s\\t]+(<)/', '$1$2',
> > $argv[1]); /* STRIP OUT WHITESPACE xml_parser_set_option() MIGHT MANGLE
> > XML */
> >             $parser = @xml_parser_create();
> >             @xml_parse_into_struct($parser, $xml, $xmlArray, $tags);
> >             @xml_parser_free_parser($parser);
> >             for ($i = 1; $i < @sizeof($xmlArray) - 1; $i++) \{
> >              foreach ($xmlArray[$i]['attributes'] as $attr => $val)
> >               $tclList .= $attr . ' \{' . str_replace('\{', '&#123;',
> > str_replace('\}', '&#125;', $val)) . '\} '; /* ESCAPED CURLY BRACES FOR
> > TCL LIST */
> >             \}
> >             echo trim($tclList);
> >           ?>
> > % exec /usr/local/bin/php -q << $php
> > <br />
> > <b>Warning</b>:  Unexpected character in input:  '\' (ASCII=92) state=1
> > in <b>-</b> on line <b>7</b><br />
> > <br />
> > <b>Warning</b>:  Unexpected character in input:  '\' (ASCII=92) state=1
> > in <b>-</b> on line <b>10</b><br />
> > child process exited abnormally
> >
> > [/quote]
> >
> > I realize I am getting PHP errors, so at this point I don't know if
> > this is a TCL problem with the way I'm creating $php, or a PHP problem
> > with the way TCL handles PHP.
>
> What happens if you cut and paste that exact data into a file and
> execute it via php? And by "exact" I mean *exact*, minus the leading and
> trailing {} (assuming you're using {} when assigning the php script to
> the php variable).
>
> >>
> >>Are you aware that single quotes are not a valid quoting mechanism for
> >>Tcl? Any time you try to use single quotes to quote something in Tcl
> >>you're bound to be disappointed.
> >
> >
> > Yes, but I was assuming that I needed to encase $php in single quotes
> > not for TCL exec but for the shell statement that is served by TCL
> > exec, if that makes sense.
>
> Tcl's exec doesn't have anything to do with a "shell statement". In the
> way you are using it you aren't executing a shell, not even magically
> under the covers. You're executing php directly. It is important you are
> aware of that fact.

0
12/1/2006 8:44:02 PM
comp.lang.tcl wrote:

> This is the error I get:
> 
> Status: 404 X-Powered-By: PHP/4.4.4 Content-type: text/html No input
> file specified. child process exited abnormally while executing "exec
> $valPHPPath -q << $php" (procedure "XML_GET_ALL_ELEMENT_ATTRS" line 37)

this may be an error or just happen because the invokation of php outputs
something to stderr.
you may want to wrap the [exec ... ] into a catch statement like:

if {[catch {exec $valPHPPath -q << $php"} retval]} {
	# talk about what the error was
	puts stderr "exec with error: $retval"
} else {
	# do something sensible with a successfull return.
}


and see whats happening.
catch is very usefull, but you may want to take some rye on the side ;-)

uwe
0
12/1/2006 8:48:47 PM
Uwe Klein wrote:
> comp.lang.tcl wrote:
>
> > This is the error I get:
> >
> > Status: 404 X-Powered-By: PHP/4.4.4 Content-type: text/html No input
> > file specified. child process exited abnormally while executing "exec
> > $valPHPPath -q << $php" (procedure "XML_GET_ALL_ELEMENT_ATTRS" line 37)
>
> this may be an error or just happen because the invokation of php outputs
> something to stderr.
> you may want to wrap the [exec ... ] into a catch statement like:
>
> if {[catch {exec $valPHPPath -q << $php"} retval]} {
> 	# talk about what the error was
> 	puts stderr "exec with error: $retval"
> } else {
> 	# do something sensible with a successfull return.
> }
>
>
> and see whats happening.
> catch is very usefull, but you may want to take some rye on the side ;-)
>
> uwe

I wish I could see what's happening, but I have no way of ever knowing
what's going on

 if {[catch [exec $valPHPPath -q << $php] errMsg]} {
  puts "!!error in exec: $errMsg!!"
 } else {
  puts "This is your list!"
  return "This is your list: $errMsg"
 }

produces:

Status: 404 X-Powered-By: PHP/4.4.4 Content-type: text/html No input
file specified. child process exited abnormally while executing "exec
$valPHPPath -q << $php" (procedure "XML_GET_ALL_ELEMENT_ATTRS" line 37)

It is not even performing "puts" in either case, so I am not apparently
even catching the error, or I have no idea what's going on!

Phil

0
12/1/2006 9:02:12 PM
comp.lang.tcl wrote:
> Bryan Oakley wrote:
>>Show us *precisely* what you type.
> 
> 
> set php {<?
>             error_reporting(E_ALL & ~E_NOTICE);
>             $xml = preg_replace('/(>)[\\n\\r\\\s\\t]+(<)/', '$1$2',
> $argv[1]); /* STRIP OUT WHITESPACE xml_parser_set_option() MIGHT MANGLE
> XML */
>             $parser = @xml_parser_create();
>             @xml_parse_into_struct($parser, $xml, $xmlArray, $tags);
>             @xml_parser_free_parser($parser);
>             for ($i = 1; $i < @sizeof($xmlArray) - 1; $i++) \{
>              foreach ($xmlArray[$i]['attributes'] as $attr => $val)
>               $tclList .= $attr . ' \{' . str_replace('\{', '&#123;',
> str_replace('\}', '&#125;', $val)) . '\} '; /* ESCAPED CURLY BRACES FOR
> TCL LIST */
>             \}
>             echo trim($tclList);
>           ?>}
> 
>  global valPHPPath
>  if {![info exists valPHPPath]} {
>   if {![array exists env]} { global env }
>   source cgi_globals.tcl
>   global valPHPPath
>  }
>  set contentsList [exec $valPHPPath << $php]
> 
> 
> -----------
> There you go, exactly what I typed
> -----------
> 
> This is the error I get:
> 
> Status: 404 X-Powered-By: PHP/4.4.4 Content-type: text/html No input
> file specified. child process exited abnormally while executing "exec
> $valPHPPath -q << $php" (procedure "XML_GET_ALL_ELEMENT_ATTRS" line 37)

Strip out all the Tcl. All of it. Every last byte. Put the php into a 
file. Then, from a command line type "php /your/file.php"

You will get the exact same error. The bug is in php, of which I know 
nothing about. What I do know is that the problem isn't Tcl.
0
oakley (2075)
12/1/2006 9:38:49 PM
Bryan Oakley wrote:
> comp.lang.tcl wrote:
> > Bryan Oakley wrote:
> >>Show us *precisely* what you type.
> >
> >
> > set php {<?
> >             error_reporting(E_ALL & ~E_NOTICE);
> >             $xml = preg_replace('/(>)[\\n\\r\\\s\\t]+(<)/', '$1$2',
> > $argv[1]); /* STRIP OUT WHITESPACE xml_parser_set_option() MIGHT MANGLE
> > XML */
> >             $parser = @xml_parser_create();
> >             @xml_parse_into_struct($parser, $xml, $xmlArray, $tags);
> >             @xml_parser_free_parser($parser);
> >             for ($i = 1; $i < @sizeof($xmlArray) - 1; $i++) \{
> >              foreach ($xmlArray[$i]['attributes'] as $attr => $val)
> >               $tclList .= $attr . ' \{' . str_replace('\{', '&#123;',
> > str_replace('\}', '&#125;', $val)) . '\} '; /* ESCAPED CURLY BRACES FOR
> > TCL LIST */
> >             \}
> >             echo trim($tclList);
> >           ?>}
> >
> >  global valPHPPath
> >  if {![info exists valPHPPath]} {
> >   if {![array exists env]} { global env }
> >   source cgi_globals.tcl
> >   global valPHPPath
> >  }
> >  set contentsList [exec $valPHPPath << $php]
> >
> >
> > -----------
> > There you go, exactly what I typed
> > -----------
> >
> > This is the error I get:
> >
> > Status: 404 X-Powered-By: PHP/4.4.4 Content-type: text/html No input
> > file specified. child process exited abnormally while executing "exec
> > $valPHPPath -q << $php" (procedure "XML_GET_ALL_ELEMENT_ATTRS" line 37)
>
> Strip out all the Tcl. All of it. Every last byte. Put the php into a
> file. Then, from a command line type "php /your/file.php"
>
> You will get the exact same error. The bug is in php, of which I know
> nothing about. What I do know is that the problem isn't Tcl.

No, sorry I get no error whatsoever, in fact, I get nothing.  It's not
a PHP syntax or evaluation error, it's just that apparently it seems
$argv does not exist because it was never set with any values, so
putting it into a PHP file is ultimately meaningless because I can't
get the XML contents into the PHP file even if it were separate.

So again, at this point, you're right, this is not a TCL issue and
needs to be moved to a PHP issue.

Phil

0
12/1/2006 10:33:59 PM
comp.lang.tcl wrote:
> Bryan Oakley wrote:
> 
>>comp.lang.tcl wrote:
>>
>>>Bryan Oakley wrote:
>>>
>>>>Show us *precisely* what you type.
>>>
>>>
>>>set php {<?
>>>            error_reporting(E_ALL & ~E_NOTICE);
>>>            $xml = preg_replace('/(>)[\\n\\r\\\s\\t]+(<)/', '$1$2',
>>>$argv[1]); /* STRIP OUT WHITESPACE xml_parser_set_option() MIGHT MANGLE
>>>XML */
>>>            $parser = @xml_parser_create();
>>>            @xml_parse_into_struct($parser, $xml, $xmlArray, $tags);
>>>            @xml_parser_free_parser($parser);
>>>            for ($i = 1; $i < @sizeof($xmlArray) - 1; $i++) \{
>>>             foreach ($xmlArray[$i]['attributes'] as $attr => $val)
>>>              $tclList .= $attr . ' \{' . str_replace('\{', '&#123;',
>>>str_replace('\}', '&#125;', $val)) . '\} '; /* ESCAPED CURLY BRACES FOR
>>>TCL LIST */
>>>            \}
>>>            echo trim($tclList);
>>>          ?>}
>>>
>>> global valPHPPath
>>> if {![info exists valPHPPath]} {
>>>  if {![array exists env]} { global env }
>>>  source cgi_globals.tcl
>>>  global valPHPPath
>>> }
>>> set contentsList [exec $valPHPPath << $php]
>>>
>>>
>>>-----------
>>>There you go, exactly what I typed
>>>-----------
>>>
>>>This is the error I get:
>>>
>>>Status: 404 X-Powered-By: PHP/4.4.4 Content-type: text/html No input
>>>file specified. child process exited abnormally while executing "exec
>>>$valPHPPath -q << $php" (procedure "XML_GET_ALL_ELEMENT_ATTRS" line 37)
>>
>>Strip out all the Tcl. All of it. Every last byte. Put the php into a
>>file. Then, from a command line type "php /your/file.php"
>>
>>You will get the exact same error. The bug is in php, of which I know
>>nothing about. What I do know is that the problem isn't Tcl.
> 
> 
> No, sorry I get no error whatsoever, in fact, I get nothing. 

You are correct. My bad. I was getting this, which is the same error 
you were earlier reporting:

   Warning: Unexpected character in input:  '\' (ASCII=92) state=1 in
   /private/tmp/error.php on line 9

   Warning: Unexpected character in input:  '\' (ASCII=92) state=1 in
   /private/tmp/error.php on line 14

.... but that was because the php had two lines with extra backslashes, 
that were in to escape the curly braces due to the fact it was defined 
in Tcl. My mistake. When I took those out in the file-based version of 
the php code, it all worked fine (and by that I mean, I get no php errors).

> It's not
> a PHP syntax or evaluation error, it's just that apparently it seems
> $argv does not exist because it was never set with any values, 

That's likely also true. Unless you give it a filename as an argument 
you won't have a argv[1].

> so
> putting it into a PHP file is ultimately meaningless because I can't
> get the XML contents into the PHP file even if it were separate.

The exercise of putting it in a file is just to illustrate that the php 
has errors in it, it has nothing to do with Tcl. If you can create a 
working block of php  you can call from the command line, you can 
certainly execute it from tcl using the "exec php << $php" trick.

The first trick, then, is to figure out the PHP problems. Then take the 
working PHP and execute it via Tcl. No sense fighting two battles at once.
0
oakley (2075)
12/1/2006 10:58:58 PM
Bryan Oakley wrote:
> comp.lang.tcl wrote:
> > Bryan Oakley wrote:
> >
> >>comp.lang.tcl wrote:
> >>
> >>>Bryan Oakley wrote:
> >>>
> >>>>Show us *precisely* what you type.
> >>>
> >>>
> >>>set php {<?
> >>>            error_reporting(E_ALL & ~E_NOTICE);
> >>>            $xml = preg_replace('/(>)[\\n\\r\\\s\\t]+(<)/', '$1$2',
> >>>$argv[1]); /* STRIP OUT WHITESPACE xml_parser_set_option() MIGHT MANGLE
> >>>XML */
> >>>            $parser = @xml_parser_create();
> >>>            @xml_parse_into_struct($parser, $xml, $xmlArray, $tags);
> >>>            @xml_parser_free_parser($parser);
> >>>            for ($i = 1; $i < @sizeof($xmlArray) - 1; $i++) \{
> >>>             foreach ($xmlArray[$i]['attributes'] as $attr => $val)
> >>>              $tclList .= $attr . ' \{' . str_replace('\{', '&#123;',
> >>>str_replace('\}', '&#125;', $val)) . '\} '; /* ESCAPED CURLY BRACES FOR
> >>>TCL LIST */
> >>>            \}
> >>>            echo trim($tclList);
> >>>          ?>}
> >>>
> >>> global valPHPPath
> >>> if {![info exists valPHPPath]} {
> >>>  if {![array exists env]} { global env }
> >>>  source cgi_globals.tcl
> >>>  global valPHPPath
> >>> }
> >>> set contentsList [exec $valPHPPath << $php]
> >>>
> >>>
> >>>-----------
> >>>There you go, exactly what I typed
> >>>-----------
> >>>
> >>>This is the error I get:
> >>>
> >>>Status: 404 X-Powered-By: PHP/4.4.4 Content-type: text/html No input
> >>>file specified. child process exited abnormally while executing "exec
> >>>$valPHPPath -q << $php" (procedure "XML_GET_ALL_ELEMENT_ATTRS" line 37)
> >>
> >>Strip out all the Tcl. All of it. Every last byte. Put the php into a
> >>file. Then, from a command line type "php /your/file.php"
> >>
> >>You will get the exact same error. The bug is in php, of which I know
> >>nothing about. What I do know is that the problem isn't Tcl.
> >
> >
> > No, sorry I get no error whatsoever, in fact, I get nothing.
>
> You are correct. My bad. I was getting this, which is the same error
> you were earlier reporting:
>
>    Warning: Unexpected character in input:  '\' (ASCII=92) state=1 in
>    /private/tmp/error.php on line 9
>
>    Warning: Unexpected character in input:  '\' (ASCII=92) state=1 in
>    /private/tmp/error.php on line 14
>
> ... but that was because the php had two lines with extra backslashes,
> that were in to escape the curly braces due to the fact it was defined
> in Tcl. My mistake. When I took those out in the file-based version of
> the php code, it all worked fine (and by that I mean, I get no php errors).
>
> > It's not
> > a PHP syntax or evaluation error, it's just that apparently it seems
> > $argv does not exist because it was never set with any values,
>
> That's likely also true. Unless you give it a filename as an argument
> you won't have a argv[1].

Ok an update:

My TCL code has been simplified to this:

set contents {<?xml version="1.0" encoding="utf-8" ?><blah><foo
id="1"></foo></blah>}
 if {[catch [exec $valPHPPath -q /home/ppowell/web/blah.php <<
$contents] errMsg]} {
  puts "!!error in exec: $errMsg!!"
 } else {
  puts "This is your list!"


Where I put all of the contents of [set php] into "blah.php" and
calling that instead.

Well, to no avail:

Status: 404 X-Powered-By: PHP/4.4.4 Content-type: text/html No input
file specified. child process exited abnormally while executing "exec
$valPHPPath -q /home/ppowell/web/blah.php << $contents" (procedure
"XML_GET_ALL_ELEMENT_ATTRS" line 39)

When I call it via command-line:

php -q /home/ppowell/web/blah.php << '<?xml version="1.0"
encoding="utf-8" ?><blah><foo id="1"></foo></blah>'

This happens:

/users/ppowell -->php -q /home/ppowell/web/blah.php << '<?xml
version="1.0" encoding="utf-8" ?><blah><foo id="1"></foo></blah>'
>
[and it just sits there for input until I hit CTRL-C]



>
> > so
> > putting it into a PHP file is ultimately meaningless because I can't
> > get the XML contents into the PHP file even if it were separate.
>
> The exercise of putting it in a file is just to illustrate that the php
> has errors in it, it has nothing to do with Tcl. If you can create a
> working block of php  you can call from the command line, you can
> certainly execute it from tcl using the "exec php << $php" trick.
> working PHP and execute it via Tcl. No sense fighting two battles at once.

0
12/1/2006 11:16:23 PM
comp.lang.tcl wrote:

> When I call it via command-line:
> 
> php -q /home/ppowell/web/blah.php << '<?xml version="1.0"
> encoding="utf-8" ?><blah><foo id="1"></foo></blah>'
> 
> This happens:
> 
> /users/ppowell -->php -q /home/ppowell/web/blah.php << '<?xml
> version="1.0" encoding="utf-8" ?><blah><foo id="1"></foo></blah>'
> 
> [and it just sits there for input until I hit CTRL-C]
>

'<<'  has a different behavior in a shell than it does in Tcl. You can't 
use them the same way.

Using '<<' from a bash shell is what is called a "here document". Here's 
one description:

http://www.faqs.org/docs/bashman/bashref_42.html#SEC42
0
oakley (2075)
12/1/2006 11:35:41 PM
Bryan Oakley wrote:
> comp.lang.tcl wrote:
>
> > When I call it via command-line:
> >
> > php -q /home/ppowell/web/blah.php << '<?xml version="1.0"
> > encoding="utf-8" ?><blah><foo id="1"></foo></blah>'
> >
> > This happens:
> >
> > /users/ppowell -->php -q /home/ppowell/web/blah.php << '<?xml
> > version="1.0" encoding="utf-8" ?><blah><foo id="1"></foo></blah>'
> >
> > [and it just sits there for input until I hit CTRL-C]
> >
>
> '<<'  has a different behavior in a shell than it does in Tcl. You can't
> use them the same way.
>
> Using '<<' from a bash shell is what is called a "here document". Here's
> one description:
>
> http://www.faqs.org/docs/bashman/bashref_42.html#SEC42

Ok an update:

I fixed the PHP script (you were right, there were syntax errors after
all, but I was unable to detect them):

set php {<?
            error_reporting(E_ALL & ~E_NOTICE);
            require_once('functions.inc.php');
            $xml = preg_replace('/(>)[\n\r\\s\t]+(<)/', '$1$2',
@file_get_contents('php://stdin'));
            $parser = @xml_parser_create();
            @xml_parse_into_struct($parser, $xml, $xmlArray, $tags);
            @xml_parser_free($parser);
            for ($i = 1; $i < @sizeof($xmlArray) - 1; $i++) {
             foreach ($xmlArray[$i]['attributes'] as $attr => $val) {
              foreach (array(&$attr, &$val) as $field) {
               $field = str_replace('{', '&#123;', str_replace('}',
'&#125;', $field));
               $tclList .= (preg_match('/[\s\t]+/', $field)) ? '{' .
$field . '} ' : "$field ";
              }
             }
            }
            echo trim($tclList);
          ?}

 global valPHPPath
 if {![info exists valPHPPath]} {
  if {![array exists env]} { global env }
  source cgi_globals.tcl
  global valPHPPath
 }
 if {[catch [exec $valPHPPath -q /home/ppowell/web/blah.php <<
$contents] result]} {
  puts stderr "error involving PHP execution: $result"
  exit 2;
 } else {
  return $result
 }

Produces the same error and apparently hangs up when it tries to read
from stdin (is there a stdin size limit?), so it is no longer a TCL
problem at this point

Phil

0
12/2/2006 12:48:44 AM
"comp.lang.tcl" <phillip.s.powell@gmail.com> wrote:

> Uwe Klein wrote:
> > you may want to wrap the [exec ... ] into a catch statement like:
> >
> > if {[catch {exec $valPHPPath -q << $php"} retval]} {
> > ...
> >
> > and see whats happening.
> > catch is very usefull, but you may want to take some rye on the side ;-)
> >
> > uwe
> 
> I wish I could see what's happening, but I have no way of ever knowing
> what's going on
> 
>  if {[catch [exec $valPHPPath -q << $php] errMsg]} {
>  ...

Look closely at the difference between what Uwe suggested and what you 
actually did.  The [catch] command expects a script; you instead gave it 
the results of executing the [exec] command.
0
aranders (203)
12/2/2006 1:26:26 AM
Alan Anderson wrote:
> "comp.lang.tcl" <phillip.s.powell@gmail.com> wrote:
>
> > Uwe Klein wrote:
> > > you may want to wrap the [exec ... ] into a catch statement like:
> > >
> > > if {[catch {exec $valPHPPath -q << $php"} retval]} {
> > > ...
> > >
> > > and see whats happening.
> > > catch is very usefull, but you may want to take some rye on the side ;-)
> > >
> > > uwe
> >
> > I wish I could see what's happening, but I have no way of ever knowing
> > what's going on
> >
> >  if {[catch [exec $valPHPPath -q << $php] errMsg]} {
> >  ...
>
> Look closely at the difference between what Uwe suggested and what you
> actually did.  The [catch] command expects a script; you instead gave it
> the results of executing the [exec] command.

I got to the point where the PHP script that the Tcl script is calling
is somewhat stable (provided you have very tiny inputted data!), I
guess I just won't understand how to look at what Uwe did and what I
did and see the difference as your explanation doesn't make sense
either, sorry.

Phil

0
12/2/2006 1:28:57 AM
I've broken this post into small, bite-sized sections.  I hope that 
helps compensate for how long it is.

"comp.lang.tcl" <phillip.s.powell@gmail.com> wrote:
> I got to the point where the PHP script that the Tcl script is calling
> is somewhat stable (provided you have very tiny inputted data!), I
> guess I just won't understand how to look at what Uwe did and what I
> did and see the difference as your explanation doesn't make sense
> either, sorry.

Uwe Klein's suggestion:
> if {[catch {exec $valPHPPath -q << $php} retval]} {...}

Phillip Powell's version:
> if {[catch [exec $valPHPPath -q << $php] errMsg]} {...}

Do you see the difference between these two lines?  Not the obvious 
retval vs. errMsg names, but the {} vs. [] characters surrounding the 
exec command.

*** ***

You're coming very close to fumbling blindly around in frustration, 
trying to find exactly the combination of chicken entrails and mouth 
position that will yield the results you want.  If you instead take a 
step back and spend just a little time getting a handle on the simple 
syntax of Tcl, I think you'll find the time spent will pay off manyfold.

Look at this web page: http://www.tcl.tk/man/tcl8.4/TclCmd/Tcl.htm

It's only eleven rules.  (The imminent twelfth rule is simple, but not 
important at the moment.)

*** ***

Once you grasp what those " and { and $ and [ characters are actually 
doing, you'll be freer to take a look at the commands you're using, and 
find out what arguments they expect to receive.

For example, [exec]: http://www.tcl.tk/man/tcl/exec.htm

It wants to see a list of words.  The first word in that list is the 
command to be executed (sometimes preceded by an optional switch); the 
rest of the words are passed to that command as parameters, with some 
exceptional cases like "|" and "<<" treated, err, exceptionally.

Another example, [catch]: http://www.tcl.tk/man/tcl/catch.htm

It wants to see a pair of words.  The first one is a script which it 
evaluates; the second is the name of a variable in which to store the 
results of evaluating the script.

*** ***

And use the Tcler's Wiki: http://wiki.tcl.tk/

It has pages giving simple and clear examples of just about any command 
you want to use.  In most cases, it also gives good advice on *why* you 
should follow those examples.
0
aranders (203)
12/2/2006 2:56:50 AM
"Cameron Laird" <claird@lairds.us> wrote in message
news:p3c644-d4c.ln1@lairds.us...
> In article <1164996048.727448.61880@f1g2000cwa.googlegroups.com>,
> comp.lang.tcl <phillip.s.powell@gmail.com> wrote:
> .
> [lots of other
> matters Bryan
> handles more-
> than-expertly]
> .
> .
> >> in $php. Unfortunately I am not able to exactly duplicate
> >> your environment since you're executing tcl from with a web
> >> page served by some tcl-enabled web server, and I don't have
> >> that web server (what web server is that, BTW?)
> >
> >Apache 2.0.53
> .
> .
> .
> Hmmm!  You have an unadorned Apache 2.0.53, built for PHP
> interpretation and CGI, and your Tcl is simply CGI--is that
> right?  What's the Tcl executable installed under HP-UX?  Is
> it the one from ActiveState?
>

Is there any way to tell if Tcl or Tcllib is from Activestate, or generic
Tcl?


0
12/2/2006 3:59:54 AM
In article <1165020524.862090.52660@j44g2000cwa.googlegroups.com>,
comp.lang.tcl <phillip.s.powell@gmail.com> wrote:
			.
			.
			.
>I fixed the PHP script (you were right, there were syntax errors after
>all, but I was unable to detect them):
>
>set php {<?
>            error_reporting(E_ALL & ~E_NOTICE);
>            require_once('functions.inc.php');
>            $xml = preg_replace('/(>)[\n\r\\s\t]+(<)/', '$1$2',
>@file_get_contents('php://stdin'));
>            $parser = @xml_parser_create();
>            @xml_parse_into_struct($parser, $xml, $xmlArray, $tags);
>            @xml_parser_free($parser);
>            for ($i = 1; $i < @sizeof($xmlArray) - 1; $i++) {
>             foreach ($xmlArray[$i]['attributes'] as $attr => $val) {
>              foreach (array(&$attr, &$val) as $field) {
>               $field = str_replace('{', '&#123;', str_replace('}',
>'&#125;', $field));
>               $tclList .= (preg_match('/[\s\t]+/', $field)) ? '{' .
>$field . '} ' : "$field ";
>              }
>             }
>            }
>            echo trim($tclList);
>          ?}
>
> global valPHPPath
> if {![info exists valPHPPath]} {
>  if {![array exists env]} { global env }
>  source cgi_globals.tcl
>  global valPHPPath
> }
> if {[catch [exec $valPHPPath -q /home/ppowell/web/blah.php <<
>$contents] result]} {
>  puts stderr "error involving PHP execution: $result"
>  exit 2;
> } else {
>  return $result
> }
>
>Produces the same error and apparently hangs up when it tries to read

>from stdin (is there a stdin size limit?), so it is no longer a TCL
>problem at this point
>
>Phil
>

I don't understand what you're communicating.  If your 
needs are met, that's certainly one good thing.  I see
several ... fragilities in what's above, though--in the
Tcl code, the PHP part, and the way the two are put 
together.

As at least a couple of others have already observed,

  if {[catch [exec $valPHPPath -q /home/ppowell/web/blah.php \
	<< >$contents] result]} {

is almost certain to lead to more unhappiness than

  if {[catch {exec $valPHPPath -q /home/ppowell/web/blah.php \
	<< >$contents} result]} {

I worry about the value of $contents.

The PHP {}-munging is almost certain to lead to unhappiness.
It's VERY easy for $tclList not to be a Tcl list.

I don't understand use of (PHP's) "for" when "foreach" seems
to be a better fit.

The very first preg_replace can mangle valid XML.

Will two users ever be concurrent?

$php isn't properly closed; I suspect you want

            echo trim($tclList);
          ?>}
rather than
            echo trim($tclList);
          ?}

And so on.
0
claird (2363)
12/2/2006 3:59:16 PM
In article <_S6ch.5577$ql2.2044@newsread3.news.pas.earthlink.net>,
Earl Greida <eGREGIOUSgrieda@FREEyahoo.commit> wrote:
>
>"Cameron Laird" <claird@lairds.us> wrote in message
>news:p3c644-d4c.ln1@lairds.us...
>> In article <1164996048.727448.61880@f1g2000cwa.googlegroups.com>,
>> comp.lang.tcl <phillip.s.powell@gmail.com> wrote:
>> .
>> [lots of other
>> matters Bryan
>> handles more-
>> than-expertly]
>> .
>> .
>> >> in $php. Unfortunately I am not able to exactly duplicate
>> >> your environment since you're executing tcl from with a web
>> >> page served by some tcl-enabled web server, and I don't have
>> >> that web server (what web server is that, BTW?)
>> >
>> >Apache 2.0.53
>> .
>> .
>> .
>> Hmmm!  You have an unadorned Apache 2.0.53, built for PHP
>> interpretation and CGI, and your Tcl is simply CGI--is that
>> right?  What's the Tcl executable installed under HP-UX?  Is
>> it the one from ActiveState?
>>
>
>Is there any way to tell if Tcl or Tcllib is from Activestate, or generic
>Tcl?
>
>

No.

It's a legitimate question.  There are two levels at which
it might interest one:
A.  as a developer, one might want to write code
    which works well in a variety of potential
    installations.  It's almost certain that the
    correct way to proceed in this case is with
    judicious use of [package].
B.  as an administrative "debugger", in trying
    to analyze a broken situation, it just helps
    cut through distractions to deal with 
    specific details.  Talking in terms of 
    ActiveState vs. some other installation can
    help a confused person focus on helpful
    concrete elements.

My question (probably for an old-timer):  what's the difference
between

  $::env(_)
  info nameofexecutable
  $::argv0

?  I assume it's an epiphenomenon of an evolutionary trajectory,
but really can't imagine exactly what it was.

No, wait--I get that $::argv0 might be *relative*.  That still 
leaves ...
0
claird (2363)
12/2/2006 4:10:13 PM
Earl Greida wrote:
> "Cameron Laird" <claird@lairds.us> wrote in message
> news:p3c644-d4c.ln1@lairds.us...
>> In article <1164996048.727448.61880@f1g2000cwa.googlegroups.com>,
>> comp.lang.tcl <phillip.s.powell@gmail.com> wrote:
>> .
>> [lots of other
>> matters Bryan
>> handles more-
>> than-expertly]
>> .
>> .
>>>> in $php. Unfortunately I am not able to exactly duplicate
>>>> your environment since you're executing tcl from with a web
>>>> page served by some tcl-enabled web server, and I don't have
>>>> that web server (what web server is that, BTW?)
>>> Apache 2.0.53
>> .
>> .
>> .
>> Hmmm!  You have an unadorned Apache 2.0.53, built for PHP
>> interpretation and CGI, and your Tcl is simply CGI--is that
>> right?  What's the Tcl executable installed under HP-UX?  Is
>> it the one from ActiveState?
>>
> 
> Is there any way to tell if Tcl or Tcllib is from Activestate, or generic
> Tcl?

Yes.

package require ActiveTcl

That will give you the exact build number.  Use a catch - it will of 
course fail if you aren't using ActiveTcl.

-- 

   Jeff Hobbs, The Tcl Guy, http://www.activestate.com/
0
jeffh (1291)
12/2/2006 7:14:20 PM
Reply:

Similar Artilces:

"out" and "in out"
Hi i found the following explaination: In Ada, "in" parameters are similar to C++ const parameters. They are effectively read-only within the scope of the called subprogram. Ada "in out" parameters have a reliable initial value (that passed in from the calling subprogram) and may be modified within the scope of the called procedure. Ada "out" parameters have no reliable initial value, but are expected to be assigned a value within the called procedure. What does "have no reliable initial value" mean when considering the "out" parameter? By chance I created a small program as follows: =========== s : string := "CAT"; procedure modify ( s1 : out string ) is begin s1(2) := 'U'; end modify; ... put ( modify(s) ); =========== now I get as a result "CUT", and i dont understand why i get this result. Doesnt the "out" specify that its initial value isnt passed in via the parameter? But it seems to be passed in the above. In fact the "out" is acting like an "in out". I am a little confused. Could someone shed some light on this? Many thanks! zork "zork" <zork@nospam.com> wrote in message news:4104d5de@dnews.tpgi.com.au... > Hi i found the following explaination: > > In Ada, "in" parameters are similar to C++ const parameters. They are > effectively read-only within the scope of the called subprogram. > Ada "in out&q...

about "++" and "--"
why this program snippet display "8,7,7,8,-7,-8" the program is: main() { int i=8; printf("%d\n%d\n%d\n%d\n%d\n%d\n",++i,--i,i++,i--,-i++,-i--); } > why this program snippet display "8,7,7,8,-7,-8" Ask your compiler-vendor because this result is IMHO implementation-defined. Check this out: http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39.15 http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39.16 Regards, Irina Marudina fxc123@gmail.com wrote: > why this program snippet display "8,7,7,8,-7,-8&q...

why "::", not "."
Why does the method of modules use a dot, and the constants a double colon? e.g. Math::PI and Math.cos -- Posted via http://www.ruby-forum.com/. On Oct 26, 2010, at 01:48 , Oleg Igor wrote: > Why does the method of modules use a dot, and the constants a double > colon? > e.g. > Math::PI and Math.cos For the same reason why inner-classes/modules use double colon, because = they're constants and that's how you look up via constant namespace. Math::PI and ActiveRecord::Base are the same type of lookup... it is = just that Base is a module and PI is a float....

Urgent need """""""""""INFORMATICA DEVELOPER"""""""""""""
Hello Partners, How are you ? Please find the requirements below. Title: Database/ETL Developer Duration: 6 months Location: NY Exp: 7+ Locals preferred Database/ETL requirements (Mandatory) Candidate must have worked with financial instruments, preferably Mutual Funds but, Equities are also ok. PL/SQL - packages, Stored procs, Functions, Aggregate functions, Pipelined Functions Informatica 8.6 - especially complex mappings, complex maplets, complex workflows, transformations Oracle 10g/11g Unix/Linux shell scripting Database/ETL requirements (Optional) Data warehousing experience Threading and job concepts in 10g/11g Cost based Optimizer concepts in 10g/11g Must : Experience with XML files and partitioning concepts in Oracle, Collections, Material Views Note : No phone calls please. : send Resumes to karthik@bhaninfo.com Thanks & Regards Karthik BhanInfo karthik@bhaninfo.com ...

"In" "Out" and "Trash"
I just bought a new computer and I re-installed Eudora Light on my new computer. But when I open Eudora, the "In", "Out" and "Trash" links are not on the left side of the screen the way they were on my old computer. How can I get these links back on the left side of the screen? Thank you. On 25 Mar 2007 09:49:22 -0700, "abx" <abfunex@yahoo.com> wrote: >I just bought a new computer and I re-installed Eudora Light on my new >computer. But when I open Eudora, the "In", "Out" and "Trash" links >are ...

"execs" or "scripts"
I notice that most people call the Rexx routines "scripts". I come from an old VM/CMS and MVS/TSO world where they were called "execs". I have to admit that "scripts" kinda grates on my ears (eyes?) a bit. Is "script" the generally accepted terminology? Jennifer Murphy <JenMurphy@jm.invalid> wrote: > I notice that most people call the Rexx routines "scripts". I come from an > old VM/CMS and MVS/TSO world where they were called "execs". I have to > admit that "scripts" kinda grates on my ears (eyes?) a bit. > > Is "script" the generally accepted terminology? Not for me; I'm an "exec" person too - but then, also from a mainframe bachground. -- Jeremy C B Nicoll - my opinions are my own. Email sent to my from-address will be deleted. Instead, please reply to newsreplyaaa@wingsandbeaks.org.uk replacing "aaa" by "284". On 8/21/2012 12:35 PM, Jeremy Nicoll - news posts wrote: > Jennifer Murphy <JenMurphy@jm.invalid> wrote: > >> I notice that most people call the Rexx routines "scripts". I come from an >> old VM/CMS and MVS/TSO world where they were called "execs". I have to >> admit that "scripts" kinda grates on my ears (eyes?) a bit. >> >> Is "script" the generally accepted terminology? > > Not for me; I'm an "ex...

php requires ".php" not ".html" ?
Dumb question -- I know, but... Yes, I searched books and googled but couldn't find the answer. Does php always require that the page be .php and not .html ? Or is this server-dependent? Mine doesn't seem to recognize a php line in a .html page. By the way, how do searchers, eg Google, treat .php? same as .html? Do I lose search position by changing from .html to .php? MasonC masoncXXX@XXXfrontal-lobe.info wrote: > Dumb question -- I know, but... > Yes, I searched books and googled but couldn't find the answer. > > Does php always require that the page be .php and not .html ? > Or is this server-dependent? Mine doesn't seem to recognize a php line in a .html page. > > By the way, how do searchers, eg Google, treat .php? same as .html? > Do I lose search position by changing from .html to .php? > > MasonC It's part of your web server configuration - not PHP. Security conscious hosts will require .php extensions to parse php files. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ================== At Sun, 06 Jun 2010 14:49:27 -0700 masoncXXX@XXXfrontal-lobe.info wrote: > > Dumb question -- I know, but... > Yes, I searched books and googled but couldn't find the answer. > > Does php always require that the page be .php and not .html ? > Or is this server-dependent? Mine doesn't seem to r...

When to use "." and when to use "!"
I'm still confused about this and I can't find anywhere that explains it properly. I have the MS book "Access 2003" in front of me and I'm reading Part 5 about VB and so on. It's telling me about how to refer to a specific database and has the example:- Dim dbMyDb As DAO.Database Set dbMyDb = DBEngine.Workspaces(0).Databases(0) but, but, but, but - what do those dots (periods, full stops, call them what you will) mean? (OK, it appears to be the same usage as C/C++/Java when referring to class/structure members, but I wish it would tell me that somewhere) Why are there dots used in referring to object members in this case but when referring to controls on forms (for example) one uses "!". Surely there must be somewhere that helps one understand this basic syntax. -- Chris Green Generally, a dot exposes properties and methods and a bang (!) exposes members of a collection. So forms!frmMyForm.Visible refers to the visible property of frmMyForm, which is a member of the forms collection. What makes this harder (or easier, depending on your perspective) to grasp, is that Access has gotten more and more forgiving about using the "wrong" notation. usenet@isbd.co.uk wrote in news:44316bba.0@entanet: > I'm still confused about this and I can't find anywhere that explains > it properly. > > I have the MS book "Access 2003" in front of me and I'm reading Part 5 > about VB and so on....

Urgent JAVA Requirement in """"""NEW YORK"""""""""
Hello Partners, How are you ? Please find the requirement below. Location : NY Duration : 8 mnths Rate :Open Job description: Java/J2EE Web Service Developer =B7 (4+ years of application development experience in Java/J2EE and Web service technologies. =B7 Experience with spring & Hibernate. =B7 Experience with J2EE Application Server (preferably Web logic). =B7 Preferable Aqua logic DSP Experience =B7 Preferable Sonic ESB Composite Service experience Experience working in UNIX environment. Good working knowledge of Oracle RDBMS and PL/SQL) Note : Please send your updated resume along with contact no to Karthik@bhaninfo.com. Thanks & Regards Karthik BhanInfo karthik@bhaninfo.com # 1572, 7 th Floor Suites, 1 Blue Hill Plaza Pearl River,NY-10965 www.bhaninfo.com ...

puts "\\".gsub("\\", "\\\\")
Hello, I have a mini-ruby quiz. Guess what this line of code writes to the console, then try it for yourself: puts "\\".gsub("\\", "\\\\") Why is that so? Martin From: martinus [mailto:martin.ankerl@gmail.com]=20 # Hello, I have a mini-ruby quiz. Guess what this line of code writes to # the console, then try it for yourself: # puts "\\".gsub("\\", "\\\\") puts "\\".gsub("\\", "\\\\") \ #=3D> nil # Why is that so? faq. escaping the escape in sub/gsub. search the archives. maybe you want somethin...

Gary Sokolich """"""
"""""""""" http://www.manta.com/c/mmlq5dm/w-gary-sokolich W Gary Sokolich 801 Kings Road Newport Beach, CA 92663-5715 (949) 650-5379 http://www.tbpe.state.tx.us/da/da022808.htm TEXAS BOARD OF PROFESSIONAL ENGINEERS February 28, 2008 Board Meeting Disciplinary Actions W. Gary Sokolich , Newport Beach, California �V File B-29812 - It was alleged that Dr. Sokolich unlawfully offered or attempted to practice engineering in Texas (...) Dr. Sokolich chose to end the proceedings by signing a Consent Order that was accepted by ...

Question about "sprintf" "@" "do for"
Hello, this works: A1=3D1 A2=3D2 A3=3D3 i=3D1 vari=3Dsprintf("A%.f",i) print vari,"=3D",@vari i=3Di+1 vari=3Dsprintf("A%.f",i) print vari,"=3D",@vari i=3Di+1 vari=3Dsprintf("A%.f",i) print vari,"=3D",@vari do for [i=3D1:3]{ vari=3Dsprintf("A%.f",i) print vari } But I want to have "print vari,"=3D",@vari" in the loop. But it dosen't=20 work. Why can't I use "print vari,"=3D",@vari" in the loop? Is there a=20 solution for? J=C3=B6rg Jörg ...

why have both "." and "->" ?
I used to remember why c++ needed both ? Could somebody help me here ? For example class A{ f(); }; A* aa; You could do either "aa->f()" or "(*aa).f()". So why does C++ need both operators. Raj "raj" <rajkumar@hotmail.com> schreef in bericht news:d7fee6d0.0406230748.694b966b@posting.google.com... > I used to remember why c++ needed both ? > Could somebody help me here ? > > For example > > class A{ > f(); > }; > > A* aa; > > You could do either "aa->f()" or "(*aa).f()". So why does C++ need both operators. > > Raj There is a difference I believe that xxxx->yyyy is used if xxxx is a pointer to an object/class and xxxx.yyyyy if xxxx is the object/classs > class A{ > f(); > }; > > A* aa; > > You could do either "aa->f()" or "(*aa).f()". So why does C++ need both operators. IMHO it's simply convenience. Bye, Marco raj wrote: > > You could do either "aa->f()" or "(*aa).f()". So why does C++ need both > operators. The second form involves more typing and requires more effort to read. -- Russell Hanneken eunaarxra@cbobk.pbz Use ROT13 to decode my email address. In message <WOhCc.15115$Wr.8451@newsread1.news.pas.earthlink.net>, Russell Hanneken <me@privacy.net> writes >raj wrote: >> >> You could do either "aa->f()" or "(*aa...

"A" is not equal "A"?
I was trying to convert String Array to String A through cycle and than compare the result with String B but eventhough results were the same it returned false. I'am working in BlueJ 3.1.0 Code is: public boolean Method () { String[] Example = {"a","b","c"}; String A = ""; String B = "abc" for (int i = 0; i<3 ; i++) { A = A + Example[i]; } if (A == B) { return true; } } never got true... I appreciate any suggestions how to solve this Den 08.04.2014 10:06, skrev 245dav@gmail.com:...

how to change "/" to "\"
iam new to shell scripting and i have plz can anyone help in changing the pattrern "/" to "\" using the sed command. olympie@gmail.com wrote: > iam new to shell scripting and i have plz can anyone help in changing > the pattrern "/" to "\" using the sed command. sed 's/\//\\/g' will replace all '/' with '\' srp -- http://saju.net.in Saju Pillai <saju.pillai@gmail.com> wrote: >> iam new to shell scripting and i have plz can anyone help in changing >> the pattrern "/" to "\" using ...

what does the "+" and the "-" mean?
I recently read what the "+" and the "-" signs mean for compact discs. Of course, a friend has just asked me and I now forget. I've searched all over the place with no results. Anyone know? TIA! .. -------------------------------------- Mike Richter, were you born with "Scam Artist" emblazoned on your face? -------------------------------------- roscoe james wrote: > > I recently read what the "+" and the "-" signs mean for compact discs. Of > course, a friend h...

Re: "out" and "in out"
"no reliable initial value" means, you cannot rely on the value, but it may have a value. This depends on the parameter passing mechanism, which is _not_ related to the parameter mode (contrary to what many people think). So the parameter mode is there (nearly) solely for the information of the reader. The parameter passing mechanism for all kinds of parameters is defined in the RM. There are parameters passed by copy (in and out), by reference; for some it is explicitly left undefined. In your case, the passing mechanism is by reference, so you get what you get. But don't rely on this, rely only on the mode, i.e. the parameter st is undefined upon entering the procedure modify, so when you only write component 2, upon return, only component 2 has been written. Under slight variations, the result of your code might be <garbage character>U<garbage character>. Another thing: Don't rely upon s1'First = 1. Component 2 might not exist. You could call modify like so: X: String (25..30); modify (X); Now s1(2) inevitably will raise Constraint_Error. ____________________________________________________ Aufnehmen, abschicken, nah sein - So einfach ist WEB.DE Video-Mail: http://freemail.web.de/?mc=021200 "Christoph Karl Walter Grein" <AdaMagica@web.de> wrote: > > In your case, the passing mechanism is by reference, so you get what you get. But don't rely on this, rely only on the mode, i.e. the parameter st is undefined...

"==" is NOT TRUE "==", WHY?
[CODE START] x=5; y=8; if (x + y + 1E-15 == 13) a = 3 else a = 8 end [CODE END] When x + y + 1E-15, the code above returns a = 8. When x + y + 1E-16, the code above returns a = 3. Why? Kindly advise. Thanks. "onemilimeter Chen" <onemm@example.com> wrote in message <g7adrj$5tr$1@fred.mathworks.com>... > [CODE START] > x=5; > y=8; > if (x + y + 1E-15 == 13) > a = 3 > else > a = 8 > end > [CODE END] > > When x + y + 1E-15, the code above returns a = 8. > When x + y + 1E-16, the code above returns a = 3. > > Why? ...

if("0X0"=="000"){echo "boo";}
Hi ;) Everything is in the title. the prob is "boo" is displayed ! Can you believe it ? Thanx for anyone who can help me. fabrice. Fabrice R=E9gnier wrote: > Hi ;) > > Everything is in the title. the prob is "boo" is displayed ! Can you > believe it ? Thanx for anyone who can help me. > > fabrice. That's because they are equal! PHP interprets the string "0X0" as zero in Hexidecimal and that is equal to 0. What are you trying to accomplish? Ken Fabrice R?gnier <regnier.fab@free.fr> wrote: > Everything is in the title. the pr...

why "" in echo "$FOO" ?
I just read in a book that to one way to find out the value of an enviroment variable is to give it as the argument to echo, preceded by a $ and surrounded by double quotes, as in echo "$FOO". Why the quotes? It seems that I get the same results whether I do echo $FOO or echo "$FOO". Thanks! Karl -- Sent from a spam-bucket account; I check it once in a blue moon. If you still want to e-mail me, cut out the extension from my address, and make the obvious substitutions on what's left. KKramsch <karlUNDERSCOREkramsch@yahooperiodcom.invalid> wrote: > &g...

files "." and ".." from readdir()
Will readdir always return "." and ".." as the _first_ two entries returned if the filesystem has them? I'm just curious if it testing for them can be skipped after the first two have been tested. I've always written my loops around readdir with the tests applied in every case. -- |WARNING: Due to extreme spam, googlegroups.com is blocked. Due to ignorance | | by the abuse department, bellsouth.net is blocked. If you post to | | Usenet from these places, find another Usenet provider ASAP. | | Phil Howard KA9WGN (email for humans: first ...

Use "range," not "for"?
Thanks to everyone who suggested ways to get a proc to recognize all variables in the global scope--here's why I wanted to know. (Maybe someone has done this better already--if so, don't hesitate to let me know!) I've found that a simple "foreach" loop fairly often won't do the jobs I want done, and I need to use "for"--ugh! Well, I recently read at least part of a book about Python. It didn't look like an improvement over Tcl for the most part, but it has at least a few good features, one of which is the "range" expression. I thought a "range" procedure in Tcl might be a good substitute for the clumsy "for." So, here's my first effort. Instead of writing this: for {set i 1} {$i<= 10} {incr i} {puts "$i. \"for\" is ugly!"} you can write this: range i 1 to 10 {puts "$i. \"range\" is beautiful!"} Or, if you have a list called "lum," instead of writing this: for {set i 0} {$i < [llength $lum]} {incr i} {puts [lindex $lum $i]} you can write this: range i 0 no [llength $lum] {puts [lindex $lum $i]} To go backward, skipping every other number, instead of this: for {set i 10} {$i >= 0} {incr i -2} {puts $i} you can write this: range i 10 to 0 -2 {puts $i} The usage is pretty obvious: "range var start cutoff end ?incr? body." In other words, (1) the word "range"; (2) a vari...

Invalid use of "." "!"
In writing a sql statement I get the error "invalid use of "." "!"......... this is apparently coming because the where clause of the sql statemt refers to a combo box with sales persons names in it. All the names are listed first initial followed by a "." and last name. I am assuming the error i am getting is coming from the "." in the combo box. How do I get around the invalid use of the "." ? Thanks Never mind..... didnt have enough quotation marks. "Learning" <texson552000@yahoo.com> wrote in message news:DQELg.10308$o42.364@tornado.texas.rr.com... > In writing a sql statement I get the error "invalid use of "." "!"......... > this is apparently coming because the where clause of the sql statemt refers > to a combo box with sales persons names in it. All the names are listed > first initial followed by a "." and last name. I am assuming the error i am > getting is coming from the "." in the combo box. > > How do I get around the invalid use of the "." ? > > Thanks > > ...

when should one use "and" and "or"
Hi All, just got hit w the ff > case > when x==1 or x==2 > print "yeoh!" > end SyntaxError: compile error (irb):17: syntax error, unexpected kOR, expecting kTHEN or ':' or '\n' or ';' when x==1 or x==2 ^ "or" and "and" both exhibit the behaviour in ruby1.8/1.9. workaround 1 put parens around the condition (not again) 2 replace or/and with ||/&& i believe there are other similar quirks when using "and/or".. has ruby relegated the use of "and/or"....? best regards -botp On Feb 4, 9:55=A0pm, botp <botp...@gmail.com> wrote: > Hi All, > > just got hit w the ff > > > case > > when x=3D=3D1 or x=3D=3D2 > > =A0 print "yeoh!" > > end x =3D 5 =3D=3D>5 case x when 2,3 p 'no' when 4,5 p 'yes' end "yes" =3D=3D>nil On Fri, Feb 5, 2010 at 1:45 PM, w_a_x_man <w_a_x_man@yahoo.com> wrote: #> x =3D 5 #> =A0 =A0=3D=3D>5 #> case x #> =A0when 2,3 #> =A0 =A0p 'no' #> =A0when 4,5 #> =A0 =A0p 'yes' #> end of course i know that ;-) im talking about the second type of "case", eg > case > when x.baz and y.foo .... best regards -botp botp wrote: > i believe there are other similar quirks when using "and/or".. > has ruby relegated the use ...

Web resources about - 'echo "": No such file or directory" error using "exec" to pipe in PHP script - comp.lang.php

Resources last updated: 3/23/2016 9:25:41 PM