The British Caving Association

Any views expressed are not necessarily those of the BCA
It is currently Sun 21 Sep 2014 19:09

All times are UTC [ DST ]




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: Perl path?
PostPosted: Tue 21 Dec 2010 10:38 
Offline
Site Admin

Joined: Thu 29 Dec 2005 23:22
Posts: 247
Location: Axbridge, Somerset, UK
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

_________________
Dave Cooke
BCA Web Services, Hidden Earth Treasurer, National Cave Registry Co-ordinator, CSCC Webmaster


Top
 Profile  
 
 Post subject:
PostPosted: Tue 21 Dec 2010 10:39 
Offline
Site Admin

Joined: Thu 29 Dec 2005 23:22
Posts: 247
Location: Axbridge, Somerset, UK
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.

_________________
Dave Cooke
BCA Web Services, Hidden Earth Treasurer, National Cave Registry Co-ordinator, CSCC Webmaster


Top
 Profile  
 
 Post subject:
PostPosted: Wed 22 Dec 2010 19:26 
Offline
Site Admin

Joined: Thu 29 Dec 2005 23:22
Posts: 247
Location: Axbridge, Somerset, UK
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

_________________
Dave Cooke
BCA Web Services, Hidden Earth Treasurer, National Cave Registry Co-ordinator, CSCC Webmaster


Top
 Profile  
 
 Post subject:
PostPosted: Wed 20 Jul 2011 12:34 
Offline

Joined: Tue 21 Dec 2010 15:25
Posts: 5
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


Top
 Profile  
 
 Post subject:
PostPosted: Wed 03 Aug 2011 13:54 
Offline
Site Admin

Joined: Thu 29 Dec 2005 23:22
Posts: 247
Location: Axbridge, Somerset, UK
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.

_________________
Dave Cooke
BCA Web Services, Hidden Earth Treasurer, National Cave Registry Co-ordinator, CSCC Webmaster


Top
 Profile  
 
 Post subject:
PostPosted: Wed 03 Aug 2011 15:06 
Offline

Joined: Tue 21 Dec 2010 15:25
Posts: 5
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


Top
 Profile  
 
 Post subject:
PostPosted: Wed 03 Aug 2011 18:18 
Offline
Site Admin

Joined: Thu 29 Dec 2005 23:22
Posts: 247
Location: Axbridge, Somerset, UK
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.php?id=hosting_transfer for more info about transferring.

_________________
Dave Cooke
BCA Web Services, Hidden Earth Treasurer, National Cave Registry Co-ordinator, CSCC Webmaster


Top
 Profile  
 
 Post subject:
PostPosted: Wed 03 Aug 2011 18:27 
Offline
Site Admin

Joined: Thu 29 Dec 2005 23:22
Posts: 247
Location: Axbridge, Somerset, UK
This is FastHosts answer: http://www.fasthosts.co.uk/knowledge-base/?article_id=86

This code will return that:

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

print $webroot;

_________________
Dave Cooke
BCA Web Services, Hidden Earth Treasurer, National Cave Registry Co-ordinator, CSCC Webmaster


Last edited by David Cooke on Wed 03 Aug 2011 19:08, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Wed 03 Aug 2011 18:53 
Offline

Joined: Tue 21 Dec 2010 15:25
Posts: 5
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


Top
 Profile  
 
 Post subject:
PostPosted: Wed 03 Aug 2011 18:55 
Offline

Joined: Tue 21 Dec 2010 15:25
Posts: 5
Thanks Dave,

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

c


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Yahoo [Bot] and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group