1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Rep Power
    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

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

    sub pod_main {
    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_q = new CGI;
    $pod_tag = $pod_q->param("tag");
    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 {
    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>"; }
    if (defined($pod_logging)) { &pod_log_search($pod_cgi_search); }
    $pod_tag = $pod_q->param("tag");
    $pod_cgi_content = &pod_get_first_page;
    if ($pod_validpage==0) {
    if ($pod_validpage==2) {
    } else {
    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"; };

    Any help with this would greatly be apreciated.


    [This message has been edited by JeremyL (edited June 05, 2000).]
  2. #2
  3. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Rep Power

    Getting rid of the ? in a cgi script

    you can simply substitue '?' from the input.


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

    #substitute ? from test variable..

    print $test;

    SR -

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

IMN logo majestic logo threadwatch logo seochat tools logo