Solved

Run file.HTML rather than use prints

Posted on 1998-11-10
14
191 Views
Last Modified: 2010-03-04
Hi,

I want my perl program to run and HTML document instead of generating it with prints.  This makes my HTML easier to maintain and test independently.  

Thanks
Anna
0
Comment
Question by:akeller
  • 5
  • 4
  • 3
  • +1
14 Comments
 
LVL 1

Expert Comment

by:Bonger
ID: 1206123
I am not sure from your above description what it is you want to do?  Can you try wording your request more clearly?

Thanks,
Bonger
0
 
LVL 84

Expert Comment

by:ozo
ID: 1206124
what do you mean by run, and why don't you want to use prints?

Can you just point your browser at file.HTML rather than at your perl program?

Or you can make your perl program tell your browser to do that by using a print like:

print "Location: file.HTML\r\n\r\n";

or you could print the HTML document with

open(HTML."<file.HTML") or print "Content-type: text/plain\n\nCan't open file.HTML:$!\n";
while( <HTML> ){ print }

0
 
LVL 1

Expert Comment

by:flivauda
ID: 1206125
if you want your perl to output html but dont want to escape everything you can use the << operator like this:

print <<END_OF_PRINT;
<html>
This is my html code, I can have "quotes" without "escaping" them

it is very exciting
</html>
END_OF_PRINT

You have to make sure whatever term you put after the print <<{TERM}; is on a line byitself when yuo want to finish it
0
 
LVL 84

Expert Comment

by:ozo
ID: 1206126
 #It may be safer to use
  print <<'END_OF_PRINT';
so you can have $ or @ or \ without escaping them
END_OF_PRINT

0
 

Author Comment

by:akeller
ID: 1206127
I have one programmer than maintains the CGIs that interface witht he oracle database and one programmer that maintains my HMTL.  The two can be maintaining their code independently/at-the-same-time if the CGI programmer can just run the HTML instead of generating it in the CGI.  You've given me so many great answers, but which one is the best for this situation?


More Details on my situation:
Programmer 1 :  Maintains CGI (Connect to oracle)
Uses information in forms to
(1)  Connect to oracle using data (UID/PWD) from
HTML for running CGI -  authenticate user.
This solution I want the HTML separate from CGI
(2)  Submit SQL SELECT to oracle using data from
HTML  - parse form info to create Inquiry.
This solution I want the HTML separate from the CGI
(3)  Create HTML table for SQL SELECT Feedback -
Inquiry Results.  This solution I would generate HTML in my CGI
with the recommend << and >>.

Programmer 2:   Maintains HTML (Presentation to Site Visitor)
that Collects information in forms (Login and Report Criteria).

0
 

Author Comment

by:akeller
ID: 1206128
Points uped because you are being so patient.
0
 
LVL 84

Expert Comment

by:ozo
ID: 1206129
I'm still not sure I understand.
It sounds like the user accesses the URL of programmer 2's HTML
which has links to the URL of progrmmer 1's CGI
When does the perl program need to "run and HTML document"?
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 1

Expert Comment

by:flivauda
ID: 1206130
I think ozo should get the points for this one.  If you use his code you can have one guy write the html as long as he leaves it in the same spot and you can have your cgi guy read it in
0
 

Author Comment

by:akeller
ID: 1206131
flivauda, your analysis of the question and the answer is off base.

The solution provided makes two verions of the source.  The question was how to call/run a ?.html document so I don't need the code in the cgi?  I already knew about the print and <<>> alternatives so I would be paying the points for an answer I already knew and a question I did not ask.  The HTML must be external and called.  I'm still waiting for an expert who knows how to do that
0
 
LVL 1

Expert Comment

by:flivauda
ID: 1206132
Ozo answered this.  You just the cgi to open the html file and read each line and output it, so you can modify your cgi anyway you want and modify the html file seperately and it will work.

If you are needing to change part of the html with something based on the cgi you can do text switching.  BUt if all it has to do is display a new html page ozo code will do it
0
 
LVL 1

Expert Comment

by:Bonger
ID: 1206133
One thing you might also want to consider,
(NB:  I 'still' don't know exactly what the question is, but...)

If you want to get rid of CGI scripts and you make use of server software (such as Apache, etc.), you can install server extensions that allow you to embed CGI-like code in the HTML script.  The server will them perform these CGI functions on the fly at run time.

Hope this is helpful,
Bonger
0
 

Author Comment

by:akeller
ID: 1206134
flivauda please lock for grading.  Thanks Anna.  
0
 
LVL 1

Accepted Solution

by:
flivauda earned 60 total points
ID: 1206135
locking for grading
0
 

Author Comment

by:akeller
ID: 1206136
Thanks
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now