Ruskin
asked on
Routing stdout to a file with Vignette - How to?
Hi,
I'm building a CMA and I would like to make use of the htmlparse package supplied with Tcllib 1.0.
Just wrote a little testprogram and I get an error straight away (see below).
My question is, who do I setup Vignette to route standard output to a file?
Kind Regards
// Anders Karlsson
-------------------------- ---------- ---------- ---------- ---------- -----
error writing "stdout": bad file number
while executing
"puts "==> $args""
(procedure "::htmlparse::debugCallbac k" line 3)
invoked from within
"::htmlparse::debugCallbac k {hmstart} {} {} {}"
("eval" body line 1)
invoked from within
"eval "$cmd {$vroot} {} {} \{$html\}""
(procedure "htmlparse::parse" line 75)
invoked from within
"htmlparse::parse $test_html"
invoked from within
"set p_test_html -incvar inc_tags [htmlparse::parse $test_html]"
-------------------------- ---------- ---------- ---------- ---------- -----
I'm building a CMA and I would like to make use of the htmlparse package supplied with Tcllib 1.0.
Just wrote a little testprogram and I get an error straight away (see below).
My question is, who do I setup Vignette to route standard output to a file?
Kind Regards
// Anders Karlsson
--------------------------
error writing "stdout": bad file number
while executing
"puts "==> $args""
(procedure "::htmlparse::debugCallbac
invoked from within
"::htmlparse::debugCallbac
("eval" body line 1)
invoked from within
"eval "$cmd {$vroot} {} {} \{$html\}""
(procedure "htmlparse::parse" line 75)
invoked from within
"htmlparse::parse $test_html"
invoked from within
"set p_test_html -incvar inc_tags [htmlparse::parse $test_html]"
--------------------------
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
more foul tongue?
how quaint.
<snore>
how quaint.
<snore>
Hi Ruskin,
you don't need to redirect the stdout to a file. As far as I know the output to stdout from htmlparse is just "debug"-info. You can simply delete the "puts"-statements.
If you have other applications using puts you might want to "overload" puts. You can insert something like the following in your delivery.tcl file (UNTESTED!)
rename puts _original_puts
proc puts {args} {
# determine arguments, check if output-channel is stdout
# maybe the parameter "-nonewline" was specified...
if {<output-channel is stdout} {
set fd [open <your-file> a]
uplevel _original_puts $fd $args
close $fd
} else {
uplevel eval _original_puts $args
}
}
But I doubt you want to have all those stuff in a file. And deleting the puts is easier :-)
Best regards
Stefan
you don't need to redirect the stdout to a file. As far as I know the output to stdout from htmlparse is just "debug"-info. You can simply delete the "puts"-statements.
If you have other applications using puts you might want to "overload" puts. You can insert something like the following in your delivery.tcl file (UNTESTED!)
rename puts _original_puts
proc puts {args} {
# determine arguments, check if output-channel is stdout
# maybe the parameter "-nonewline" was specified...
if {<output-channel is stdout} {
set fd [open <your-file> a]
uplevel _original_puts $fd $args
close $fd
} else {
uplevel eval _original_puts $args
}
}
But I doubt you want to have all those stuff in a file. And deleting the puts is easier :-)
Best regards
Stefan
1. the syntax of "puts" is as follows:
puts ?-nonewline? ?channel? outputString
2. "I/O is done via channels. A channel is accessed via handles which are returned by certain commands."
3. open a channel to a file using the open command:
open fileName ?access? ?permissions?
Is this any use?