Skip to content

Instantly share code, notes, and snippets.

@skaji
Created September 15, 2012 17:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skaji/3728941 to your computer and use it in GitHub Desktop.
Save skaji/3728941 to your computer and use it in GitHub Desktop.
plackup with a static file or directory
#!/usr/bin/env perl
use strict;
use warnings;
my $path = shift || '.';
if (-f $path) {
exec qw{plackup -MPlack::App::File -e},
"Plack::App::File->new(file => q($path))->to_app";
}
elsif (-d $path) {
exec qw{plackup -MPlack::App::Directory -e},
"Plack::App::Directory->new(root => q($path))->to_app";
}
else {
die "usage: plack-static [file | directory]\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment