Embedding HTML in Perl script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Embedding HTML in Perl script
# 1  
Old 02-01-2011
Embedding HTML in Perl script

My webpage is hosted from perlscript(homepage.pl), i want to add piece of html code in the footer of the homepage. I simply pasted the html code at the end of the perl script as below...

========================================================

Code:
close(OUTSQL);

#+++++++++++++++++++++++++++++++++++++++++++++++++++++++#
#     Code to tag Homepage with WebSystem.        #
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++#

<SCRIPT SRC="/opt/apache/cgi-bin/new/includes.js/sdctag1.js" TYPE="text/javascript"></SCRIPT>
<SCRIPT SRC="/opt/apache/cgi-bin/new/includes.js/sdctag2.js" TYPE="text/javascript"></SCRIPT>
<NOSCRIPT><IMG ALT="" BORDER="0" NAME="DCSIMG" WIDTH="1" HEIGHT="1"
SRC="http://mypage.ric.com/dcsbun4it000000ch9k77ffc8_2t7o/njs.gif?dcsuri=/nojavascript&amp;WT.js=No&amp;WT.tv=8.0.3">
</NOSCRIPT>

exit;

# ok

==========================================================

while compiling the script i am getting following error msg.

Code:
[Tue Feb  1 13:32:32 2011] alarmmisii_web.pl: syntax error at ./homepage.pl line 6243, near "<SCRIPT SRC="/opt"
[Tue Feb  1 13:32:32 2011] homepage.pl: Execution of ./homepage.pl aborted due to compilation errors.


Last edited by pludi; 02-01-2011 at 09:36 AM.. Reason: code tags, please...
# 2  
Old 02-01-2011
Perl ain't PHP, and even with PHP that wouldn't work.

You have to print the HTML part, eg
Code:
print << FOOTER;
<!-- Your footer stuff here -->
FOOTER

# 3  
Old 02-01-2011
I put code like below.

=============================================================
Code:
close(OUTSQL);

#+++++++++++++++++++++++++++++++++++++++++++++++++++++++#
#     Code to tag AlarmMIS into Webtrend System.        #
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++#

print << FOOTER;
<SCRIPT SRC="/opt/apache/cgi-bin/new/includes.js/sdctag1.js" TYPE="text/javascript"></SCRIPT>
<SCRIPT SRC="/opt/apache/cgi-bin/new/includes.js/sdctag2.js" TYPE="text/javascript"></SCRIPT>
<NOSCRIPT><IMG ALT="" BORDER="0" NAME="DCSIMG" WIDTH="1" HEIGHT="1"
SRC="http://mypage.ric.com/dcsbun4it000000ch9k77ffc8_2t7o/njs.gif?dcsuri=/nojavascript&amp;WT.js=No&amp;WT.tv=8.0.3">
</NOSCRIPT>
FOOTER

exit;

# ok

====================================================

Getting following compilation error.
Code:
[Tue Feb  1 14:01:21 2011] homepage.pl: syntax error at ./homepage.pl line 6247, near "FOOTER"
[Tue Feb  1 14:01:21 2011] homepage.pl: BEGIN not safe after errors--compilation aborted at ./homepage.pl line 6248.


Last edited by pludi; 02-01-2011 at 10:07 AM.. Reason: code tags, please...
# 4  
Old 02-01-2011
Sorry, my bad. Should be
Code:
print <<FOOTER;

(No space between the brackets and the keyword)
# 5  
Old 02-02-2011
Thanks Pludi, its working fine.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Writing an HTML file in perl

I'm writing a perl script that writes an html file. use Tie::File; my ($dir) = @ARGV; open (HTML,">","$dir/file.html") || die $!; #-----Building HTML file--------------------------- print HTML "<!DOCTYPE html> <html> <head> <title>Output</title> <link... (3 Replies)
Discussion started by: jrymer
3 Replies

2. Shell Programming and Scripting

Perl : embedding java script with cgi perl script

Hi All, I am aware that html tags can be embedded in cgi script as below.. In the same way is it possible to embed the below javascript in perl cgi script ?? print("<form action="action.htm" method="post" onSubmit="return submitForm(this.Submitbutton)">"); print("<input type = "text"... (1 Reply)
Discussion started by: scriptscript
1 Replies

3. Shell Programming and Scripting

editing single line in html file in perl script

Hi Folks, It is regarding the perl scripting. I have an html file(many files) which contains the below line in the body tag. <body> <P><STRONG><FONT face="comic sans ms,cursive,sans-serif"><EM>Hello</EM></FONT></STRONG></P> </body> Now I want to read that html file through perl... (3 Replies)
Discussion started by: giridhar276
3 Replies

4. Shell Programming and Scripting

Need help embedding Unix commands in a shell script

Hi Folks, I have a text file which may or may not have any data. I would like to email the file, via a Korn shell script, if the file is not empty. I am fiddling around with the wc -l command, but no luck so far. The pseudo code is as follows count=`wc -l test.txt` if cat test.txt... (4 Replies)
Discussion started by: rogers42
4 Replies

5. UNIX Desktop Questions & Answers

Embedding file output into a script

Hello. I found a Unix script on this site that calculates a date that is 2 months earlier from today. I'm using that script and writing the value to a file called 2monthsago.txt. I want to use that value in another script. Below is my attempt at doing that and the results. My Script: ... (1 Reply)
Discussion started by: Colel2
1 Replies

6. Shell Programming and Scripting

Perl + Korn + HTML

I have a perl script that prints up the html code and executes a few korn scripts to populate the web code. Disclaimer === I can throw together some korn scripts pretty quick. This code changes pretty frequently. I don't know enough about perl to do everything I need. One day maybe I'll get... (4 Replies)
Discussion started by: i9300
4 Replies

7. Shell Programming and Scripting

Embedding Perl construct in ksh...

Hi, I have an embedded Perl construct in a korn script. However, I cannot seem to access the shell variables that were declared outside this Perl section. This is how my script is written....I have also tried back-ticks where I assign the shell variable to my local perl variable, still... (1 Reply)
Discussion started by: svetlur
1 Replies

8. Shell Programming and Scripting

HTML parsing by PERL

i have a HTML report file..its in attachment(a part of the whole report is attached..name "input html.doc").also its source is attached in "report source code.txt" i just want to seperate the datas like in first line it should be.. NHTEST-3848498958-NHTEST-10.2-no-baloo a and so on for whole... (3 Replies)
Discussion started by: avik1983
3 Replies

9. Shell Programming and Scripting

perl and html

hi. im very new to perl. is it possible to fill up a web form and submit it using perl? example, i would like to sign up for a yahoo account though a perl script (ofcourse, granting the "type the characters as shown in imgage" is absent)? (8 Replies)
Discussion started by: marcpascual
8 Replies

10. Shell Programming and Scripting

Perl: Variable input via HTML

I am completely new to perl and am just going over the tutorials right now. What I am trying to attempt is to take the input from the HTML (in a form) and use those variables in a perl script. I've looked everywhere for a simple example on how to do this and cannot find it or do not understand... (5 Replies)
Discussion started by: douknownam
5 Replies
Login or Register to Ask a Question