chandantul has asked for the wisdom of the Perl Monks concerning the following question:
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Need to know the process to implement perl script into web application server.
by davido (Cardinal) on Mar 29, 2021 at 19:04 UTC | |
You may want a Mojolicious::Lite application either running as a daemon, or you want a Mojolicious::Lite app running in CGI mode (for very low traffic sites, on providers where you can't run a daemon). The Mojolicious documentation provides very good tutorials. But it's going to require you do some learning on your own so that when you come to ask questions, they're based on a good understanding, and on you having the foundational knowledge that can only come from reading the manual and tutorials. I would start with: The Mojolicious Tutorial. Unrelated: We don't have a working familiarity that would justify you referring to me as "team". Dave | [reply] |
by Fletch (Bishop) on Mar 30, 2021 at 03:08 UTC | |
Considering the poster's history and the amount of people who're doing his job for him (gratis) one can certainly understand his confusion . . .
The cake is a lie. | [reply] |
|
Re: Need to know the process to implement perl script into web application server.
by choroba (Cardinal) on Mar 29, 2021 at 19:41 UTC | |
A possible config file might look like
We will use the Dancer2 framework to help us with the work. It's not the only option, but we have to pick one, so why not this one. Install Dancer2 and App::Cmd from CPAN and run
This creates a skeleton of the web application. For our simple script, we'll only need to handle two methods: get (which will display a form) and post (which will display the result). Each of them will have a different page template, so go to views/ and create query.tt:
and result.tt:
You see, all the parameters that were origianlly coming from the config will now come from the web form. Create the Op.pm in lib/ from the script:
Now just wire the routing in lib/webapp.pm:
Now, your application is ready to run. Launch
and open http://localhost:5000 in your browser.
map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
| [reply] [d/l] [select] |
by perlfan (Parson) on Mar 29, 2021 at 19:50 UTC | |
| [reply] [d/l] |
by chandantul (Scribe) on Apr 22, 2021 at 04:39 UTC | |
Hello Sir, As suggested, i was working with Dancer2. I am getting an error below after submitting required id and time and mail id. Please check below Web Form APPID Time in Hours Recipient Email Submit Powered by Dancer2 0.301001 Please check below error.
Please check below all my code snippet for query
Please check below code snippet for result as suggested by you and i am wondering if its required for my purposes of not as i would like to generate the file after submitting the required details in web form and once the file generated , program sent an e-mail with generated file.
Please check below Op.pm under /lib
How can i achieve the goal for generating the report after submitting the details in web From. | [reply] [d/l] [select] |
by choroba (Cardinal) on Apr 22, 2021 at 06:06 UTC | |
Why do you turn warnings off? They would've told you Variable "$client" will not stay shared at Op.pm line 59. In Perl, nesting named subs doesn't make sense. Named subs exist in the namespace of the enclosing package, block scope doesn't influence them. It also means the closure is created around the $client variable from the first invocation of the outer sub. But you should fix all the remaining problems, too.
map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
| [reply] [d/l] [select] |
by chandantul (Scribe) on Apr 22, 2021 at 14:55 UTC | |
by choroba (Cardinal) on Apr 22, 2021 at 15:34 UTC | |
| |
| |
|
Re: Need to know the process to implement perl script into web application server.
by hippo (Archbishop) on Mar 30, 2021 at 08:56 UTC | |
Do you have step by step process to achive the web interface functionality in perl script? Yes we do. See the Web Programming Tutorials. 🦛 | [reply] |
|
Re: Need to know the process to implement perl script into web application server.
by perlfan (Parson) on Mar 29, 2021 at 19:55 UTC | |
What is a modulino? It's simply a script that has a few extra lines in it + some judicious encapsulation of functionality into sub routines so that it can continue to function as the commandline utility you know, but provides a library interface as module. Just the first google hit, but this does a good job of outlining what it looks like https://perlmaven.com/modulino-both-script-and-module. Like I said, this can be done with minimal refactoring and can allow you to iteratively move towards creating bonefide Perl modules. | [reply] |