[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl-WebCGI] I am an idiot was: STDOUT with MacHTTP -- Help



Well I have to sheepishly admit that I found the problem and it had nothing
to do with configuring MacHTTP.

I should have mentioned that the script I was having trouble with is, in
fact, a subrountine.  *STDOUT is used to pass the STDOUT filehandle to a
local filehandle, in this case OUT.
 
The subroutine gets called like this:

    print "Content-type: text/html\n\r\n\r";
    parse_template($template_name,*STDOUT);

The beginning of the subroutine looks like:

    sub parse_template {

        ($template_name,*OUT) =@;

So that, later in the routine one can

    print OUT $line;

The reason for doing this is so that the parsed output can be directed where
one likes depending on what filehandle is passed to the subroutine.

Bruce Van Allen's comment about *STDOUT being a reference got me to
thinking. . . . and I had script print *OUT (that is, the reference) from
the subrountine.  The result was *main::STDOUT which meant that there was no
problem with STDOUT or MacHTTP.  It does work just like UNIX.

The problem, as it turns out, was that I forgot that : functions as / on the
Mac.  I was passing $template_name with slashes instead of colons so, of
course, the script couldn't find the template file.  I changed slashes to
colons and now all is well. I've been working on Macs since the 128K and of
course I should have seen the problem.

But then that's what happens late in the afternoon when the computer isn't
reading one's mind as well as it should be.

Thanks for the help all.

Peter Wiley

==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-webcgi-request@macperl.org