473,322 Members | 1,398 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

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 2101
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Seagull Manager | last post by:
Running Apache 1.3, PHP 4.3, and WinXP, configured acc. to instructions on apache manual and php manual (as far as I can see), but getting "internal server error" in browser... log says "Premature...
1
by: Jason Ho-Ching | last post by:
Can anyone tell me about this error I am getting? Premature end of script headers: main.php Thanks! ##-----------------------------------------------## Article posted from PHP Freaks...
0
by: Greeshma | last post by:
Hi all, I have successfully configured Apache 2.0.4 with RedHat 7.3 and use Python 2.2.3 for cgi scripts. When I start Apache manually through /usr/local/apache/bin/apachectl startssl, I can...
1
by: Wayne Deleersnyder | last post by:
Hi, I'm a newbie at Perl and CGI and hoping someone can point me in the right direction. Recently I've been going through an older book I have on CGI programming to get a start. Most of it...
16
by: Grumble | last post by:
Hello, I recently came across code that defined a peculiar macro: #define local static gcc had no problem with it, but another (experimental) compiler I am evaluating output a lengthy list...
22
by: Platero | last post by:
Hi, I've a stupid question but... The code is the following: if(($role!='tutor')&&(array_key_exists('tutor_id',$_GET))) { $possible_ids = array(2,6,7,8,9,10); $t_id = $_GET;
4
by: three-eight-hotel | last post by:
I'm somewhat of a newbie to PHP coding, but have developed a site using the technology, and have been pleasantly surprised by the capabilities offered. I am more comfortable in the ASP world,...
3
by: GazK | last post by:
I have been using an xml parsing script to parse a number of rss feeds and return relevant results to a database. The script has worked well for a couple of years, despite having very crude...
6
Markus
by: Markus | last post by:
Things to discuss: Headers What are they? What does PHP have to do with headers? Why can they only be sent before any output? Common causes
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.