CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Re: 69_vette's post

 



japhy
Enthusiast

Jan 26, 2000, 3:27 PM

Post #1 of 9 (1206 views)
Re: 69_vette's post Can't Post

At first glance, nothing is wrong. Make sure the file is chmodded correctly, etc.

Try your code at the command-prompt, and you might find an error in your here-doc if you wrote it incorrectly.

I've written documentation on here-docs, and I'll have one of them included in the docs for Perl 5.6. One is a technical definition of here-docs, and the other is text from an email I wrote regarding sample uses of here-docs.

My Perl web site will have all the documentation and examples I refer to in this forum.


69_vette
Deleted

Jan 27, 2000, 3:53 AM

Post #2 of 9 (1206 views)
Re: Re: 69_vette's post [In reply to] Can't Post

Ya, it's chmodded correctly.

After reading your articles I first thought the problem was because the closing identifier was at the end of the script...

But I put something after that at it still didn't work...

I don't know what else could be wrong...


Borderline
Deleted

Jan 27, 2000, 4:10 AM

Post #3 of 9 (1206 views)
Re: Re: 69_vette's post [In reply to] Can't Post

Did you run it at the command-prompt like Japhy said? If so what was the output?

Also if there is even a single space after the closing identifier it will not work.

Scott


69_vette
Deleted

Jan 27, 2000, 5:53 AM

Post #4 of 9 (1206 views)
Re: Re: 69_vette's post [In reply to] Can't Post

There's no spaces after the closing identifier...

And no, I didn't run it at the command-prompt because I don't know how...

Of course, you mean telnet, right?

Well I guess my copy of telnet is screwed up or I'm going about it COMPLETELY wrong because I can't get it to do anything...


69_vette
Deleted

Jan 27, 2000, 7:06 AM

Post #5 of 9 (1206 views)
Re: Re: 69_vette's post [In reply to] Can't Post

WELL SHOOT!!!

If I change my the text/html part of my content type header to text-html IT WORKS!!!

The only reason I tried that was because Japhy's "sample uses" page used - once instead of / .....

Is there a difference between using the two or is it just another way?

[This message has been edited by 69_vette (edited 01-27-2000).]


69_vette
Deleted

Jan 27, 2000, 7:20 AM

Post #6 of 9 (1206 views)
Re: Re: 69_vette's post [In reply to] Can't Post

Aaaawwwww crap!

It WAS working...

Now when I try to go to it my browser tries to download it...


japhy
Enthusiast

Jan 27, 2000, 7:42 AM

Post #7 of 9 (1206 views)
Re: Re: 69_vette's post [In reply to] Can't Post

Um, thanks for pointing out that text-html typo in the document. That WAS a typo, and is not a properly formatted MIME type.


69_vette
Deleted

Jan 27, 2000, 8:26 AM

Post #8 of 9 (1206 views)
Re: Re: 69_vette's post [In reply to] Can't Post

Alright...

I changed it back to text/html and, of course, it stopped the browser from trying to download.

Also, it script started working now.

I don't get it. It's EXACTLY the way I had it before and it just decides it's going to work now?

I must have had some little typo somewhere...

Oh well, thanks for your help!


Cure
User

Feb 1, 2000, 2:34 PM

Post #9 of 9 (1206 views)
Re: Re: 69_vette's post [In reply to] Can't Post

The reason why your getting the error is because theres a bug in activeperl for here-docs..

Dont worry 69_vette your not loosing your mind--> when you said you didnt change the code but for some reason it works now, well the same thing happen to me..

I paste your code in my editplus program and tried to perl it , I keep getting errors and After I perl the code 16 times then for some reason it started working. I've had problems with the here-docs for active-perl for the last 6 months that why I used the qq~ operator..

So when I saw your problem; I wus determined to figure out a solution for here-docs because Ive had the same problem for a while. So I tried everything to perl your code and I got the same errors and i tried using here-docs with my code. Sometimes when I perl the code it works and most of the time it didnt work and I didnt change the code--> So I concluded that there is a BUG in ActivePerl

I took my code using here-docs that wouldnt perl on my system and icq it to borderline->(he has unix(real perl)) and he said it Perl just fine..

So conclusion-> ActivePerl has a bug for here-docs. So use the qq~ operator to fix your problem

you can still use the here-docs in activeperl but you have to use it in a process..

print "Content-type: text/html\n\n";
print_header();

sub print_header {
print <<THIS;
<html>
<title>
hello
</title>
<body>
hello
</body>
</html>
THIS
}

My advice would be to use the qq~ operator(it will always work for you
example::

#!/usr/bin/perl

print "Content-type: text/html\n\n";

print qq~
<html>
<title>
hello
</title>
<body>
hello
</body>
</html>
~;


[This message has been edited by Cure (edited 02-01-2000).]

[This message has been edited by Cure (edited 02-01-2000).]

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives