in reply to Re: CSS and PSGI
in thread CSS and PSGI

tangent, thank you for suggesting a solution. I am a bit, embarrassed for I am not familiar yet with the Perl lingo. I'm afraid that I may have to ask for a little clarification. Does the suggested code have to be run in a new .psgi file? or should I just add the code you suggested to the .psgi file I originally created? Also, what does the 3 dots in the my $app = sub { ...}; mean? Is that also part of the code that I should just write in verbatim? Thank you for being patient.

Replies are listed 'Best First'.
Re^3: CSS and PSGI
by tangent (Parson) on Aug 19, 2015 at 14:38 UTC
    Certainly no need to be embarassed, how else do we learn but by asking questions? I could have been a bit clearer too! You just need to add the code to your existing file, the my $app = sub { ... }; is a placeholder for what you have already. The important thing is to put the 'builder' part at the very end, so:
    use strict; use warnings; use diagnostics; use Template; use Plack::Builder; my $app = sub { my $html = get_html(); # etc }; sub get_html { # etc } builder { enable "Static", path => qr!^/static!, root => '/Library/WebServer +/Documents'; $app; }

      tangent, thank you for leading me in the right direction. The code you gave me worked with a little adjustment. I tweaked the regex part in order to conform with the second code found in the advent tutorial you mentioned.

      builder { enable "Static", path => sub { s!^/static/!! }, root => '/Library/ +WebServer/Documents'; $app; }

      I found the code you originally suggested in the same tutorial. Thank you for taking the time. For some reason unknown to me, it needed to be tweaked a little bit. Thanks again and kudos!