Dancer2-Plugin-WebService
view release on metacpan or search on metacpan
dnf install perl perl-devel perl-Module-Signature perl-Version-Requirements
dnf group install "Development Tools"
dnf install llvm-toolse
Install cpanm
curl -L http://cpanmin.us | /usr/bin/perl - App::cpanminus
vi /etc/profile.d/perlbin.sh
#!/bin/sh
[ -d /usr/bin/site_perl ] && PATH=${PATH}:/usr/bin/site_perl
[ -d /usr/bin/vendor_perl ] && PATH=${PATH}:/usr/bin/vendor_perl
[ -d /usr/bin/core_perl ] && PATH=${PATH}:/usr/bin/core_perl
export PATH
source /etc/profile.d/perlbin.sh
Install Perl modules
cpanm ExtUtils::MakeMaker
cpanm ExtUtils::Config
cpanm Test::More
cpanm Data::Dumper
cpanm YAML::XS
cpanm XML::Hash::XS
cpanm Cpanel::JSON::XS
cpanm URI
cpanm IO::HTML
cpanm HTTP::Headers
cpanm HTTP::Entity::Parser
cpanm Template::Toolkit
cpanm Moo
cpanm Net::Server
cpanm Starman
cpanm HTTP::Server::Simple
cpanm HTTP::Server::PSGI
cpanm Params::Validate
cpanm Params::Util
cpanm Plack
cpanm Plack::Handler::HTTP::Server::Simple
cpanm Plack::Middleware::Deflater
cpanm AnyEvent
cpanm Dancer2
cpanm Dancer2::Plugin::WebService
Check the dancer2 version
$(/usr/bin/which dancer2) version
Check the installed plackup utility
plackup=$(/usr/bin/find /usr/bin -name plackup -type f)
[ -x "$plackup" ] && echo ok || echo Sorry, could not found the plackup
$plackup --version
Make executable any authentication script that needs root privileges, e.g the Linux_native_authentication.sh
/usr/bin/find $(/usr/bin/perl -M File::Basename -E 'use Dancer2::Plugin::WebService; print [ fileparse $INC{"Dancer2/Plugin/WebService.pm"} ]->[1]') -regex ".*\.\(sh\|pl|py\)\$"
/usr/bin/find $(/usr/bin/perl -M File::Basename -E 'use Dancer2::Plugin::WebService; print [ fileparse $INC{"Dancer2/Plugin/WebService.pm"} ]->[1]') -regex ".*\.\(sh\|pl|py\)\$" -type f -exec /usr/bin/chmod 755 {} \;
Give the authentication scripts sudo "no password prompt" e.g
vi /etc/sudoers.d/Dancer2-Plugin-WebService
dancer ALL=(ALL:ALL) NOPASSWD: /usr/share/perl5/site_perl/Dancer2/Plugin/AuthScripts/Linux_native_authentication.sh
To view the Dancer2::Plugin::WebService documentation using your web browser
[ -f /home/dancer/pod2htmd.tmp ] && unlink /home/dancer/pod2htmd.tmp
pod2html --infile=/opt/Dancer2-Plugin-WebService/lib/Dancer2/Plugin/WebService.pm --outfile=/tmp/index.html --title="Dancer2 WebService" --verbose
pacman -S darkhttpd
darkhttpd /tmp --addr 0.0.0.0 --port 80 --chroot --daemon --index index.html # Start the web server at the background
http://yourserver
Please follow the CREATE_SAMPLE_APPLICATION document to create the "TestService" application for practice
( run in 0.540 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )