Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old June 5th, 2000, 04:16 AM
JeremyL JeremyL is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 12 JeremyL User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I need help getting a cgi script to stop using the ?. I have found an open sorce script that does this but I am very new to perl and need help figuring out how to clean up this code so it can be integrated into mine, and also figuring out what part of the code actually does what I want and which is extra.

There are two parts.

The varible:
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
## This variable changes the operation of the script drastically.
## If pod_usequery=1 then POD will expect to be called in the format
## of .../pod.cgi?dir=/Arts/Entertainment
## If pod_usequery=0 then POD will expect to be called in the format
## of .../pod.cgi/Arts/Entertainment
$pod_usequery=1;
[/code]

And the code itself:
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
&pod_main;
exit 0;

sub pod_main {
&pod_init;
if ($pod_debug) {
print "Content-Type:text/htmlnn<html><head><title>DEBUGGING</title></head>";
print "<body><h1 align="center">Debugging mode ON</h1><br>";
print "<ul><li>POD DMoz.Org version: $pod_version<br><li>CGI library version: ".$CGI::VERSION."<br><li>Perl version: ".$]."<br><li>Server software: ".$ENV{'SERVER_SOFTWARE'}."<br><li>CGI Revision:".$ENV{'GATEWAY_INTERFACE'}."<br></ul><hr>n";
print "<strong>Entering:</strong> <code>pod_main</code><br>n";
}
# Build a char->hex map
for (0..255) {
$pod_escapes{chr($_)} = sprintf("%%%02X", $_);
}
$pod_output="";
$pod_q = new CGI;
$pod_tag = $pod_q->param("tag");
$pod_referer=$ENV{'HTTP_REFERER'};
if ($pod_usequery=='1') {
$pod_dir = $pod_q->param("dir");
#$pod_dir = $ENV{'QUERY_STRING'};
$pod_dir =~ s/%([dA-Fa-f]{2})/pack("C", hex($pod_1))/eisg;
$pod_dirext = "?dir=";
} else {
$pod_dir=$ENV{'PATH_INFO'};
$pod_query_string=$ENV{'QUERY_STRING'};
if (length($pod_query_string)>0) { $pod_dir=$pod_dir."?$pod_query_string"; }
$pod_dir =~ s/%([dA-Fa-f]{2})/pack("C", hex($pod_1))/eisg;
$pod_dirext = "";
}
$pod_which_dir = "http://dmoz.org";
if ($pod_debug) { print "<strong>Full path details:</strong> <code>$pod_fullpath$pod_dirext</code><br>"; }
&pod_read_headers;
if (defined($pod_logging)) { &pod_log_search($pod_cgi_search); }
$pod_tag = $pod_q->param("tag");
$pod_validpage=0;
$pod_output=$pod_output.&pod_page_header;
$pod_cgi_content = &pod_get_first_page;
if ($pod_validpage==0) {
&pod_modify_content;
}
if ($pod_validpage==2) {
&pod_redirect($pod_cgi_content);
} else {
$pod_output=$pod_output.&pod_page_footer;
&pod_output($pod_output,$pod_expire_in);
}
if ($pod_debug) { print "<strong>Leaving:</strong> <code>pod_main</code><br>n"; };
}

sub pod_output {
if ($pod_debug) { print "<strong>Entering:</strong> <code>pod_output</code><br>n"; };
[/code]

Any help with this would greatly be apreciated.

Thanks
JeremyL

[This message has been edited by JeremyL (edited June 05, 2000).]

Reply With Quote
  #2  
Old June 6th, 2000, 02:13 AM
Shiju Rajan's Avatar
Shiju Rajan Shiju Rajan is offline
.Net Developer
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2000
Location: London
Posts: 987 Shiju Rajan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 26 m 22 sec
Reputation Power: 9
Send a message via MSN to Shiju Rajan Send a message via Yahoo to Shiju Rajan


Getting rid of the ? in a cgi script


you can simply substitue '?' from the input.

eg:

$test="why? what? when?"
$test=~ s/?/ /g;

#substitute ? from test variable..

print $test;











------------------
SR -
shiju.dreamcenter.net

"The fear of the LORD is the beginning of knowledge..."

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > Getting rid of the ? in a cgi script


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway