Hi Chady. You are having some trouble, and I can't give you a straight, simple, do-one-thing answer (I don't think anybody could). However, if you go back and read all the informative and straightforward replies you got all day from the other monks here, you could probably get a handle on your situation.

Here are my own thoughts on your problem:

  1. Enable warnings by putting a -w after 'perl' on the first line. Like so:
    #!/usr/bin/perl # no warnings #!/usr/bin/perl -w # warnings enabled
    This will give you debugging information that will be output into your Error_Log for Apache, or IIS, or whatever you're using. As it stands, your code is VALID (as far as I can see), it just doesn't do what you want it to. Turning warnings on won't fix this problem directly, but it might help you understand what's going on a little better.

  2. Simplify your code by removing the HTML and tertiary functionality. This will help you narrow down where the problem is. For example:
    #!/usr/bin/perl -w @all = split(/?/,$ENV{'HTTP_REFERER'}); $where = @all[1]; die $where;
    Just running that snippet and checking the Error_Log will let you determine if your split is running properly, if you're using the correct environment variable, if you're making your array call correctly, et cetera. Based on the output value of $where you can figure out where your (first) problem is.

  3. Environment variables are tricky. Some are only defined under certain circumstances. For example, QUERY_STRING will only be defined if there is a question mark at the end of the URL path. For example:
    A) http://www.host.com/cgi-bin/test-script.pl B) http://www.host.com/cgi-bin/test-script.pl?param=value C) http://www.host.com/cgi-bin/test-script.pl?param=value&color=blue 1: #!/usr/bin/perl -w 2: 3: warn $ENV{'QUERY_STRING'}; Line 3 returns: A) blank (null string, no data) B) param=value C) param=value&color=blue
    Keep this in mind.

  4. CGI.pm is great for dealing with different parameter values. I know you're a newbie, but it's really easy and intuitive. Here's some quick code for you:
    #!/usr/bin/perl -w use CGI; use strict; my $cgi = new CGI; # this creates a new CGI object my $where = $cgi->param('where'); warn $where;
    Now you can call this script like this: /cgi-bin/locator.pl?where=Front And 'Front' will be written to your Error_Log. Simple, right?

Mostly I've just echoed what's already been written in reply to your first post. There's not much more we can give you.

Good luck.

'kaboo

PS - If you're having all this trouble trying to do this in Perl, you're going to have a seizure trying to do it in JavaScript. 'nuff said.


In reply to Re: Re: Stuck by mwp
in thread Stuck by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.