atnonis has asked for the wisdom of the Perl Monks concerning the following question:

can i use the <a href> tag to link subroutines from the same file where <a href> is?! if this is not possibly any other way to do it?!? Antonis

Replies are listed 'Best First'.
Re: <a href> tag and subroutines (CGI)
by tye (Sage) on Feb 17, 2003 at 23:09 UTC

    It sounds like you have a CGI script and you want to have it generate a link such that, when a user clicks on that link, a specific subroutine in your CGI gets called.

    I guess the answer is a little bit "yes" and little bit "no". The biggest reason it is "no" is because each click from the user will rerun your CGI script from the beginning in a different process.

    But you can make a link that will call your same CGI script with enough information for it to reconstruct the needed context and then call a subroutine. There are lots of ways of doing that and the details of that part (having the link specify the subroutine) are tiny compared to the part you didn't ask about (getting the new instance of your CGI script to reconstruct the needed context), so I think going into more details on the former would mostly be confusing, unfortunately.

    If this is what you are talking about, then you should probably find a good tutorial on CGI and Perl and maybe eventually check out something like CGI::Application.

                    - tye
(jeffa) Re: <a href> tag and subroutines
by jeffa (Bishop) on Feb 17, 2003 at 18:14 UTC
    What are your trying to do with this? The <a> tag is used to link hypertext, not Perl code. I can take some guesses at what you are trying to do, but i recommend that you instead rephrase your question/tell us why you want to do this/give some sample code or sample input/output. Then we can help more. :)

    jeffa

    L-LL-L--L-LL-L--L-LL-L--
    -R--R-RR-R--R-RR-R--R-RR
    B--B--B--B--B--B--B--B--
    H---H---H---H---H---H---
    (the triplet paradiddle with high-hat)
    
Re: <a href> tag and subroutines
by VSarkiss (Monsignor) on Feb 17, 2003 at 18:25 UTC

    No, you need to link the DTD through the interpreter loop or the reverse tie will break in all the wrong places.

    ;-)

    I'm sure you're asking sincerely, but your question makes as much sense as my answer above. Please try to re-phrase it with more details. Take a look at How (Not) To Ask A Question.