Last active
August 29, 2015 13:58
-
-
Save y-yu/10002049 to your computer and use it in GitHub Desktop.
ページ番号を振るCGI
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/env perl | |
use strict; | |
use warnings; | |
use utf8; | |
use CGI; | |
use CGI::Carp qw(fatalsToBrowser); | |
use File::Copy; | |
my $q = CGI->new; | |
my $fh = $q->upload('pdf_file'); | |
if (defined $fh) { | |
unlink './concat_.pdf'; | |
copy ($fh, './concat_.pdf'); | |
system('ssh abelia01 "export PATH=$PATH:/usr/texbin; cd ~/public_html/secure_htdocs/pagenum/; xelatex --output-directory=./ concat.tex > /dev/null"'); | |
print $q->redirect('https://www.coins.tsukuba.ac.jp/~word/pagenum/concat.pdf'); | |
} else { | |
print $q->header(-type=>'text/html', -charset=>'utf-8'); | |
print $q->start_html(-title=>"pagenum",-lang=>'ja-JP'); | |
print $q->start_form(-method => 'POST', -action => './'); | |
print $q->filefield(-name=>'pdf_file', | |
-size=>50, | |
-maxlength=>80); | |
print $q->submit(-name=>'submit', | |
-value=>'submit'); | |
print $q->end_form; | |
print $q->end_html; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
普通のリクエスト
PDFファイルがアップロードされたとき
xelatex
のコマンドを実行