premature end of headers, code and output looks fine

N

nomadx

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
 
D

dinser

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top