Perl ·s¤â¥²Åª1. ¤°»ò¬O Perl ¡H Perl ´N¬O Practical Extraction and Reporting Language ªºÂ²ºÙ¡A¬O¤@ºØ³Ì¼sªxÀ³¥Î©ó»yªk¤ÀªR©M World Wide Web ªº½sµ{»y¨¥¡C¥¦°_·½©ó awk¡BC¡Bsh ©M sed »y¨¥¡AµM¦Ó¡A¥¦ªºÀ³¥Î¶}µo»·¤ñ¨ä¥L¥ô¦ó¤@ºØ±¦V¹ï¶H½sµ{»y¨¥§ó¥[®e©ö¡C Perl »y¨¥¥Ñ Larry Wall ³Ð«Ø¡A³Ìªì§@¬°¤@ºØ¹ê¥Î¸ÑÄÀ»y¨¥¡C¨ä¥Dn¥\¯à³Ìªì¬O¥Î©ó¤ÀªR°ò©ó¤å¥»ªº¼Æ¾Ú©M¥Í¦¨³o¨Ç¼Æ¾Úªº²Îp©Îµ²ªG¡CÀHµÛ Internet ªº´¶¤Î±À¼s¡A§Ṳ́w¸g·P¨ü¨ì Perl ¦b CGI ½sµ{©M³B²z®æ¦¡¼Æ¾Ú¤Wªº±j¤j¥\¯à¡C¥Ñ©ó Perl ¹ï process¡B¤åÀÉ©M¤å¦r¦³«Ü±jªº³B²z¡BÅÜ´«¯à¤O¡A¦]¦¹¤Z¬O¦³Ãö§Ö³t쫬³]p¡B¨t²Î¤u¨ã¡B³n¥ó¤u¨ã¡B¨t²ÎºÞ²z¡B¸ê®Æ®w³sµ²¡B¹Ï¹³µ{¦¡³]p¡Bºôµ¸³sµ²©M www.µ{¦¡³]pµ¥¤§Ãþªº¥ô°È¡A³£¯S§O¾A¦X¥Î Perl ¨Ó§¹¦¨¡C 2. Ãö©ó #!/usr/bin/perl ¦b Perl µ{§Ç¤¤¡A²Ä¤@¦æ¥²¶·¬OªA°È¾¹¤W Perl ¸ÑÄÀ¾¹ªº¸ô®|¡A¤@¯ë¬O #!/usr/bin/perl ©Î #!/usr/sbin/perl¡A¦pªG§A¤£²M·¡¡A¥i¥HÁpô§Aªº¥D¶ªÅ¶¡´£¨Ñ°Ó¡C¦b WIN95/98/NT ªº¾÷¤W¸Ë¤F Perl ¸ÑÄÀ¾¹«á(°²³]¸ô®|¬O c:perl)¡A¦pªG§A¥Îªº¬O Apache WEB ªA°È¾¹¡A«h²Ä¤@¦æ¥²¶·¶ñ¼g #!/perl/bin/perl ¡A¦pªG§A¥Îªº¬O omniHTTPd ©Î IIS ªº¸Ü¡A¥u»Ý«O¯d #!/usr/bin/perl §Y¥i¡C 3. CGI-BIN ¥Ø¿ý¬O¤°»ò¡H CGI-BIN ¬O Perl µ{§ÇªºÀq»{¦s©ñ¥Ø¿ý(¹ê»Ú¤W¦¹¥Ø¿ý¦W¦r§¹¥þ¬O¥Ñ webmaster ©w¸qªº)¡A¨t²ÎÀq»{³oӥؿý¤¤ªº©Ò¦³¤å¥ó³£¬O CGI µ{§Ç©Î¬O CGI µ{§Ç¥Î¨Ó½Õ¥Îªº¼Æ¾Ú¡C¹ï©ó Apache ©Î IIS WEB ªA°È¾¹¡A¸Ó¥Ø¿ý¤U¤£¯à¦s©ñ¹Ï¹³¡BÁnµ©M HTML ¶±(³o¨Ç¤å¥ó¥²¶·®Ç½ÛîñŹ¦¨¨t¶uµÈ携¬_¸ë¡A¦ý¦pªG§A¥Îªº¬O omniHTTPd WEB ªA°È¾¹ªº¸Ü¡A´N¨S¦³³oÓ¨î¡C 4. Perl µ{§Ç¤¤¯à¥Î ¨Ó¹j¶}¤l¥Ø¿ý¶Ü¡H ©M HTML ½sµ{¤@¼Ë¡APerl ¹ï¤l¥Ø¿ý¤À¹j¥Îªº¬O / ¡A¦Ó¤£¬O ¡C 5. Perl µ{§Çªº¤W¶Ç¤è¦¡ ¦b FTP ¤¤¡A¤@Ó¤å¥óªº¤W¶Ç¤è¦¡¦³¨âºØ¡A¤@ºØ¬O ASCII¡A¤@ºØ¬O Binnary¡A¤W¶Ç Perl µ{§Ç¥²¶·¥Î ASCII ¤è¦¡¤W¶Ç¡A§_«h´N·|¥X²{ 500 Internal Server Error ªº¥X¿ù«H®§¡C ¦b¦´Áªº CuteFTP ¤¤¡A¥ÎÀq»{ªº AUTO ¤W¶Ç Perl µ{§Ç¹ê»Ú¬O¥Î Binnary ¤è¦¡¶Çªº¡A©Ò¥H¨Ï¥Î®É¤@©wn§a AUTO §ï¬° ASCII¡A¦Ó³Ì·sªºª©¥»¤¤¡ACuteFTP ªº AUTO ¤W¶Ç Perl ¤å¥ó¬O±Ä¥Î¤F ASCII ¤è¦¡¡A©Ò¥HµL»Ýקï¡C 6. Unix ¤U©M WIN ¤U¡A¥Î Apache ©M IIS ¹ïµ{§Ç¹B¦æ®ÄªG¦³¤°»ò¼vÅT¡H ¦b WIN Àô¹Ò¤U¡A¬O¤£¤ä«ù Unix ¤Uªº¤@¨Ç¯S®í¨ç¼Æªº¡A¤ñ¦p flock() ¨ç¼Æµ¥¡A¦]¦¹¦pªG§Aªºµ{§Ç¦b WIN ¤U¹B¦æ¤£¥¿½T(¤@¯ë¬O¥X²{¥Õ¶)¡A¥i¥H¹Á¸Õ§R°£ flock() µ¥¨ç¼Æ¡C¦b WIN ¤U¡AµL»Ý³]¸m Perl µ{§ÇªºÄÝ©Ê¡A¦Ó¦b Unix ¤U¡A¥²¶·³]¸m¦n¥¿½TÄÝ©Ê«á¤~¯à¹B¦æ(¨ãÅé½Ð¨£'Perl µ{§ÇªºÄݩʤΨä³]¸m²»¸Ñ'¤@¤å)¡C ¦b WIN Àô¹Ò¤U¡A¦³¨âºØ¥D¬y WEB ªA°È¾¹¡A¤@ºØ¬O Apache¡A¤@ºØ¬O IIS¡C¥Dnªº°Ï§O¬O Apche ¦bªí¥Üµ´¹ï¸ô®|®É¥i¥Îµ´¹ï¸ô®|ªº¬Û¹ï§Î¦¡¨Óªí¥Ü¡A¦ý IIS ¥²¶·¥Î§¹¾ãªºµw½L¸ô®|ªí¥Ü(¨ãÅé½Ð¨£'µ´¹ï¸ô®|»P¬Û¹ï¸ô®|²»¸Ñ'¤@¤å)¡C §ó¦hÃö©ó¡GPerl ·s¤â¥²Åª ¨ä¥¦ ¬ÛÃö¸ê°T¡G |