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

Hello,

I need to setup a github repository for a website and at the moment I'm telling to start a local webserver with  python -m SimpleHTTPServer 8080 for working on the files.

Is there anything such simple I can tell so that perl is used instead?

Thank you

Replies are listed 'Best First'.
Re: one-line web server
by Discipulus (Canon) on Jun 14, 2016 at 09:51 UTC
    Re: Simple http server one-liner for some static files? can be a starting point.

    other possibilties are present with new web Perl modules:

    perl -e 'use base qw(Net::Server::PSGI); main->run(port => 8080, ipv = +> "*")'

    L*

    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

      Thank you very much for your answer and for pointing me to that discussion.

      After reading it I'm afraid that, unfortunately, I'd better suggest the python command since the people using the files on repository may not have experience/permission to install modules, and even the syntax might frighten them if they don't use Perl.

      Thanks for your time!

        After reading it I'm afraid that, unfortunately, I'd better suggest the python command since the people using the files on repository may not have experience/permission to install modules, and even the syntax might frighten them if they don't use Perl.

        If they're not going to program it, if they can't even install software, why use a programmers toolkit, why not simply use an end product, nginx or apache or whatever?

Re: one-line web server
by Your Mother (Archbishop) on Jun 14, 2016 at 13:56 UTC

    :P (IO::All)

    perl -MIO::All -e 'io(":8080")->fork->accept->(sub { $_[0] < io(-x $1 +? "./$1 |" : $1) if /^GET \/(.*) / })'

    Unwanted? Yes! Unwarranted? Probably! Unwelcome? Jury nullification works!!!

      Sorry I don't understand the final comment, I hope is not a bad one!

      Anyway: Can't locate IO/All.pm in @INC (you may need to install the IO::All module)

        The key hint is in the last few words of that error message:

        you may need to install the IO::All module
Re: one-line web server
by bduggan (Pilgrim) on Jun 16, 2016 at 13:48 UTC
    Install Mojolicious first, then
    perl -Mojo -e'a->static->paths->[0] = "."; a->start' daemon
    You may want to generate an index.html too:
    ls | perl -lne 'print qq{<br><a href="$_">$_</a>}' > index.html