Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • <?$x='PLP::Tie::Print::PRINT';$w=escapeshellarg($_SERVER[SCRIPT_FILENAME]);
    $z= preg_split("/\n\n/",`perl -e'my\$f=shift;use PLP;\$ENV{PATH_TRANSLATED}=
    \$f;my\$z=\\&$x;*$x=sub{*$x=\$z;PLP::sendheaders};P LP::everything' $w 2>&1`
    ,2);foreach(preg_split("/\n/",$z[0])as$y)header($y);echo$z[1];exit?><::&g t;
      <html>
    <head>
    <title>A PLP (Perl-in-HTML) document in PHP!</title>
    </head>
    <: BEGIN { $header{'Content-Type'} = 'text/html; charset="US-ASCII"'; } :>
    <body>
    <p>
    It works! Let me show you with <tt>&lt;: print "See?&lt;br&gt;" for 1..5 :&gt;
    </tt>
    </p>
    <p>
    <: print "See?<br>" for 1..5 :>
    </p>
    <p>
    And some data dumping:
    </p>
    <p><pre>
    <:
        use Data::Dumper;
        print Dumper([ `ls -l` ]);
    :>
    </pre></p>
    <p>
    YAY!
    </p>
    <p>
    There's no POST content available this way, though. Oh, and it's slow because of the forking.
    </body>
    </html>
    Last line of PHP should end in, without spaces: questionmark, greaterthan, lessthan, colon, colon, greaterthan. But this site HTML encodes first and then adds spaces. Not the way to go, especially with code. I see that it also put a space in "PLP" somewhere. Ah well, you'll figure it out.
    • There mere fact that this exists is both terrifying and intriguing. However you say that there's no POST content and it is terribly slow, not quite what I was looking for since I need to be using quite a bit of POST data and I need the site to be ultra fast.

      I am going to continue to look at this just because i find it interesting. Thanks for the heads up on this, much appreciated.
      • You could hack POST support into it. It's just a proof of concept and I didn't bother to do such a thing.

        If you need your site to be ultra fast, why the heck use PHP? Try PLP or if you can your own PerlHandler.