Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: PERL-CGI on shared unix server

by taint (Chaplain)
on Jun 22, 2018 at 19:51 UTC ( [id://1217253]=note: print w/replies, xml ) Need Help??


in reply to PERL-CGI on shared unix server

Greetings, rahu_6697, and welcome to Perl(monks). :-)

Your question is somewhat vague, as to exact needs. But then again, Perl is new to you. So you get a pass this time. ;-)

If I had to guess; I'd say you're looking to discover how to run/execute Perl scripts on your hosted web/internet account, and how to print (produce) Perl/CGI driven web pages. That's a pretty large topic to cover in a single reply on Perl Monks. But using your provided example in the OP; I might suggest using the feature/say . It's a bit like Heredoc ( Here Document ). Here's my version using Feature say:

#!/usr/local/bin/perl -w use strict; use feature qw(say); print "content-type:text/html; charset=utf-8\n\n"; say qq~<!DOCTYPE html> <html lang="en"><head> <title>Hello, world!</title> </head><body> <h1>Hello, world!</h1> </body></html>~;
As you can see, it's quite a bit simpler. While I'd have generally dumped all the commonly used stuff into a sub, of even made, or used an existing module that already provided that. All of that strays from your question. So I'll refrain from digression. :-)

Secondly; you'll need to know where your hosing provider puts Perl for it's users. So you can use the right "shebang, or just "bang". That refers to the first line:#!/usr/local/bin/perl . Generally speaking, and as you noted you're on a *NIX platform. Your choices are either in /usr/bin/perl , or /usr/local/bin/perl. You can best determine that by way of which , or whereis . A couple of *NIX commands that tell you -- if you haven't already guessed; where stuff is. :-). So here's an example session:

# which perl /usr/local/bin/perl
or
# whereis perl perl: /usr/local/bin/perl /usr/local/lib/perl5/5.26/perl/man/man1/perl +.1.gz /usr/src/contrib/file/magic/Magdir/perl
As you can see, the output is different; the command whereis being quite a bit more informative. :-)

Lastly. You'll need/want to know where your hosting provider allows you to execute Perl scripts. This information should have been provided in the TOS (Terms of Service) you were required to agree to, when you signed up. Or it might also be in a FAQ (Frequently Asked Questions) they have on their site.

Well, I think that probably covers it.
HTH

--Chris

Evil is good, for without it, Good would have no value
¡λɐp ʇɑəɹ⅁ ɐ əʌɐɥ puɐ ʻꜱdləɥ ꜱᴉɥʇ ədoH

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-04-19 16:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found