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

How can I run a subroutine in another file from an anchor tag (...)? I ALREADY KNOW HOW TO RUN A SUBROUTINE FROM ANOTHER FILE ... I need to be able to do this for a program I making for something, and I can't figure out how to do it!! I searched first this time in perlmonks.org and a bunch of other places on the internet first, but I still can't find what I am really lOOking for :) thanks whoever can help... and how come my rating is sooo low? I'm trying to become more skilled in perl, but I have a bad rating :( ok.
  • Comment on How can I run a subroutine from an anchor tag (a href....../a)?

Replies are listed 'Best First'.
Re: How can I run a subroutine from an anchor tag (a href....../a)?
by MeowChow (Vicar) on Feb 18, 2001 at 08:17 UTC
    Anchor tags do not "call out" to perl subroutines. They are simply links to URLs that a browser can make GET requests to. You can write a CGI script which receives the GET request and then dispatches it to whatever subroutine you have written.
       MeowChow                                   
                   s aamecha.s a..a\u$&owag.print
      One approach involves creating an HTML form whose form handler is the CGI script you want to run.

      Another approach is to dispense with form and its GET request entirely. If your domain is mydomain.com and your script is named myscript.pl then have your link point to http://mydomain.com/myscript.pl

      Once the user clicks on http://mydomain.com/myscript.pl, he will only see whatever output it is that myscript.pl creates, so you must do some additional CGI programming in order to create that output. You might wish to familiarize yourself with CGI.pm in order to help you do so. You can learn about CGI.pm here.

Re: How can I run a subroutine from an anchor tag (a href....../a)?
by damian1301 (Curate) on Feb 18, 2001 at 08:22 UTC
    Just another FAQ. I asked this question a while ago and chromatic came up with a good idea. If you are wondering where the node is then here you go yay!

    Almost a Perl hacker.
    Dave AKA damian

    I encourage you to email me