Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 238
  • Last Modified:

Run file.HTML rather than use prints

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
akeller
Asked:
akeller
  • 5
  • 4
  • 3
  • +1
1 Solution
 
BongerCommented:
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
 
ozoCommented:
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
 
flivaudaCommented:
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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

0
 
akellerAuthor Commented:
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
 
akellerAuthor Commented:
Points uped because you are being so patient.
0
 
ozoCommented:
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
 
flivaudaCommented:
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
 
akellerAuthor Commented:
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
 
flivaudaCommented:
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
 
BongerCommented:
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
 
akellerAuthor Commented:
flivauda please lock for grading.  Thanks Anna.  
0
 
flivaudaCommented:
locking for grading
0
 
akellerAuthor Commented:
Thanks
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 5
  • 4
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now