Re: Copy and past HTML into a perl script
You may want to try this: print Content-type: text/html\n\n; print EOF; html etc... /html EOF -Original Message- From: Tony Paterra[EMAIL PROTECTED] To: [EMAIL PROTECTED] Date: Fri Jul 13 10:44:56 PDT 2001 Subject: Copy and past HTML into a perl script I have a cgi script that I need to past approx 40 lines of HTML into. I was hoping I could just get away with having a print paste HTML here; and get away with that but sadly no, I get incomplete set of headers errors. Any suggestions? Thanks, Tony -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] /~_. _ | _ _ _ _ \_/|(_||| | |(_)| | _| ___ GO.com Mail Get Your Free, Private E-mail at http://mail.go.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Copy and past HTML into a perl script
Your quotes may be mismatched. Meaning that you are enclosing the entire HTML source with double quotes and you have unescaped double quotes in your HTML source. That would confuse perl. For example: print img src=image.gif; # in this line image.gif is a bareword. You should do this: print 'img src=image.gif'; # this does not interpolate variables though. or print img src='image.igf'; # this does interpolate variables. or print HTML; # this does interpolate variables if you use double quotes. img src=image.gif HTML But if you're looking for a longer term solution. Here are my suggestions: 1. Use the Template Toolkit set of modules available at: http://search.cpan.org/search?module=Template 2. Use the HTML::Template module available at: http://search.cpan.org/search?module=HTML::Template 3. Put your HTML in a separate file, open it and the print the lines as you read them. If you do one of the above then you can modify your HTML source and not worry about screwing up your code. Plus it makes your code more readable. Brad Handy --www.jack-of-all-trades.net [EMAIL PROTECTED] -Original Message- From: Tony Paterra [mailto:[EMAIL PROTECTED]] Sent: Friday, July 13, 2001 1:45 PM To: [EMAIL PROTECTED] Subject: Copy and past HTML into a perl script I have a cgi script that I need to past approx 40 lines of HTML into. I was hoping I could just get away with having a print paste HTML here; and get away with that but sadly no, I get incomplete set of headers errors. Any suggestions? Thanks, Tony -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Copy and past HTML into a perl script
Bradley, I'm not sure your second example would work. I don't think single quotes block interpolation -Original Message- From: Bradley M. Handy [mailto:[EMAIL PROTECTED]] Sent: Friday, July 13, 2001 12:56 PM To: Tony Paterra; [EMAIL PROTECTED] Subject: RE: Copy and past HTML into a perl script Your quotes may be mismatched. Meaning that you are enclosing the entire HTML source with double quotes and you have unescaped double quotes in your HTML source. That would confuse perl. For example: print img src=image.gif; # in this line image.gif is a bareword. You should do this: print 'img src=image.gif'; # this does not interpolate variables though. or print img src='image.igf'; # this does interpolate variables. or print HTML; # this does interpolate variables if you use double quotes. img src=image.gif HTML But if you're looking for a longer term solution. Here are my suggestions: 1. Use the Template Toolkit set of modules available at: http://search.cpan.org/search?module=Template 2. Use the HTML::Template module available at: http://search.cpan.org/search?module=HTML::Template 3. Put your HTML in a separate file, open it and the print the lines as you read them. If you do one of the above then you can modify your HTML source and not worry about screwing up your code. Plus it makes your code more readable. Brad Handy --www.jack-of-all-trades.net [EMAIL PROTECTED] -Original Message- From: Tony Paterra [mailto:[EMAIL PROTECTED]] Sent: Friday, July 13, 2001 1:45 PM To: [EMAIL PROTECTED] Subject: Copy and past HTML into a perl script I have a cgi script that I need to past approx 40 lines of HTML into. I was hoping I could just get away with having a print paste HTML here; and get away with that but sadly no, I get incomplete set of headers errors. Any suggestions? Thanks, Tony -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Copy and past HTML into a perl script
On Fri, 13 Jul 2001, Camilo Gonzalez wrote: I'm not sure your second example would work. I don't think single quotes block interpolation What do you mean by that? Variables do not interpolate if the string is delimited by single quotes or q(); -- Brett http://www.chapelperilous.net/btfwk/ It is the wisdom of crocodiles, that shed tears when they would devour. -- Francis Bacon -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Copy and past HTML into a perl script
Try running the following code as a test script: --- Start code #!/path/to/perl my $var = I'm interpolated; print 'This is a variable name- $var'; print \nThis is a variable value- $var \n; -- End code Your output should be: This is a variable name- $var This is a variable value- I'm interpolated Brad Handy --www.jack-of-all-trades.net [EMAIL PROTECTED] -Original Message- From: Camilo Gonzalez [mailto:[EMAIL PROTECTED]] Sent: Friday, July 13, 2001 3:25 PM To: 'Bradley M. Handy'; Tony Paterra; [EMAIL PROTECTED] Subject: RE: Copy and past HTML into a perl script Bradley, I'm not sure your second example would work. I don't think single quotes block interpolation -Original Message- From: Bradley M. Handy [mailto:[EMAIL PROTECTED]] Sent: Friday, July 13, 2001 12:56 PM To: Tony Paterra; [EMAIL PROTECTED] Subject: RE: Copy and past HTML into a perl script Your quotes may be mismatched. Meaning that you are enclosing the entire HTML source with double quotes and you have unescaped double quotes in your HTML source. That would confuse perl. For example: print img src=image.gif; # in this line image.gif is a bareword. You should do this: print 'img src=image.gif'; # this does not interpolate variables though. or print img src='image.igf'; # this does interpolate variables. or print HTML; # this does interpolate variables if you use double quotes. img src=image.gif HTML But if you're looking for a longer term solution. Here are my suggestions: 1. Use the Template Toolkit set of modules available at: http://search.cpan.org/search?module=Template 2. Use the HTML::Template module available at: http://search.cpan.org/search?module=HTML::Template 3. Put your HTML in a separate file, open it and the print the lines as you read them. If you do one of the above then you can modify your HTML source and not worry about screwing up your code. Plus it makes your code more readable. Brad Handy --www.jack-of-all-trades.net [EMAIL PROTECTED] -Original Message- From: Tony Paterra [mailto:[EMAIL PROTECTED]] Sent: Friday, July 13, 2001 1:45 PM To: [EMAIL PROTECTED] Subject: Copy and past HTML into a perl script I have a cgi script that I need to past approx 40 lines of HTML into. I was hoping I could just get away with having a print paste HTML here; and get away with that but sadly no, I get incomplete set of headers errors. Any suggestions? Thanks, Tony -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Copy and past HTML into a perl script
what about print img src=\image.gif\; ? would that piece of code work? --- Bradley M. Handy [EMAIL PROTECTED] wrote: Your quotes may be mismatched. Meaning that you are enclosing the entire HTML source with double quotes and you have unescaped double quotes in your HTML source. That would confuse perl. For example: print img src=image.gif; # in this line image.gif is a bareword. You should do this: print 'img src=image.gif'; # this does not interpolate variables though. or print img src='image.igf'; # this does interpolate variables. or print HTML; # this does interpolate variables if you use double quotes. img src=image.gif HTML But if you're looking for a longer term solution. Here are my suggestions: 1. Use the Template Toolkit set of modules available at: http://search.cpan.org/search?module=Template 2. Use the HTML::Template module available at: http://search.cpan.org/search?module=HTML::Template 3. Put your HTML in a separate file, open it and the print the lines as you read them. If you do one of the above then you can modify your HTML source and not worry about screwing up your code. Plus it makes your code more readable. Brad Handy --www.jack-of-all-trades.net [EMAIL PROTECTED] -Original Message- From: Tony Paterra [mailto:[EMAIL PROTECTED]] Sent: Friday, July 13, 2001 1:45 PM To: [EMAIL PROTECTED] Subject: Copy and past HTML into a perl script I have a cgi script that I need to past approx 40 lines of HTML into. I was hoping I could just get away with having a print paste HTML here; and get away with that but sadly no, I get incomplete set of headers errors. Any suggestions? Thanks, Tony -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail http://personal.mail.yahoo.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Copy and past HTML into a perl script
That's true, but if you have double quotes inside of single quotes, the double quotes will still interpolate. In other words, the enclosing single quotes will not block the mighty interpolative power of the enclosed double quotes. Please let me know if you believe this yo be incorrect. -Original Message- From: Brett W. McCoy [mailto:[EMAIL PROTECTED]] Sent: Friday, July 13, 2001 2:35 PM To: Camilo Gonzalez Cc: 'Bradley M. Handy'; Tony Paterra; [EMAIL PROTECTED] Subject: RE: Copy and past HTML into a perl script On Fri, 13 Jul 2001, Camilo Gonzalez wrote: I'm not sure your second example would work. I don't think single quotes block interpolation What do you mean by that? Variables do not interpolate if the string is delimited by single quotes or q(); -- Brett http://www.chapelperilous.net/btfwk/ It is the wisdom of crocodiles, that shed tears when they would devour. -- Francis Bacon -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Copy and past HTML into a perl script
I believe that to be incorrect. The outermost quotes win. Brad --www.jack-of-all-trades.net [EMAIL PROTECTED] -Original Message- From: Camilo Gonzalez [mailto:[EMAIL PROTECTED]] Sent: Friday, July 13, 2001 3:55 PM To: 'Brett W. McCoy'; Camilo Gonzalez Cc: 'Bradley M. Handy'; Tony Paterra; [EMAIL PROTECTED] Subject: RE: Copy and past HTML into a perl script That's true, but if you have double quotes inside of single quotes, the double quotes will still interpolate. In other words, the enclosing single quotes will not block the mighty interpolative power of the enclosed double quotes. Please let me know if you believe this yo be incorrect. -Original Message- From: Brett W. McCoy [mailto:[EMAIL PROTECTED]] Sent: Friday, July 13, 2001 2:35 PM To: Camilo Gonzalez Cc: 'Bradley M. Handy'; Tony Paterra; [EMAIL PROTECTED] Subject: RE: Copy and past HTML into a perl script On Fri, 13 Jul 2001, Camilo Gonzalez wrote: I'm not sure your second example would work. I don't think single quotes block interpolation What do you mean by that? Variables do not interpolate if the string is delimited by single quotes or q(); -- Brett http://www.chapelperilous.net/btfwk/ It is the wisdom of crocodiles, that shed tears when they would devour. -- Francis Bacon -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Copy and past HTML into a perl script
On Fri, 13 Jul 2001, Camilo Gonzalez wrote: That's true, but if you have double quotes inside of single quotes, the double quotes will still interpolate. In other words, the enclosing single quotes will not block the mighty interpolative power of the enclosed double quotes. Please let me know if you believe this yo be incorrect. That is incorrect. Double quotes inside of single quotes are treated as text characters, not as Perl operators. The reverse is also true -- single quotes embedded inside of a string delimited with double quotes will still interpolate: my $query = SELECT * FROM host_table WHERE hostname ='$host' and domain = '$domain'; However, this does interpolate: my $string = 'Some text', $var with more text , 'more text'; -- Brett http://www.chapelperilous.net/btfwk/ A horse breeder has his young colts bottle-fed after they're three days old. He heard that a foal and his mummy are soon parted. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Copy and past HTML into a perl script
So let's clarify this. You believe the following to be equivalent: print ( 'The rain in $Spain' ); print ( 'The rain in $Spain' ); -Original Message- From: Bradley M. Handy [mailto:[EMAIL PROTECTED]] Sent: Friday, July 13, 2001 2:58 PM To: Camilo Gonzalez; 'Brett W. McCoy' Cc: Tony Paterra; [EMAIL PROTECTED] Subject: RE: Copy and past HTML into a perl script I believe that to be incorrect. The outermost quotes win. Brad --www.jack-of-all-trades.net [EMAIL PROTECTED] -Original Message- From: Camilo Gonzalez [mailto:[EMAIL PROTECTED]] Sent: Friday, July 13, 2001 3:55 PM To: 'Brett W. McCoy'; Camilo Gonzalez Cc: 'Bradley M. Handy'; Tony Paterra; [EMAIL PROTECTED] Subject: RE: Copy and past HTML into a perl script That's true, but if you have double quotes inside of single quotes, the double quotes will still interpolate. In other words, the enclosing single quotes will not block the mighty interpolative power of the enclosed double quotes. Please let me know if you believe this yo be incorrect. -Original Message- From: Brett W. McCoy [mailto:[EMAIL PROTECTED]] Sent: Friday, July 13, 2001 2:35 PM To: Camilo Gonzalez Cc: 'Bradley M. Handy'; Tony Paterra; [EMAIL PROTECTED] Subject: RE: Copy and past HTML into a perl script On Fri, 13 Jul 2001, Camilo Gonzalez wrote: I'm not sure your second example would work. I don't think single quotes block interpolation What do you mean by that? Variables do not interpolate if the string is delimited by single quotes or q(); -- Brett http://www.chapelperilous.net/btfwk/ It is the wisdom of crocodiles, that shed tears when they would devour. -- Francis Bacon -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Copy and past HTML into a perl script
No they aren't equivalent. The first prints out - The rain in $Spain The second prints out - The rain in $Spain Does that clarify things? -Original Message- From: Camilo Gonzalez [mailto:[EMAIL PROTECTED]] Sent: Friday, July 13, 2001 4:08 PM To: 'Bradley M. Handy'; Camilo Gonzalez; 'Brett W. McCoy' Cc: Tony Paterra; [EMAIL PROTECTED] Subject: RE: Copy and past HTML into a perl script So let's clarify this. You believe the following to be equivalent: print ( 'The rain in $Spain' ); print ( 'The rain in $Spain' ); -Original Message- From: Bradley M. Handy [mailto:[EMAIL PROTECTED]] Sent: Friday, July 13, 2001 2:58 PM To: Camilo Gonzalez; 'Brett W. McCoy' Cc: Tony Paterra; [EMAIL PROTECTED] Subject: RE: Copy and past HTML into a perl script I believe that to be incorrect. The outermost quotes win. Brad --www.jack-of-all-trades.net [EMAIL PROTECTED] -Original Message- From: Camilo Gonzalez [mailto:[EMAIL PROTECTED]] Sent: Friday, July 13, 2001 3:55 PM To: 'Brett W. McCoy'; Camilo Gonzalez Cc: 'Bradley M. Handy'; Tony Paterra; [EMAIL PROTECTED] Subject: RE: Copy and past HTML into a perl script That's true, but if you have double quotes inside of single quotes, the double quotes will still interpolate. In other words, the enclosing single quotes will not block the mighty interpolative power of the enclosed double quotes. Please let me know if you believe this yo be incorrect. -Original Message- From: Brett W. McCoy [mailto:[EMAIL PROTECTED]] Sent: Friday, July 13, 2001 2:35 PM To: Camilo Gonzalez Cc: 'Bradley M. Handy'; Tony Paterra; [EMAIL PROTECTED] Subject: RE: Copy and past HTML into a perl script On Fri, 13 Jul 2001, Camilo Gonzalez wrote: I'm not sure your second example would work. I don't think single quotes block interpolation What do you mean by that? Variables do not interpolate if the string is delimited by single quotes or q(); -- Brett http://www.chapelperilous.net/btfwk/ It is the wisdom of crocodiles, that shed tears when they would devour. -- Francis Bacon -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Copy and past HTML into a perl script
Yes it does, thank you. I'm afraid I'll have to disagree with you. My Programming Perl book tells me otherwise. I still consider myself a newbie, however and welcome other comments. -Original Message- From: Bradley M. Handy [mailto:[EMAIL PROTECTED]] Sent: Friday, July 13, 2001 3:10 PM To: Camilo Gonzalez; 'Brett W. McCoy' Cc: Tony Paterra; [EMAIL PROTECTED] Subject: RE: Copy and past HTML into a perl script No they aren't equivalent. The first prints out - The rain in $Spain The second prints out - The rain in $Spain Does that clarify things? -Original Message- From: Camilo Gonzalez [mailto:[EMAIL PROTECTED]] Sent: Friday, July 13, 2001 4:08 PM To: 'Bradley M. Handy'; Camilo Gonzalez; 'Brett W. McCoy' Cc: Tony Paterra; [EMAIL PROTECTED] Subject: RE: Copy and past HTML into a perl script So let's clarify this. You believe the following to be equivalent: print ( 'The rain in $Spain' ); print ( 'The rain in $Spain' ); -Original Message- From: Bradley M. Handy [mailto:[EMAIL PROTECTED]] Sent: Friday, July 13, 2001 2:58 PM To: Camilo Gonzalez; 'Brett W. McCoy' Cc: Tony Paterra; [EMAIL PROTECTED] Subject: RE: Copy and past HTML into a perl script I believe that to be incorrect. The outermost quotes win. Brad --www.jack-of-all-trades.net [EMAIL PROTECTED] -Original Message- From: Camilo Gonzalez [mailto:[EMAIL PROTECTED]] Sent: Friday, July 13, 2001 3:55 PM To: 'Brett W. McCoy'; Camilo Gonzalez Cc: 'Bradley M. Handy'; Tony Paterra; [EMAIL PROTECTED] Subject: RE: Copy and past HTML into a perl script That's true, but if you have double quotes inside of single quotes, the double quotes will still interpolate. In other words, the enclosing single quotes will not block the mighty interpolative power of the enclosed double quotes. Please let me know if you believe this yo be incorrect. -Original Message- From: Brett W. McCoy [mailto:[EMAIL PROTECTED]] Sent: Friday, July 13, 2001 2:35 PM To: Camilo Gonzalez Cc: 'Bradley M. Handy'; Tony Paterra; [EMAIL PROTECTED] Subject: RE: Copy and past HTML into a perl script On Fri, 13 Jul 2001, Camilo Gonzalez wrote: I'm not sure your second example would work. I don't think single quotes block interpolation What do you mean by that? Variables do not interpolate if the string is delimited by single quotes or q(); -- Brett http://www.chapelperilous.net/btfwk/ It is the wisdom of crocodiles, that shed tears when they would devour. -- Francis Bacon -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Copy and past HTML into a perl script
At 03:16 PM 07/13/2001 -0500, Camilo Gonzalez wrote: Yes it does, thank you. I'm afraid I'll have to disagree with you. My Programming Perl book tells me otherwise. I still consider myself a newbie, however and welcome other comments. Don't disagree without first trying it for yourself. As several others have already mentioned... print ( 'The rain in $Spain' ); print ( 'The rain in $Spain' ); ...returns the following strings, respectively: The rain in $Spain The rain in $Spain This is on both Activestate Perl 5.6.1 on windows2000 and Perl on my Mandrake Linux box. -- mel matsuoka Hawaiian Image Productions Chief Executive Alphageek(vox)1.808.531.5474 [EMAIL PROTECTED](fax)1.808.526.4040 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Copy and past HTML into a perl script
On Fri, 13 Jul 2001, Camilo Gonzalez wrote: Yes it does, thank you. I'm afraid I'll have to disagree with you. My Programming Perl book tells me otherwise. I still consider myself a newbie, however and welcome other comments. Did you even try to run the code? We can argue about it all day, but unless you try it out, you won't see for yourself. Here's a screen capture from a test I did: bmccoy:~$ perl $spain = 5; print 'The rain in $spain'; print 'The rain in $spain'; ^D The rain in $spainThe rain in $spain Do you see 5 anywhere in the output? -- Brett http://www.chapelperilous.net/btfwk/ A paranoid is a man who knows a little of what's going on. -- William S. Burroughs -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]