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

Hi All,

I'm trying to figure out how to convert a CGI Perl program to web service.

For example, I have a login page(userlogin.pl), once I enter userid and Password, if its correct, will redirect to account.pl page

otherwise it will display error message in userlogin.pl file.

If I catch error/success in JSON format from userlogin.pl, how can I call account.pl in the case of web service?

Please advise how to proceed?

Thanks

Replies are listed 'Best First'.
Re: CGI Perl to web service
by tobyink (Canon) on Apr 12, 2013 at 12:26 UTC

    Personally I'd avoid form-and-cookie-based authentication for a web service. Use HTTP Basic or (better) HTTP Digest, or something fancy like HTTPS client certificates, or OAuth if you're a masochist.

    package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name
      https + form/cookie = tada
Re: CGI Perl to web service (marketing)
by Anonymous Monk on Apr 12, 2013 at 12:23 UTC

    I'm trying to figure out how to convert a CGI Perl program to web service.

    What do you mean by "web service"? its more of a generic description than a technical term.

    If I catch error/success in JSON format from userlogin.pl, how can I call account.pl in the case of web service?

    The same exact way you called userlogin.pl?

    You're going to be more specific if you want a better answer, sorry

      Hi

      Thanks for your reply. userlogin.pl with additional parameter(for example: ws=1) can differentiate web service call.

      Thanks