Back to the original question of loading different .pl files for each URL - https://metacpan.org/pod/Plack::App::PSGIBin would do exactly that. It loads up .psgi files under a directory and creates a map to load them by URL path.
On Tue, Aug 16, 2016 at 5:02 PM ivo welch <ivo.we...@anderson.ucla.edu> wrote: > > thx, t. I got it to work for myself. Mojo and Dancer are very > heavyweight. with some scaffolding, Placks's learning curve becomes a lot > lower. CGI is deprecated and was the only other low-scaffolding solution. > I hate php, but I can write a 10 line lightweight program to record the > email of my visitors in a file. > > sorry, I think Plack is a great solution. just wanted to help. > > > > Sent with MailTrack > <https://mailtrack.io/install?source=signature&lang=en&referral=ivo...@gmail.com&idSignature=22> > > ---- > Ivo Welch (ivo.we...@gmail.com) > http://www.ivo-welch.info/ > J. Fred Weston Distinguished Professor of Finance > Anderson School at UCLA, C524 > Free Finance Textbook, http://book.ivo-welch.info/ > Exec Editor, Critical Finance Review, > http://www.critical-finance-review.org/ > Editor and Publisher, FAMe, http://www.fame-jagazine.com/ > > On Tue, Aug 16, 2016 at 4:26 PM, Tatsuhiko Miyagawa <miyag...@gmail.com> > wrote: > >> I read the email. >> >> You're recommended to use frameworks such as Mojolicious or Dancer 2. >> >> Plack/PSGI is not a layer you should consider using when you're at a >> starter level. >> >> >> On Tue, Aug 16, 2016 at 3:27 PM ivo welch <ivo...@gmail.com> wrote: >> >>> >>> 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 plack.pl ## 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/plack.pl line 44. >>> at /Users/ivo/syllabus.space/www/phpi/plack.pl 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 >>> $args[0]"; >>> return @rv; >>> >>> >>> >>> known-to-work starter examples (each showing off a different feature) would >>> be a great help on the Plack http://plackperl.org/ website. alas, I don't >>> know tatsuhikos' email (who I am assuming maintains it). >>> >>> >>> thanks again, andy. >>> >>> >>> regards, >>> >>> >>> /iaw >>> >>> >>> -- >>> >>> --- >>> 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 to psgi-plack+unsubscr...@googlegroups.com. >>> For more options, visit https://groups.google.com/d/optout. >>> >> -- >> >> --- >> You received this message because you are subscribed to a topic in the >> Google Groups "psgi-plack" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/psgi-plack/0tS-oI6B__0/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> psgi-plack+unsubscr...@googlegroups.com. >> > >> For more options, visit https://groups.google.com/d/optout. >> > -- > > --- > 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 to psgi-plack+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- --- 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 to psgi-plack+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.