in reply to Re: Can the username be represented differently ?
in thread Can the username be represented differently ?

Hi,

Thanks for your reply. It's been a few mths since I used Perl, the file is CMOD to 744 like the other perl files, I upload it in ascii, yet keep getting the old "premature end of script headers" msg. Do I need any modules to run this ?

#!/usr/bin/perl -wT $name = 'myusername'; $uid = getpwnam($name); print "$uid: $uid;


Peter

Replies are listed 'Best First'.
Re^3: Can the username be represented differently ?
by atcroft (Abbot) on Jun 28, 2004 at 05:57 UTC

    744 translate to "rwxr--r--", but if you are running it as a CGI for testing you probably need it set as 755 ("rwxr-xr-x"). Also, in such a case, you likely want to include $|=1; after the #!/usr/bin/perl -wT line. You may also want to check the webserver error log to see if there is anything else occurring.

    Hope that helps.

      The code now looks like this

      #!/usr/local/bin/perl -wT $|=1; $name = 'myusername'; $uid = getpwnam($name); print "$uid: $uid;


      but I'm still getting the 500 msg in the browser, and the web logs say "Premature end of script headers: /home/myusername/cgi-bin/getvars1.pl

      I think I had better check the forums at the hosts to see if anything has changed since last I used Perl, however I did just run FormMail.pl from the same path, it has a 744 and it worked just fine ??

      Thanks,

      Peter
        The browser output is now:

        uid: 32149

        Thanks,

        Peter