Syntactic Confectionery Delight PerlMonks

### Re^2: Simple Perl print() output redirect to html/webpage.

by hmb104 (Sexton)
 on Sep 03, 2012 at 06:48 UTC ( #991366=note: print w/replies, xml ) Need Help??

Thanks for taking the time to reply bitingduck. Actually my question is about displaying my Perl output to html webpage

script.pl is on server1 and html page runs on server2. From server2 I can call my Perl script from server2 as following:

The script will display some output. I want to know how I can capture this output on test.html on server2?

server2 is a pure webserver. All my servers are Unix

Replies are listed 'Best First'.
Re^3: Simple Perl print() output redirect to html/webpage.
by Anonymous Monk on Sep 03, 2012 at 07:12 UTC

This question really isn't in Perl-land any more, but a CGI question. This CGI script should do it:

#!/bin/sh
echo "Content-Type: text/plain"
echo

[download]

I'm not sure why your php solution did not work. Maybe you wanted the passthru function?

Beware, though. If you want to embed the script's output in HTML (instead of plaintext as I did there), you need to make sure that it doesn't contain any of the following characters: <>& (and maybe '"). Instead, escape them properly. For that, the pass-through function php supplies doesn't work.

Re^3: Simple Perl print() output redirect to html/webpage.
by bitingduck (Chaplain) on Sep 03, 2012 at 15:17 UTC

Are you directing your output from the script to the right place? And are the permissions set correctly for you to be able to write there? As anon pointed out, it's not obvious why it's not working for you. When you mention user id problems with it, that suggests that it might be working fine except that you don't have write permission to the web server path from whatever user you're running the script as.

Create A New User
Node Status?
node history
Node Type: note [id://991366]
help
Chatterbox?
 [thezip]: Is there an analogy for '&' (ie. run commandline process in background) for Windows commandline? [Corion]: thezip: start "some title" path\to\that\ application, but that will open another console window [Corion]: thezip: If you want to confuse your users, use system(1, "that\\command" );, which will make Perl launch it in the background [Corion]: That will keep the console window open even though the user can't type into it anymore [thezip]: So I have a script that generates a log file. After script completion, I want tohave VIM open this logfile. [thezip]: i don't get the command line "back" until I close VIM. No what I want to happen... [thezip]: I currently don't have access to CYGWIN, else I'd just do a tail -f on the logfile.

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (11)
As of 2017-03-27 18:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
Should Pluto Get Its Planethood Back?

Results (321 votes). Check out past polls.