>>>>> "Bryan" == Bryan Harris <[EMAIL PROTECTED]> writes:

>> use File::Copy;
>> copy "header.incl", \*STDOUT;


Bryan> I like this, it's very clean.

Bryan> Unfortunately I'm having trouble using it in a cgi script...

Bryan> **************************************
Bryan> #!/usr/bin/perl -w
Bryan> use File::Copy;

Bryan> print "Content-type: text/plain\n\n";

Bryan> copy "header.incl", \*STDOUT;
Bryan> print "More stuff goes here\n";

Bryan> **************************************

Ahh.  A buffering issue.
Your content-type: is not appearing before the header.incl.  You need
to add "$| = 1;" before the print.

That's the reason I start nearly all my CGI scripts with:

        #!/usr/bin/perl -Tw
        use strict;
        $|++;

so that I don't ever have to worry about STDOUT buffering.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to