Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Output web page with Padre ... How ?

by davido (Archbishop)
on Apr 20, 2014 at 16:16 UTC ( #1082951=note: print w/ replies, xml ) Need Help??


in reply to Output web page with Padre ... How ?

Padre isn't a webserver, and doesn't establish some internal server/browser relationship. If you run code in Padre, even if it's code that generates HTML, you're just going to see plain text output, marked up with HTML tags in this case. The same goes for running a CGI script from the command line.

Apache is a webserver. If properly configured, it can execute CGI scripts when a browser requests the correct URL. It then sends the raw output (much like what you see when you run a CGI script from the command line) to the client browser, and the browser, comprehending the HTML and CSS markup, renders it as a pretty web page.

The normal workflow for developing a CGI script would be to write some code, run it from the command line, possibly including the query string on the command line (CGI allows this), observing the output. And then once that's working, hit the correct URL (hopefully just internally reachable for now) with your local browser. Assuming Apache is configured to run the script, and assuming the script creates valid output for CGI, you'll see the webpage you want. This is an iterative process; back to the editor, on to the command line to preview, and then on to the browser to verify and see what needs tweaking.

A more advanced (and better) workflow would also have tests written that use a user agent to hit the web page and verify things are working right. With well written and well thought-out tests, the iterative process tends to go faster, and have fewer surprises.


Dave


Comment on Re: Output web page with Padre ... How ?
Re^2: Output web page with Padre ... How ?
by dofski (Initiate) on Apr 21, 2014 at 20:53 UTC

    Thank-you for clarification and advice. I now understand the significance of Padre not being a web server. I am now doing I think what you say. I use Padre to check the code initially. Then I run the .pl program from the browser. </pl>

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1082951]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2014-12-27 03:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (176 votes), past polls