Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Relative Path for CGI script

Reply
Thread Tools

Relative Path for CGI script

 
 
fromero@csudh.edu
Guest
Posts: n/a
 
      03-24-2005
I have several web links which are absolute paths for the cgi scripts,
e.g. http://whovian.com/cgi-bin/algebra.cgi. How can I write a web
links which are not absolute but relative. I would like to use the
same scripts and web page on another server, but not rewrite the links.

 
Reply With Quote
 
 
 
 
Brian McCauley
Guest
Posts: n/a
 
      03-24-2005
wrote:

> I have several web links which are absolute paths for the cgi scripts,
> e.g. http://whovian.com/cgi-bin/algebra.cgi. How can I write a web
> links which are not absolute but relative. I would like to use the
> same scripts and web page on another server, but not rewrite the links.


It is completely unclear what you are asking but is is clear that your
question has nothing whatever to do with Perl.

You appear to be asking how to write a relative URL.

If you have a page with a URL

http://www.example.com/this/that/other/page.html

And you want to link to

http://www.example.com/this/here/script.cgi

Then you can use a relative link '../../here/script.cgi' or
'/this/here/script.cgi'.

For details read documents about URLs.

 
Reply With Quote
 
 
 
 
robic0@yahoo.com
Guest
Posts: n/a
 
      03-25-2005
Write a simple perl program that uses an html parser (unless its
asp..et all, which you could design a custom parse).
A few regx and your good to go. You could even make templates, sort of
like mail-merge then pass in where you want
it (via cmdline or config) then write out your custom page....

 
Reply With Quote
 
robic0@yahoo.com
Guest
Posts: n/a
 
      03-25-2005
The mail-merge would do nice, make a template "html_yourfile" or
anything text,
the template contains:

..... http://www.example.com/<Tag_Dir_Mine_Path1>/script.cgi .....

just replace all <Tag_Dir_Mine_Path1> with whats passed in from cmdline
or set up a config.ini with machine names
and how you want its paths setup:

[Machine-1]
Tag_Dir_Mine_Path1 = ../dir
Source_Out = //machine1/webroot

[Machine-2]
Tag_Dir_Mine_Path1 = ../dir
Source_Out = //machine2/webroot

etc ...

c:\> perl prog.pl /c:config.ini:ALL

or

c:\>perl prog.pl ../dir //machine1/webroot

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
FileUpload control doesn't work (fail in client side early stages) when path is relative i.e "\\path.." Oren ASP .Net 1 04-29-2007 04:20 PM
what's wrong calling a Perl/CGI script in Perl/CGI script under Tomcat server? kath Perl Misc 4 04-09-2007 09:21 PM
How do I convert an absolute path into a relative path Nigel Wilkinson Ruby 2 07-25-2005 07:37 PM
absolute path versus relative path in JSP Matt Java 3 07-08-2004 08:31 PM
Make a relative url path from an absolute path to another one Thomas Guettler Python 3 10-27-2003 04:41 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57