I'd suggest in "Modern Perl" you'd want to create some kind of persistent web 
service to replace the "validator.cgi" using Dancer (or some other 
$WEB_FRAMEWORK)

A really simple one would be something like

https://gist.github.com/3177150


On the front side you could have another Dancer app that shows the form - a 
really concise example is here in my Dancer tutorial at line 83


https://bitbucket.org/mrallen1/dancr/src/7ca51c18f350/dancr.pl#cl-83


And instead of using the code that's in that sub, you could simple do something 
like

my $req = HTTP::Request->new(
  'POST', 
  'http://localhost:5000/auth', 
  { 
    username => params->{username}, 
    password => md5_hex(params->{'password'} 
  }
);

my $response = $ua->request($req)

if ( $response->is_success ) {
  # in like flynn
  # do stuff here
} else {
  # "not authorized"
}

If you want to get ridiculously fancy, you could check out something like 
AnyEvent::HTTP to make asynchronous auth requests.[1]

--Mark

[1] But you might not want to given that the AnyEvent learning curve can feel 
steep and the author of AnyEvent is kind of a jerkface at times.



________________________________
 From: lee latham <[email protected]>
To: "Houston.pm located in Houston, TX." <[email protected]> 
Sent: Tuesday, July 24, 2012 1:32 PM
Subject: Re: [pm-h] Is this possible?
 
Fraser,

I think you just need to use the CGI module.

You'll need some notion of a session, as well.

Lee

On Tue, Jul 24, 2012 at 10:54 AM, Fraser Baker <[email protected]> wrote:
> Hi:
>
> Using LWP and HTTP-Request can I do this all in the same file?
>
> Collect some some form data such as User Name and Password using a form.
>
> Open a persistent connection to a validator.cgi file on the server and
> receive the results.
>
> Reset the display to show the consequence of either success of failure.
>
> It appears to me that after the form is run, using PERL is no longer
> possible. So can JavaScript execute the necessary calls to the validator.cgi
> file? Or can HTTP-Request-Form do this?
>
> Did I make sense?
>
> Fraser
>
>
> _______________________________________________
> Houston mailing list
> [email protected]
> http://mail.pm.org/mailman/listinfo/houston
> Website: http://houston.pm.org/
_______________________________________________
Houston mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/houston
Website: http://houston.pm.org/
_______________________________________________
Houston mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/houston
Website: http://houston.pm.org/

Reply via email to