Perl Download Script Install Problems

apps

#1

Hello All:

I wonder can anyone help me with this:

On the bottom of www.TastyIrishRecipes.com is a link to www.TastyIrishRecipes.com/signup.htm.

In the html for sognup.htm, I have place this after :

That perl scrip is located at www.TastyIrishRecipes.com/recipes.pl and contains the following (between the asteric lines):


#! /usr/bin/perl

if (open(IN,“freetraditionalirishrecipes.pdf”)) {
if ($ENV{‘HTTP_USER_AGENT’} =~ m/netscape/ig) {
print “content-type: application/octet-stream\n”;
}
else {
print “content-type: application/force-download; name=freetraditionalirishrecipes.pdf\n”;
}
print “Content-Disposition: attachment; filename=freetraditionalirishrecipes.pdf\n\n”;
while() {
print $_;
}
close(IN);
}


freetraditionalirishrecipes.pdf is located at www.TastyIrishRecipes.com/freetraditionalirishrecipes.pdf

The idea is that, when a visitor click on /signup.htm, the PDF download will start automatically while, in the background, the signup page will open for if they want to signup to a newsletter or whatever might be there.

I’ve been tricking around with this for hours but still can’t get it to work.

I’m not very savvy with scripts (someone else wrote it for me) and I have no idea where I’m going wrong.

Can anyone see what the problem is?

Thank in advance for any help or ideas! :slight_smile:

Tommy.


#2

http://www.tastyirishrecipes.com/recipes.pl

results in an internal server error.

At least make sure recipes.pl is chmod 755.

:cool: [color=#6600CC]Atropos[/color] | openvein.org


#3

Is it as 755… so it the PDF.

I just double-checked them to make sure.

II found that, in IE, the script does try to execute but, while it appears and disapperas very quick, I’m sure something about a 500 error appears in the component bar at the bottom of the screen.

In Mozilla, it does nothing at all! :frowning:

Tommy.


#4

When a program runs it may encounter errors and report the errors. The problem with your script is that if there is an error, it will not result in a web page, and because of that, the web server is reporting the generic internal server error message. You will need to determine what error occurs and get it fixed. Put this after the #! line:

use CGI::Carp qw(fatalsToBrowser);

and remove it when you have fixed the error condition.

:cool: [color=#6600CC]Atropos[/color] | openvein.org


#5

Problem solved!

Thanks Atrophos!