Created
June 27, 2012 17:03
-
-
Save alranel/3005407 to your computer and use it in GitHub Desktop.
A webserver to process files through Slic3r
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use Dancer; | |
use File::Slurp qw(read_file); | |
use File::Temp qw(tempfile); | |
post '/slice' => sub { | |
if (my $upload = upload 'stl') { | |
my (undef, $tmp) = tempfile(); | |
system qw(/path/to/slic3r.pl --load /path/to/config.ini), $upload->tempname, qw(-o), $tmp | |
and return status 500; | |
content_type 'text/plain'; | |
return read_file($tmp); | |
} | |
}; | |
dance; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment