Relative Path for CGI script

F

fromero

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.
 
B

Brian McCauley

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.
 
R

robic0

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....
 
R

robic0

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top