Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Anchor Tag and Perl

by Anonymous Monk
on Feb 13, 2009 at 20:05 UTC ( #743676=perlquestion: print w/ replies, xml ) Need Help??
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks!

I have a bug here where in my Perl script a have a link like:
<a name="main_name" href="view.pl?tr=$tr&more=name#main_name\">

The problem here is that the "#" at the end of the url; where I need it in here to go to the location on the page I want after clinking on this link ( anchor tag) is ignoring the other values I am passing to the script, so my logic is going no where? Has anyone seeing this bug/problem before, any help?
Thanks a lot!

Comment on Anchor Tag and Perl
Download Code
Re: Anchor Tag and Perl
by kennethk (Monsignor) on Feb 13, 2009 at 20:09 UTC
    Please read How (Not) To Ask A Question. What is your code supposed to do? What modules are you using? 1 line of code is worth 1k words.
      I think people around here has a problem understanding other people, what the person is asking is how to pass the value from some Perl script where this is to the same script, look at the parameters he is trying to pass in the link, where this link has to go ta a specific location on a page, after the script reads the values passed on the header, but the anchor tag that is not working because of "#" at the end of the url, think.
Re: Anchor Tag and Perl
by Your Mother (Canon) on Feb 13, 2009 at 20:10 UTC

    This is the well known line 42 issue. You can usually fix it by commenting out line 42 in your code. If that doesn't work you could try asking an intelligible question.

        He did answer it. Simply comment out the forty-second line and all will be well again. I thought it was a very well written response.

        Although, lines 30-35 looks like they need to be seriously refactored and he did not comment on them.

        And you didn't even know bears could type.

        "Intelligible" ne "intelligent." I wasn't insulting you, I was suggesting that no one can understand what your code problem is. If you could state it clearly: 1) what you have for input, 2) what you are trying to do with it in your code, 3) what you expect to get out, then someone here will certainly help.

        By the way, garbage knowledge is hard won. It never comes cheaply.

Re: Anchor Tag and Perl
by Lawliet (Curate) on Feb 13, 2009 at 20:31 UTC

    Backslash it?

    And you didn't even know bears could type.

Re: Anchor Tag and Perl
by Corion (Pope) on Feb 13, 2009 at 20:33 UTC

    If you want a # sign in a CGI parameter value, you have to escape it.

    If you want a # sign in the path, you have to escape it.

    If you expect the stuff after a # sign to be available to your script, that's not how URLs work.

      This article on Fragment identifiers may help explain why it's not doing what the OP wants.

      The fragment identifier functions differently than the rest of the URI: namely, its processing is exclusively client-side with no participation from the server. When an agent (such as a Web browser) requests a resource from a Web server, the agent sends the URI to the server, but does not send the fragment. Instead, the agent waits for the server to send the resource, and then the agent processes the resource according to the fragment value. In the most common case, the agent scrolls a Web page down to the anchor element which has an attribute string equal to the fragment value.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://743676]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2014-12-29 03:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (184 votes), past polls