Announcement

Collapse
No announcement yet.

Running and debugging a perl script

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Running and debugging a perl script

    Hi, could someone please help me out with a perl script.

    My final intent is to run an automated script that cleans up MySQL, but I am having difficulties even executing a simple script.

    My idea was to make a perl script that simply writes "Hello world".

    The script is at: http://www.koolinavacationvillas.com/test.pl

    Permissions are set to 755 and the script is in the public_html directory.

    I was expecting to see some text back when I click on the above script, but I get an error 500.

    I suspect this is to do with the way that I am trying to run the script, but really am not sure. Any help would be appreciated!

    Code:
    !/usr/bin/perl
     
    BEGIN {
        my $homedir = ( getpwuid($>) )[7];
        my @user_include;
        foreach my $path (@INC) {
            if ( -d $homedir . '/perl' . $path ) {
                push @user_include, $homedir . '/perl' . $path;
            }
        }
        unshift @INC, @user_include;
    }
     
    print "<HTML><BODY>Hello word</BODY></HTML>";
    Regards,
    Jeremy Green

  • #2
    Re: Running and debugging a perl script

    I think I have answered my own question, but this may be useful for others. The first line returned must be the content type, or the web server will thrown an internal error. Adding this above the BEGIN fixes the problem:

    Code:
    print "Content-type: text/html\n\n";
    Jeremy Green

    Comment

    Working...
    X