?
Solved

Run file.HTML rather than use prints

Posted on 1998-11-10
14
Medium Priority
?
234 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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
 
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 240 total points
ID: 1206135
locking for grading
0
 

Author Comment

by:akeller
ID: 1206136
Thanks
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
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…
Six Sigma Control Plans

718 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