The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Re:How to go to /usr/bin/perl

Discussion in 'General Discussion' started by phpserver, Nov 5, 2008.

  1. phpserver

    phpserver Registered

    Joined:
    Nov 2, 2008
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Eastleigh,Nairobi
    I want to find my way to /usr/bin/perl.How do i do it?
     
  2. apscinsspl

    apscinsspl Well-Known Member

    Joined:
    Mar 15, 2008
    Messages:
    112
    Likes Received:
    0
    Trophy Points:
    16
    Hello,

    That is path to perl in which perl is installed. You do not need to access it.

    When writing any perl script, it should start with

    #!/usr/bin/perl

    and the perl script needs to be under the cg-bin folder of your domain
     
  3. stdout

    stdout Well-Known Member

    Joined:
    Apr 10, 2003
    Messages:
    189
    Likes Received:
    5
    Trophy Points:
    18
    Location:
    Nelspruit, Mpumalanga, South Africa
    cPanel Access Level:
    Root Administrator
    Just a small elaboration:

    You can use perl via CLI (command line interface) using the flag, "-e".
    ie. perl -e 'print "hello world! i am ".`whoami`."\n";'

    If you want to use it in a web-accessible script (CGI), you'll need to rename the script's extension to .cgi and add the first line - #!/usr/bin/perl - If your *CGI script is printing to `stdout`(cheap pun) - be sure that you're printing "content-type: text/html\n\n"; before anything else.

    Renaming the extension to .cgi triggers the Apache handler/mime type and Apache then knows to treat the script as Perl/CGI - the same concept goes for .php, .txt, .html, .shtml, ect.
     
Loading...

Share This Page