thanks for this good starter.  I cpan'ed Plack PSGI Plack::Session, 
Plack::Middleware::ETag, and Template .  I commented out the loadconfig(). 
 then it compiled.  started

    $ sudo plackup  ## needed or sessions and templates 
directories need to be writeable by nobody

I fire the browser up to localhost:5000, and I get impressive looking error 
output, that seems to be a mix of amateur and pro.  Specifically, I see

Undefined subroutine 
&Plack::Sandbox::_2fUsers_2fme_2testsite_2fwww_2fplack_2epl::doIndex called at 
/Users/me/testsite/www/ line 44.
 at /Users/ivo/ line 43

and then nice code boxes.  I guess _2F needs to be decoded to '/', but this 
is minor.  I am now feeling my way in the dusk (no longer dark).

ETag were a mystery, too.  what do inode mtime size do?  I am guessing that 
it is doing exactly what I want---cache expiry if inode, mtime, or file 
size change.  much more convenient than the old expiries and pragma that I 
dealt with.

I also discovered common::sense through your example. much more convenient 
than what I had been using, which was enumerating these cases!

The error was, at first, mystery.  I see the mount that presumably builds 
up "/", and since I am requesting localhost:5000 in my browser, this is 
what should be hit.  alas, I started to get somewhere when I defined

    sub doIndex {
      return [ '200', [ 'Content-Type' => 'text/html' ], [ 42 ], ];

and then requested localhost:5000/main .  I guess I can now replace the %funcs 
call `my proc = $funcs{$args[1]}` with something like

 args[0] =~ s/\.//g; ## ignore all attempts to traverse up the hierarchy or 
use hidden files (-e "/$DOCUMENTROOT$args[0]") or return [ 404, [ 
'Content-Type' => 'text/html; charset=utf-8' ], [ "404 file $args[0] not 
found" ] ];
 my $perlcode= slurp("/$DOCUMENTROOT/$args[0]"); ## could check that the 
first line contains perl magic
 my @rv = eval perlcode;
 ($@) and die "in nice html, say your perlcode in $args[0] died";
 ($#rv != 2) and die "in nice html, say we want three args back from 
 return @rv;

known-to-work starter examples (each showing off a different feature) would be 
a great help on the Plack website.  alas, I don't know 
tatsuhikos' email (who I am assuming maintains it).

thanks again, andy.




You received this message because you are subscribed to the Google Groups 
"psgi-plack" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
For more options, visit

Reply via email to