Page 1 of 1

Perl path?

Posted: Tue 21 Dec 2010 10:38
by David Cooke
The CCCC Webmaster wrote:Hi,

I was wanting to add some perl scripts to our "thecccc" page. I've looked though the documentation I could find, but I didn't manage to find the perl path for the server. Could you let me know what it is?

Thanks,
Christine

Posted: Tue 21 Dec 2010 10:39
by David Cooke
Hi Christine,

it is /usr/bin/perl

However, I created a quick perl script to check all is OK and it failed!

I could easily have overlooked something OR there is a problem with the
server's support for perl.

I think it is unlikely you're the first site to use perl, however if you continue
to get un-explained problems let me know and I'll investigate more.

Posted: Wed 22 Dec 2010 19:26
by David Cooke
Perl works fine. I spent a little more time and spotted a permission error I had made. :oops:

I found a useful guide to getting your first Perl script to run. See Running 'Hello World' as a CGI Script

Posted: Wed 20 Jul 2011 12:34
by cdonica
Thanks David, it worked :)

Now I've got another (related) issue. When I run a perl script, how can I find files in our thecccc.org.uk space? The perl script seems to actually execute in /usr/bin/perl, and I can't find my way back to a text file that's in the space we control.

Thanks,
Christine

Posted: Wed 03 Aug 2011 13:54
by David Cooke
Hi Christine,

I'm not a perl programmer but that sound plausible.

Use 'getcwd' to confirm you current working directory. See http://perldoc.perl.org/Cwd.html

Use 'chdir' to move to a different directory. See http://perldoc.perl.org/functions/chdir.html

Note there are two possible paths to the same location and I'm not sure which the above will use. You'll have to experiment.

The first is relative to the servers root directory and the other is relative to the start of your webspace.

Posted: Wed 03 Aug 2011 15:06
by cdonica
Thanks for the reply :)

I did dir/ls the current working directory:
(http://thecccc.org.uk/hello3.pl)

c:/inetpub/wwwroot

.
..
iisstart.htm
images
pagerror.gif
postinfo.html
_private
_vti_cnf
_vti_inf.html
_vti_log
_vti_pvt
_vti_script
_vti_txt


But I don't recognize the structure. So, the question is, what root directory do the cccc files live in?

Christine

Posted: Wed 03 Aug 2011 18:18
by David Cooke
OK, having played with it for a bit I've come to the conclusion there is something weird going on in FastHosts setup. It does not seem to be standard - no surprise there!

The quickest route to a solution might be to transfer your site to our Linux server - at some point I need to do this anyway since we will be turning off the windows server.

Would that be OK?

Also see http://british-caving.org.uk/wiki/doku. ... g_transfer for more info about transferring.

Posted: Wed 03 Aug 2011 18:27
by David Cooke
This is FastHosts answer: http://www.fasthosts.co.uk/knowledge-ba ... icle_id=86

This code will return that:

Code: Select all

$webroot = substr ($ENV{'PATH_TRANSLATED'}, 0, length
($ENV{'PATH_TRANSLATED'}) - (length
($ENV{'PATH_INFO'})+(length("htdocs"))));

print $webroot;

Posted: Wed 03 Aug 2011 18:53
by cdonica
Not a problem, I was a bit surprised when I saw the c:/... :)

I'll be on holiday for the next 6 days, and I don't have a current backup. Other than that, I don't think it should cause us any issues.

Thanks,
Chris

Posted: Wed 03 Aug 2011 18:55
by cdonica
Thanks Dave,

I can try that code out. Also not a problem to move the site sometime.

c