Re: easiest `cat` in perl

2003-10-04 Thread Bryan Harris
>> 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

Re: easiest `cat` in perl

2003-10-03 Thread Dan Anderson
> 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

Re: easiest `cat` in perl

2003-10-03 Thread Bryan Harris
> 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

Re: easiest `cat` in perl

2003-10-03 Thread Randal L. Schwartz
> "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>

Re: easiest `cat` in perl

2003-10-02 Thread Bryan Harris
> 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

Re: easiest `cat` in perl

2003-10-02 Thread Steve Grazzini
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

RE: easiest `cat` in perl

2003-10-02 Thread Thomas Bätzler
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

RE: easiest `cat` in perl

2003-10-02 Thread Thomas Bätzler
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

Re: easiest `cat` in perl

2003-10-02 Thread Randal L. Schwartz
> "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

Re: easiest `cat` in perl

2003-10-02 Thread Joshua Colson
# 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

Re: easiest `cat` in perl

2003-10-02 Thread Peter Scott
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

Re: easiest `cat` in perl

2003-10-02 Thread Todd Wade
"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 > > >

Re: easiest `cat` in perl

2003-10-02 Thread Gary Stainburn
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

Re: easiest `cat` in perl

2003-10-02 Thread Owen
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