in reply to Re^12: Need to know the process to implement perl script into web application server.
in thread Need to know the process to implement perl script into web application server.

result() is not getting its arguments. How do you call it? How do you populate its arguments?

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
  • Comment on Re^13: Need to know the process to implement perl script into web application server.
  • Download Code

Replies are listed 'Best First'.
Re^14: Need to know the process to implement perl script into web application server.
by chandantul (Scribe) on Apr 29, 2021 at 20:43 UTC

    Currently the webapp running in http but i would like to enable SSL in order to run the webapp in https protocol

    I have tried below but getting below error

    C:\Users\Documents\Perl\webapp\bin>plackup --enable-ssl --ssl-key-file +=C:\Users\Documents\Private-Public\privateKey.key --ssl-cert-file=C:\ +Users\Documents\Private-Public\certificate.crt app.psgi

    failed to listen to port 5000: Invalid argument at C:/Strawberry/perl/site/lib/HTTP/Server/PSGI.pm line 103.

    Please check i have installed the following module as well Dancer::Plugin::RequireSSL; and made the changes in webapp

    package webapp; use Dancer2; use Dancer::Plugin::RequireSSL; use Op; our $VERSION = '0.1'; require_ssl(); get '/' => sub { template 'query' => { 'title' => 'webapp' }; }; post '/' => sub { my $r = Op::result({APPID => param('APPID'), date => param('date'), Email => param('Email')}); template result => { title => 'webapp', result => $r } }; true;

    Are there any solution to get the https://localhost:5000 working?

    2021-05-01 Athanasius fixed over-long code line.

      I fear Dancer plugins don't work in Dancer2.

      map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

        Sir, I have tried below command and got the error

        starman --enable-ssl --ssl-key=C:\Users\Documents\Private-Public\priva +teKey.key --ssl-cert=C:\Users\Documents\Private-Public\certificate.cr +t --workers=10 bin/app.psgi

        Error: failed to listen to port 5000: Invalid argument at C:/Strawberry/perl/site/lib/HTTP/Server/PSGI.pm line 103.

        Are there any way i can utlize Apache 2.4 with Dancer 2 or How i can enable https in my existing app? Please let me know the best way.

        2021-05-01 Athanasius fixed over-long code line.

Re^14: Need to know the process to implement perl script into web application server.
by chandantul (Scribe) on Apr 24, 2021 at 04:04 UTC

    Sir, I was able to fix the issue and my code is able to generate the report and send the report. the JSON response was incorrect and i had to change the Base URL in order make the correct call.

    I would like to add additional sub functions for different API call from the same page where i am passing the values for App ID , Time and Hours and email , Is that possible through the same Op.pm. If its possible, How i can add the functions in Ope.pm and webapp.pm? Please let me know if possible.

      "Is that possible through the same Op.pm. If its possible, How i can add the functions in Ope.pm and webapp.pm? Please let me know if possible."

      Write the code, call it from the appropriate place? You don't say what part you're having trouble with, and seem to have crowdsourced a great deal of code here recently. Please read and understand How do I post a question effectively? and PerlMonks for the Absolute Beginner, if you make more effort it's more likely that people will go to greater lengths to help. For what it's worth Mojolicious makes web work a joy, and once you've understood the basics it's relatively easy to port existing code to this framework. See also the first reply to this thread from davido, CGI::Alternatives.