470,648 Members | 1,414 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,648 developers. It's quick & easy.

premature end of headers, code and output looks fine

hello, could someone please check this out?

#usr/local/bin/perl
# Filelist.pl version 0.1
use strict;
use CGI qw(:all);
use CGI::Pretty;
#use CGI::Carp qw(fatalsToBrowser);
use Cwd;
my ($query, $showdrive, $currentdir, @filelist, $file);
$currentdir=getcwd;
unless ($showdrive) {
$currentdir=~s/^(\w\:)//; #remove drive letter and trailing colon
$currentdir=~s/([^\/\\]$)/$1\//; #put on trailing slash
}
$query=CGI->new();
opendir(DIR,".");
@filelist=readdir(DIR);

print header('text/plain');
print $query->start_html(title=>'/dave/ Index'
);
print h1("File contents of : ",$currentdir);

foreach $file (@filelist){
# print a({href=>$file,target=>'_self'},$file); print "<br>";
}
print $query->end_html;

###########################################

it prints the following output.

prints the following output:

Content-Type: text/plain; charset=ISO-8859-1

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN"
"http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
lang="en-US"><head><title>title</tit
e>
<link rev="made" href="mailto:%2Fdave%2F%20Index" />
</head><body><h1>
File contents of :
</h1>
<a href="." target="_self">.</a>
<br><a href=".." target="_self">..</a>
<br><a href="filelist.pl" target="_self">filelist.pl</a>
<br></body></html>

i'm getting the error "premature end of script headers"

where can i find the error documentation, and what's wrong with the header?

also, i've been trying the CWD module and on some systems it fails because
it demands root access. it gets denied and the program crashes. is there any
way for it to work without doing that? or is there another module that does
the same thing but won't need root access?

thanks,
chris berkelaar
Jul 19 '05 #1
1 2000
cy***********@hotmail.com (nomadx) wrote in message news:<1c**************************@posting.google. com>...
hello, could someone please check this out?

#usr/local/bin/perl
# Filelist.pl version 0.1
use strict;


Am I confused? thought you needed something
in first line more like

#!/usr/local/bin/perl

Ray
Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Jason Ho-Ching | last post: by
1 post views Thread by Wayne Deleersnyder | last post: by
16 posts views Thread by Grumble | last post: by
22 posts views Thread by Platero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.