Re: [MacPerl-WebCGI] need help with My first perl program
[email protected] (Detlef Lindenthal) Fri, 23 Aug 2002 21:45:45 +0200
| Newsgroups | perl.macperl.webcgi |
|---|---|
| Message-ID | <[email protected]> |
Hi Liming,
under Unix / Linux you start a Perl script by
typing
perl myScript.pl "MY LIST OF PARAMETERS" ,
where myScript.pl is the name of your script file, and
you can obtain those parameters by a perl statement:
print @ARGV; .
You can also type the following as a URL into your browser:
http://YourDomain.com/cgi-bin/myScript.pl ,
and the output will be directed to your browser.
Under Suse Linux the file
/etc/httpd/httpd.conf
has to have the lines
ScriptAlias /perl/ "/usr/local/httpd/cgi-bin/"
ScriptAlias /cgi-perl/ "/usr/local/httpd/cgi-bin/"
-- or wherever your cgi-bin folder resides.
(restart Apache after changing that "httpd.conf" file),
in order to enable the folder "cgi-bin" to execute
perl scripts from anywhere of the Internet.
And your script file has to have the right permission,
so type
chmod 755 myScript.pl .
- - - - -
The statement
chmod +x test.pl
i.m.h.o does not make sense.
nor does a statement
test.pl .
A statement
. test.pl
means: The lines of the file "test.pl"
are interpreted as UNIX statements.
But UNIX won't understand Perl statements.
Regards,
Detlef Lindenthal
liming zhao wrote:
> my current work directory is /opt/
> I can run command line> perl -e 'print "hello, I love
> perl"'
> But when I edit a file test.pl with the following
> content:
>
> #!/usr/bin/perl
> print "hello, I love perl";
>
> and execute command
> chmod +x test.pl
> but when
> I type
> test.pl and enter key
>
> it is said "no command found!"
>