>> And what is the "T" in -Tw? That doesn't appear to show up in the man
>> page...
>
> T means tainted. It's what you want to run on all code in your cgi-bin
> directory so that a hacker can't r00t your box. Basically it prevents
> your perl script from doing anything dumb.
>
> Out of curiou
> And what is the "T" in -Tw? That doesn't appear to show up in the man
> page...
T means tainted. It's what you want to run on all code in your cgi-bin
directory so that a hacker can't r00t your box. Basically it prevents
your perl script from doing anything dumb.
Out of curiousity, is the fi
> 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
> "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;
> copy "header.incl", \*STDOUT;
I like this, it's very clean.
Unfortunately I'm having trouble using it in a cgi script...
**
#!/usr/bin/perl -w
use File::Copy;
print "Content-type: text/plain\n\n";
copy "header.incl", \*STDOUT;
print "Mo
On Thu, Oct 02, 2003 at 05:17:34PM +0200, Thomas B?tzler wrote:
> Todd Wade <[EMAIL PROTECTED]> wrote:
> > "Gary Stainburn" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> > > print while();
>
> This is bad because it first pulls in the file to
> build the list.
It doesn't. The
Joshua Colson [mailto:[EMAIL PROTECTED] suggested:
> sub load_file {
> my($file,$html) = shift;
> $html = '';
> open(FILE, "$file") or die "Cannot open $file for reading: $!"
> while() { $html .= $_; }
> return $html;
> }
Instead of "while() { $html .= $_; }", you
could use "$html = join
Todd Wade <[EMAIL PROTECTED]> wrote:
> "Gary Stainburn" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
[...]
> > One thing you forgot was to close the file. Also, don't
> > forget that you can do it with less typing:
Closing files is optional in Perl ;-) Filehandles
will either b
> "Bryan" == Bryan Harris <[EMAIL PROTECTED]> writes:
Bryan> What I'm interested in is what's the easiest way to print the
Bryan> contents of a file? For example, if I want to output my header
Bryan> file, "header.incl", how can I print the contents of that file
Bryan> the easiest (and most g
# Set $header_file to the PATH to header.incl
my $header_file = 'header.incl';
# Call load_file() which takes a filename as an argument and
# returns the contents of that file. Then print what load_file()
# returns.
print load_file($header_file);
sub load_file {
my($file,$html) = shift;
$html
In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] (Todd Wade) writes:
>
>"Gary Stainburn" <[EMAIL PROTECTED]> wrote in message
>news:[EMAIL PROTECTED]
>> On Thursday 02 Oct 2003 10:25 am, Owen wrote:
>> > On Wed, 01 Oct 2003 23:14:00 -0700
>> >
>> > Bryan Harris <[EMAIL PROTECTED]> wrote:
>> > > W
"Gary Stainburn" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Thursday 02 Oct 2003 10:25 am, Owen wrote:
> > On Wed, 01 Oct 2003 23:14:00 -0700
> >
> > Bryan Harris <[EMAIL PROTECTED]> wrote:
> > > What I'm interested in is what's the easiest way to print the contents
of
> > >
On Thursday 02 Oct 2003 10:25 am, Owen wrote:
> On Wed, 01 Oct 2003 23:14:00 -0700
>
> Bryan Harris <[EMAIL PROTECTED]> wrote:
> > What I'm interested in is what's the easiest way to print the contents of
> > a file? For example, if I want to output my header file, "header.incl",
> > how can I pri
On Wed, 01 Oct 2003 23:14:00 -0700
Bryan Harris <[EMAIL PROTECTED]> wrote:
>
> What I'm interested in is what's the easiest way to print the contents of a
> file? For example, if I want to output my header file, "header.incl", how
> can I print the contents of that file the easiest (and most gen
14 matches
Mail list logo