Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re^2: Markup::Perl Review / Demo (Basic CGI Shell)

by usemodperl (Beadle)
on Jul 04, 2018 at 20:27 UTC ( [id://1217904]=note: print w/replies, xml ) Need Help??

in reply to Re: Markup::Perl Review / Demo (Basic CGI Shell)
in thread Markup::Perl Review / Demo (Basic CGI Shell)

Thank you for the information marto!

I looked at that test and ran what it's doing with success on osx. Do you know why that fails on windows? If it has something to do with $^X (from the test) then it might install with force since it's not in the module source.

Thanks for warning people again about the shell mentioned in the title and pod; you have an eye for danger! It's just a demo and much less powerful than a real shell since it only runs with the privs of the web server. This is a typical single user administrative script for us kids who run perl on our home computers and don't have to worry about the perils of exposing it to the internet.

I wouldn't use Markup::Perl in production on the net. It's been tested with perlrun under mod_perl and that didn't work but was not persued because, even though any handler can be made to work eventually, it's not necessary since we're not going into production with a hobby module. Frankly I don't care for the rationalizations and considerations (or the policing) that discourage and cripple a legacy core module on CPAN that ~246 distributions depend on (some very popular):

The most recent Perl my review script was tested on:

perl -le'print$^V'

perl -MCGI -le'print$CGI::VERSION'

Markup::Perl can't be run from the command line AFAIK because of that magic but the version here is 0.5.

  • Comment on Re^2: Markup::Perl Review / Demo (Basic CGI Shell)

Replies are listed 'Best First'.
Re^3: Markup::Perl Review / Demo (Basic CGI Shell)
by Corion (Patriarch) on Jul 04, 2018 at 20:29 UTC

    The test fails because it doesn't know about how to run shell commands on Windows:

    `$perl -e'print 1;'`;

    On Windows, the shell only understands double quotes.

      Thank you Corion, I missed that. Being the type of person who rummages through error_logs to find new excuses for rewriterules, my mind wonders why someone hasn't fixed that. I don't have perl on windows handy to test if Markup::Perl will work by installing with force.


        Instead of using force, why don't you fix the actual test and send a patch?

        Here is often how I check if a binary is available and executable (usually in my Makefile.PL files, but I digress... here's one example, and another):

        use strict; use warnings; use Test::More; my $is_win = $^O =~ /MSWin/; my ($sep, $bin) = $is_win ? (';', 'perl.exe') : (':', 'perl'); my $perl_available = grep { -x "$_/$bin" } split /$sep/, $ENV{PATH}; ok $perl_available, "perl binary was found and is executable"; done_testing();

        Update: Modified code to work on both Windows and Unixy platforms.

        A reply falls below the community's threshold of quality. You may see it by logging in.

        "my mind wonders why someone hasn't fixed that."

        Probably because nobody uses it.

        A reply falls below the community's threshold of quality. You may see it by logging in.
Re^3: Markup::Perl Review / Demo (Basic CGI Shell)
by marto (Cardinal) on Jul 04, 2018 at 21:38 UTC

    "If it has something to do with $^X"

    $^X has no issues on windows. As Corion mentions the failure relates to not catering for windows quoting. You said this module "is extremely useful for rapid prototyping", the alternatives listed in CGI::Alternatives are a better choice in this (and in fact every) respect , because it's trivial to rapidly prototype and scale up without throwing away the code, which you'd be doing if you went down your recommended path.

      Thanks for reminding us of the Alternatives™ again marto! As I said there are TIMTOWTDI ways to embed perl in html. Why discourage people from having fun with CPAN modules? These things work well enough for our purposes and are fun and productive. Please let us have fun marty!

      Lots of stuff written with a module like this stays local anyway. I have tons of useful utilities written with the many methods of cpan in a cgi folder to summon from a browser bookmark list. Significant new os functionality can be cooked up in minutes with a sweet html interface with something like Markup::Perl. Quite a bit can be achieved by dropping the synopsis from some cool module into the <perl> block of the template provided in the pod of the program this node is supposed to be about. Once one likes that kind of home brew ease of use one may want a textarea to paste code samples into; then one might want a pod reader that automatically inserts any listed code into a textarea you can edit and click to try functions of installed modules from inside the documentation. Anyway you'll see more in my next Markup::Perl demo!

      If it's a concern keep <perl> blocks large so refactoring doesn't waste code. 👍


        I'm in no way trying to stop people having fun doing whatever they please, simply, once again correcting the claims you make which are wrong.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1217904]
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (8)
As of 2024-04-23 10:37 GMT
Find Nodes?
    Voting Booth?

    No recent polls found