1. 2. JavaScript 3. Perl 4. CGI
1. WWW HTML WWW World Wide Web HTML Hyper Text Markup Language XML, XHTML
Java (.java) JavaApplet (.class,.jar) JavaServlet (.jsp) JavaScript (.html) CGI (.cgi) SSI (.shtml) ActiveX (.asp) Perl(.pl)
WWW on Apache IIS AN HTTPD WWW on Internet Explorer IE Netscape Navigator
WWW JavaScript JavaApplet Java on WWW CGI (Common Gateway Interface) SSI (Server Side Include) JavaServlet ActiveX
JavaScript JavaApplet JavaServlet ActiveX CGI + Perl SSI + Perl
2. JavaScript Web time.htm gree.htm button.htm
time.htm <html> <body> <script language= JavaScript > var now = new Date(); document.write( now, <br> ); </script> </body> </html> 1. time.htm 2. time2.htm
gree.htm <script> hour = (new Date()).getHours(); if( hour < 12 ) gree = "Morning"; else gree="hello"; document.write(gree); </script> gree2.htm 1. gree.htm 2.
button.htm <script language= JavaScript > function WinOpen() { window.open( http://www.kyusan-u.ac.jp ); } </script> <input type= button value=, onclick= WinOpen() >
3. Perl Perl HelloWorld hello.pl time.pl
HelloWorld hello.pl 1. 2. print hello world. n ; 3. hello2.pl 4. 5. Perl perl hello2.pl
time2.pl 1. asperl 2. hello2.pl 3. 4. time.pl print hello world. n ; $now = localtime(time); print $now; 5.
4. CGI WWW CGI Perl Perl HelloWorld hello.cgi time.cgi gree.cgi wtime.htm
HelloWorld hello.cgi 1. asperl hello.cgi print context-type: text/html n n ; print <html> ; print <body> ; print Hello World n ; print </body> ; print </html> ; 2. Web http://localhost/~user/cgi-bin/hello.cgi
time.cgi 1. asperl time.cgi print context-type: text/html n n ; $now = localtime( time ); print <html> ; print <body> ; print $now; print </body> ; print </html> ; 2. Web http://localhost/~user/cgi-bin/time.cgi
gree.cgi 1. asperl gree.cgi print context-type: text/html n n ; ($sec, $min, $hour) = localtime(time); if( $hour < 10 ) { $msg = "Morning" } else { $msg = "Hello" }; print <html><body> ; print $msg, " World";print <html> ; print </body> ; print </html> ; 2. Web http://localhost/~user/cgi-bin/gree.cgi
wtime.htm 1. wtime.htm <html><body> <form action= cgi-bin/time.cgi method= POST > <input type= submit value= What time? > </form> </body></html> 2. Web http://localhost/~user/wtime.htm
1. 2. 3. Windows
1. HTML) CGI
WWW test2.htm <HTML><body> <form method= POST action= cgi-bin/sendtest2.pl > WWW <p> <textarea name= comment > </textarea><p> <input type= submit > </form></body></html> sendtest2.cgi
test2.htm <HTML><body> <form method= POST action= cgi-bin/sendtest2.pl > WWW <p> <textarea name= comment > </textarea><p> <input type= submit > </form></body></html>
sendtest2.pl (1) require cgi-bin.pl &ReadParse; $comment=$in{ comment }; $mailto= naka@kyusan-u.ac.jp ; $sendmail= /usr/lib/sendmail open(mail, $sendmail $mailto ); print MAIL Subject: Answers n ; print MAIL $comment; close(mail);
sendtest2.pl (2) print Context-type:text/html n n ; print <html> ; print <body> ; print ; print </body> ; print </html> ;
2. ID CGI HTML CGI Perl & Excel Excel HTML
WWW data.txt [test:1234] naka@kyusan-u.ac.jp # <h3> </h3> # # 1. 1:, 2: exectest.cgi 2. a:, b: 3. a., b., c., d., e. -- 1x60 -- 5x80 sendtest.cgi Perl & Excel
exectest.pl sendtest.pl jcode.pl, cgi-lib.pl CGI perl cgi-bin data.txt test.htm
data.txt [test:1234] naka@kyusan-u.ac.jp # <h3> </h3> # # 1. 1:, 2: 2. a:, b: 3. a., b., c., d., e. -- 1x60 -- 5x80
test.htm
exectest.pl
Received: (qmail 23593 invoked by uid 60001); 23 Jul 2003 03:44:12-0000 Date: 23 Jul 2003 03:44:12-0000 Message-ID: <20030723034412.23592.qmail@star2.ip.kyusan-u.ac.jp> Subject: test From: testuid@ip.kyusan-u.ac.jp To: naka@kyusan-u.ac.jp [-choice-] 1 b abe [--text--] [--text--]
Perl getcsv.pl while(<stdin>){ if( /^From: ([^@]+)@/ ){ $from = $1;} elsif( /^Date: S+, ( d+ w+ d+) ( d+: d+: d+)/ ){ $date = $1; $time = $2;} elsif( /^ [-choice- ] (.*)$/ ){ $choice = $1;&jcode'convert(*from, 'sjis'); print " "".$from." ", "".$date." ", "".$time." ""; print ",".join(',',split(/ s/,$choice));} elsif( /^ [--text-- ] (.*)$/ ){ text = $1; &jcode'convert(*text, 'sjis'); print ", "".$text." "";}}
Perl Excel
Excel HTML
3. Windows AN HTTPD Active Perl next,next,... Perl Perl C: Perl bin cgi-lib.pl jcode.pl cgi-bin wsendmail.txt SMTP sendmail.cgi C: Perl bin
public_html [ ] index.htm [ ] cgi-bin [CGI ] cgi-lib.pl, jcode.pl [ ] exectest.pl, sendtest.pl onlinetest test.htm data.txt
AN HTTPD 1.42h http://www.st.rim.or.jp/~nakata/ Active Perl 5.8.0.806 http://www.activestate.com/ Perl v.2.0.4.5 http://homepage3.nifty.com/aokura/ cgi-lib.pl http://cgi-lib.berkeley.edu/ jcode.pl http://srekcah.org/jcode/ wsendmail.txt http://wan.magical.gr.jp/txt/winsendmail.htm
&URL Q&A Perl & CGI IDG ISBN4-87280-457-0 Perl ISBN4-7741-98717-0 WWW http://tohoho.wakusei.ne.jp/www.htm FUJI21 CGI E http://www.fuji21.jp/easycgi/index.html