Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Alias in perl script

Status
Not open for further replies.

seanwest

Technical User
Jan 23, 2003
17
US
HI i need help figuring out what line i need to add
to my script.

its a personals script and i want it so instead of the usual search that looks like this in the browser:

i need to know how to also make a simple entry
at the top of the personals.pl script to make
"target" an alias for "keys" so i do not have to redo
the whole script. this way when i search and the
url looks like this
i will get back the same correct info.

any help would be fantastic. thanks!
 
One way if you're using apache and it's available would be mod_rewrite. I've gotten in the habit of using it recently and enjoy it. It lets you, as the name suggests, rewrite a url. People could see themselves visiting "/topic.html" and they're actually going to "/cgi-bin/script.pl?page=topic" or something. Completely transparent to the user.

Do you use param('keys') in a large number of places? Many times there's one place that you do all your error checking for all your input and put it into a form hash or something. It'd be easy to change it there if that were the only place it were done.

And last is probably the simple solution you're looking for, which you can find here:

----------------------------------------------------------------------------------
...but I'm just a C man trying to see the light
 
Not sure I quite understand what you need but:-

This is how you do it with HTML...

<a href=&quot;target=whoever&quot;>keys=whoever</a>

This is how you can change using a regex...

s/(http:\/\/www\.[^?]+)\?keys\=(.+)/${1}?target=${2}/;

Hope this is of some help!
Duncan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top