Re: Click link to go to routine



Sykigh A Trist wrote:
Thanks to all that replied. Some helpful tips from you. I will try to put to use what you have given me. And about my tirade (see below from my first post).

Can this be done within this code and does anyone mind showing me how to do it? Thanks

The reason I put the words above in my first post is because it is hard to get any answers from a few in this newsgroup. I've been here before. Same thing, last time I was here. Some people, instead of trying to help, like to point out how wrong you are in every aspect of your question. It was a very simple question - I want to click on a link and go to a subroutine in the code and not to a webpage. Again, thanks to all that helped.

We're trying to help, but you've added added restrictions that make it
impossible to provide an answer to the problem _as_it_is_stated_.

Here is an outline for a solution that works, as long as you drop the
"not go to a webpage" restriction.

1) One way or another, the user gets to a URL that goes to server ALPHA
That web server executes perl program A.pl which includes
a print statement. That print statement outputs a clickable URL, like
'<a href="http://BETA.example.com/cgi-bin/B.pl?part=2";>continue to step 2</a>'.
The process running A.pl terminates after outputting the HTML.

2) The user clicks on the link. The user's browser sends a GET request
to server BETA. This is a process that goes to a web page.

3) Server BETA executes perl program B.pl which looks at the information
the browser sent, and executes a specific function inside the B.pl program.
Program B.pl outputs a response, since the browser is expecting one.

if ($part == 2) {
print return_this();
}

In many cases, servers ALPHA and BETA are this same.
With a little program logic, program A.pl and program B.pl can be the same.

However, you cannot get around step 2. When a user clicks on a link,
(and JavaScript is not in the picture), then the user's browser _MUST_ go
to a web page. This means a new request to the web server, a new process
running on the web server to execute B.pl (A.pl with additional arguments).

a) "use CGI;" or other standard module for parsing POST or GET requests.

b) When your program detects that it has been invoked without arguments,
output a FORM or a link that can be clicked on.

print qq{<a href="http://www.scripts.net/cgi-bin/A.pl?back=true"; target="_top">
Go Back</a>\n};

c) When your program detects that it has been invoked with the right arguments,
go to a specific routine in the code.

if ($back eq 'true') {
return_this();
} else {
print "Content-type: text/plain\n\n Oops! Wrong link was selected\n";
}

> It was a very simple question - I want to click on a link and
> go to a subroutine in the code and not to a webpage.

You want to click on a link that goes to a webpage that executes a
particular subroutine in the code. Same program as before, but a fresh
new instance with all new unset variables.

> Re: Click link to go to routine

Answer: Click link to invoke CGI program on a server with the idea that
the CGI program will go to a specific routine.

-Joe

P.S.: Don't forget that the second execution of your code will not have access
to any of the variable values that the first execution set, unless you store
temporary results in a file, a database, cookies, or hidden FORM parameters.
.



Relevant Pages

  • Re: How to send a key event to another process?
    ... Browser sends a GET or POST HTTP request to web server ... Web server decodes GET/POST URL and determines which CGI program to call ...
    (comp.os.linux.misc)
  • Re: Secure automation?
    ... To provide secured web services, a server SSL certificate is ... The downside with this is that the web server will ask ... To be able to verify a server certificate, a web browser needs to ...
    (comp.security.unix)
  • Re: Secure automation?
    ... To provide secured web services, a server SSL certificate is ... The downside with this is that the web server will ask ... To be able to verify a server certificate, a web browser needs to ...
    (comp.security.unix)
  • Is the following SSL process accurate?
    ... Server responds with handshake saying sure go ahead. ... Browser then generates a ephemeral symmetrical key from ... transmitted and received by the web server. ... using the Web Server's "session key" that was generated at the last re-boot. ...
    (alt.computer.security)
  • Re: login page stays on login page
    ... traffic between your browser and your web server. ... It seems your web server is redirecting your browser back to the web page ... My gut is that this has nothing to do with the login control flag. ...
    (microsoft.public.dotnet.framework.aspnet)