Welcome to WebmasterWorld Guest from 54.167.29.212

Forum Moderators: coopster & jatar k & phranque

Message Too Old, No Replies

New perl installation - noob help

how to set your default folder

     

Matthew1980

6:47 pm on Jul 23, 2010 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



Hi there people of WebmasterWorld,

I have successfully got a .cgi file to print "IT WORKS" from my test file after some reading & tweaking of the httpd.conf file for Apache, the only thing is, Apache I notice has it's own cgi-bin folder.

My own installation functions so does this matter that I am not in the cgi-bin folder & when I do try to use the cgi-bin folder via "localhost/cgi-bin/test.cgi" it always says cannot find file. But outside of this folder & in the www directory (Wamp installation) the file functions fine :)

I'm just wondering if this matter particularly, because *technically* the perl installation works fine, just not in the directory I expected.

I have this line uncommented in httpd.conf:-

ScriptAlias /cgi-bin/ "C:/wamp/bin/apache/Apache2.2.11/cgi-bin/"


and if I use the h t t p://localhost/cgi-bin/test.cgi it doesn't work

but

h t t p://localhost/cgi_test/test.cgi it does!

So far as I am concerned I have succeeded the install, and shall now try to write a few basic things, but I also wonder - can you use perl in the same way as you do asp/php, IE: file extension tells the server that you have got asp/php content and that invokes the asp/php parser so you can write html then break into php when you need to, or is this language a different beast, and you can't use it in the same way as asp/php. Because I would like to see if I can produce the same thing in perl as I can in php.

Thank you for any pointers,

Cheers,
MRb

chorny

11:39 pm on Jul 23, 2010 (gmt 0)

5+ Year Member


Using "cgi-bin" style directories is safer, but of course, you can.

Globally:
AddHandler cgi-script .cgi .pl

For directory:
Options +ExecCGI

Matthew1980

7:22 am on Jul 24, 2010 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



Hi there Chorny,

I agree! The tutorial that I followed was pretty detailed, and now since I added the + to the ExecCGI, and .pl to the AddHandler, the page does now display with either file type extension (.pl or .cgi) which is better than last night!

But, I still get error 500 internal server error when I check the logs for accessing the "CGI-BIN" folder in the Apache directory:-
h t t p://localhost/cgi-bin/hello.cgi
(left path structure intact as nothing revealing in path)

[client 127.0.0.1] (OS 5)Access is denied. : couldn't spawn child process: C:/wamp/bin/apache/Apache2.2.11/cgi-bin/hello.cgi

So now I would just like to see if I can get the "test" file to function both in the "CGI-BIN" folder and out of it (if that's possible) then I can start trying some code out :)

Thanks for the assistance,

Cheers,
MRb

phranque

1:37 pm on Jul 24, 2010 (gmt 0)

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



do you have the

AddHandler cgi-script .cgi .pl

or

Options +ExecCGI

directives in directory context or any other limited context or do they apply globally?

Matthew1980

6:46 pm on Jul 26, 2010 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



Hi there Phrangue,

I have both of those directives in the httpd.conf file, which at present results in the aforementioned error being placed in the error log.

I'm unsure what you mean by globally (or even how to set that as global), could you elaborate on that please.

Thanks for the continued assistance,

Cheers,
MRb

phranque

11:22 pm on Jul 26, 2010 (gmt 0)

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



are these directives specified within any Configuration Section Containers [httpd.apache.org]?

for example the AddHandler Directive [httpd.apache.org] may be specified within virtual host or directory contexts.

Matthew1980

7:56 pm on Jul 27, 2010 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



Hi all,

UPDATE! a Spellink eror on my part was to blame! I had put ExeCGI and not ExecCGI, it now seems to work, and my Perl book from O'Reilly has arrived, Woo!

I'm just wondering though, can you embed perl like you can with php? I have read that there are modules that you can install, but it seems rather complicated to me? Any pointers would be great.

Thank you for the help.

Cheers,
MRb

chorny

12:59 pm on Jul 28, 2010 (gmt 0)

5+ Year Member


What do you mean by "embed"? Inside HTML? You can, but it is considered very bad practice - only PHP programmers seriously use this. Check Template Toolkit for good code.

Matthew1980

8:27 pm on Jul 28, 2010 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



Hi there chorny,

Well, meaning something like this:-


<title>
<?perl print $title;?>
</title>

I have googled Template Toolkit, and the server is down :(

I'm totally new to this & it's just something I am trying out for work, because this is going to be the framework for an intranet that I am trying out - if I can't work it out, I shall write it in php, and use perl as and where I can (up to the scope of my ability of course) and see how I get on from that.

Cheers,
MRb

chorny

9:18 am on Jul 29, 2010 (gmt 0)

5+ Year Member



To install Template Toolkit [search.cpan.org] do `install Template` in CPAN client. It is best option. If you want to use bad style, you can try HTML::Mason - OO solution for templates, or Embperl (which requires mod_perl) or search on CPAN for yourself [search.cpan.org]. Template Toolkit also allows using bad style, but it requires enabling it in options.

Matthew1980

9:51 am on Jul 29, 2010 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



Hi there Chorny,

Thanks for the advice, I shall have a play with the suggestions and see what I come up with.

Cheers,
MRb
 

Featured Threads

Hot Threads This Week

Hot Threads This Month