+ Reply to Thread
Results 1 to 2 of 2

Thread: Running and debugging a perl script
      
   

  1. #1
    JeremyJGreen is offline Private First Class
    Join Date
    May 2008
    Posts
    8

    Exclamation 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
    http://koolinavacationvillas.com

  2. #2
    JeremyJGreen is offline Private First Class
    Join Date
    May 2008
    Posts
    8

    Smile 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
    http://koolinavacationvillas.com

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49