Perlããã°ã©ãã®ã¬ãã«10 - Perlããã°ã©ãã³ã°æå½ç æ£ãã
ããã°ã©ããã¨ä¸è¨ã§è¨ã£ã¦ããifæã®æå³ãããããç解ããã°ããã®é§ãåºãã®ããã°ã©ããããã°ãæ±ç¨çã§åªããã©ã¤ãã©ãªãéç£ã§ãããããªåè ã®ããã«ã¼ããããã¤ã¾ãã¯ãã³ããã§ãã
Perlããã°ã©ãã«é¢ãã¦ã¯ã©ãã§ããããä¸æµã®Perlããã°ã©ãã«ãªãããã«ã¯ãè¦ããªãé段ãããããã§ããuse strict ã使ãå§ããããã®é段ãä¸æ©ä¸ã£ãã¨è¨ããã§ãããããæ£è¦è¡¨ç¾ãç解ããã¨ããä¸æ®µããããã¨ã«ãªãã¨æãã¾ãããªãã¡ã¬ã³ã¹ãã¯ãã¼ã¸ã£ããªãã¸ã§ã¯ãæåãCPANã¢ã¸ã¥ã¼ã«ãmod_perlãMVCãã¬ã¼ã ã¯ã¼ã¯ãããããé段ãæ§æããææã®æ°ã ã¨è¨ããã§ãããã
ãã¦ãPerlããã°ã©ãã³ã°æå½ç æ£ã¨ããæ¸ç±ãããã¡ãã£ã¨é·ãã§ãããããªPerlããã°ã©ãã®ã¬ãã«10ã®ãªã¹ããå¼ç¨ãã¦ã¿ã¾ãã
ã¬ãã«1: Perl é¢ä¿ã®æ¸ç±ãè³æãä½ãèªãã§ããªããPerl ãããã°ã©ãã³ã°è¨èªã ã¨ãããã¨ã¯ç¥ã£ã¦ãããããã以å¤ã®ãã¨ã¯ä½ãç¥ããªããä»äººã®æ¸ããPerl ããã°ã©ã ãå®è¡ã§ããã®ã§ãããã°ã©ã ã®ä¸é¨ãç·¨éãããã¨ã§ããã°ã©ã ã®åä½ã®ä¸é¨ï¼åºåãããæååã®å 容ãªã©ï¼ãå¤æ´ã§ãããã¨ãç¥ã£ã¦ãããããã°ã©ã ã®ã»ãã®é¨åã«å¤æ´ãå ãã¦ããªããã¾ããããªãã®ãç解ãã¦ããªãããã®è¨èªã«åãã¡ã³ã¿ã«ã¢ãã«ãæã£ã¦ããªãã®ã§ãPerl ã®æ§æãCOBOL ã¨C++ ã®ãããªä»ã®è¨èªã®ãã®ã¨ã¯åºå¥ã§ãã¦ããªãã
ã¬ãã«2: åºæ¬ãããã¯æ§é ã®æ§æãç解ãã¦ããããJavaScript ã®ãããªè¨èªã«ä¼¼ã¦ããã¨ããç¨åº¦ã®èªèã«ã¨ã©ã¾ã£ã¦ããããããã¯ããã種ã®ã¹ã³ã¼ãå¹æãçããããã¨ããç解ã¯ãããã®ã®ãã¬ãã·ã«ã«å¤æ°ã®ãã¨ã¯ç¥ããªãããuse strict ã use warnings ã«åºä¼ã£ããã¨ããªããæ¡ä»¶ã®æå³ãå¤æ´ãããã¨ãã§ããåºæ¬çãªç®è¡æ¼ç®åã¨è«çæ¼ç®åæ¡ä»¶ã使ç¨ã§ãããå¿ è¦ã¨ãããã¹ã¦ã®ãã¨ããä»äººã®æ¸ããããã°ã©ã ã«è¥å¹²ã®å¤æ´ãå ãããã¨ã§éæã§ããã¨æã£ã¦ããã
ã¬ãã«3: ããã°ã©ã ãã¼ãããä½æããããããã種ã®æè²ãå¿ è¦ã ã¨ããã£ã¦ãããPerl ãå¦ã¶ã®ã«é©ããæ¸ç±ãæ¨è¦ãã¦æ¬²ããã¨æã£ã¦ããããã®ã¬ãã«ã®ããã°ã©ãã®ä¸ã«ã¯ãã©ã¯ãæ¬[WALL00] ããã¥ã¼ããªã¢ã«ã ã¨æã£ã¦æã«å ¥ãããã®å 容ãèªç ´ãããã¨ãã¦ãéããã©ã¦ãã«è¦ããè ããããããããªãã
ã¬ãã«4: use strict ã¨use warnings ãåãã¦å¦ã³ãæç¨æ§ãããåä»ããæãã¦ãããmy ã®æå³ã«ã¤ãã¦ææ¡ãã¦ããããããããªã¢ã¸ã¥ã¼ã«ã§ã»ã¨ãã©ã®åé¡ã解決ã§ãããã¨ã¯ç¥ã£ã¦ãããããããã®å ¥ææ¹æ³ã使ç¨æ¹æ³ã¯ç¥ããªããPerlã®ãã¥ã¼ã¹ã°ã«ã¼ãã«åå ãã¦ããããèªåã«é¢ä¿ã®ãªããããã¯ã«ã¤ãã¦ã®å¤§éã®è°è«ã«å§åããã¦ããã
ã¬ãã«5ï¼ æ£è¦è¡¨ç¾ãæ¼ç®åãI/Oãããã³ã¹ã³ã¼ãã«ã¤ãã¦åºæ¬çãªç解ããããçãè¨ã£ã¦ããã®ã§ãmyãuse strictãããã³use warnings ã使ç¨ãã¦ãããå¤ãã®äººãã¡ããã®ã¬ãã«ãè¶ ããªãã®ã¯ããã¨ãéå¹çã§ãã£ã¦ããåå©ç¨å¯è½ãªã³ã³ãã¼ãã³ãã®ä½æãé¤ãã°ãã»ã©ãã©ä½ã§ãã§ããããã§ããããã®ã¬ãã«ã次ã®ã¬ãã«ã§ã¯ããªãã¡ã¬ã³ã¹ã®ãã¨ãç¥ã£ã¦ããã
ã¬ãã«6ï¼ Perl ã®è¬ç¿ãåãã¦ãã人ãããããªãã¸ã§ã¯ãã®ä½¿ãæ¹ãç¥ã£ã¦ããããã®ç¥èã¨Comprehensive Perl Archive Networkï¼CPANï¼ãå©ç¨ããã°å¼·åãªããã°ã©ã ããã°ããä½æã§ããã¨ç¥ã£ã¦ããã次ã®ã¬ãã«ã«é²ãã§ããã®è½åæ¡å¤§ãã©ãã¾ã§è¡ãã®ãè¦ããã¨æã£ã¦ãã
ã¬ãã«7ï¼ ãªãã¸ã§ã¯ãæåã¢ã¸ã¥ã¼ã«ãèªåã§ä½æã§ããããã«ãªããã³ã¼ããåå©ç¨ãããã¨ã®åã³ãããããæãã¦ãããããã±ã¼ã¸ãªãã³ã«ã¬ãã·ã«ã«å¤æ°ã¨ãã¤ãããã¯å¤æ°ã®éããç解ãã¦ãããPerl ã®æ£è¦è¡¨ç¾ï¼regular expressionsï¼ããæ®éã®ãã¨ããæå³ã®ã¬ã®ã¥ã©ã¼ã§ã¯ãªããåç´ãªããã¹ãæä½ãã¯ããã«è¶ ãããã®ã ã¨ç¥ã£ã¦ãã
ã¬ãã«8ï¼ CPAN ã«ãã°ã¬ãã¼ããããããã¢ã¸ã¥ã¼ã«ãéã£ãããããã¥ã¡ã³ãã«ã¤ãã¦ææ¡ããããåå¿è ã«å©ãèãåºããããããªã©ãPerl ã³ãã¥ããã£ã«å¯ä¸ããããã®æ´»åãéå§ãã¦ãããAUTOLOAD ãªã©ã®é«åº¦ãªæ©è½ãç¥ããClass::MethodMaker ãªã©ã®éçºè åãã¢ã¸ã¥ã¼ã«ã使ãå§ãããDBI ãTk ãªã©ã®è¤éãªã¢ããªã±ã¼ã·ã§ã³ã¢ã¸ã¥ã¼ã«ãé©å®ä½¿ç¨ãããCGI.pm ãé§ä½¿ãã¦Web ãã¼ã¹ã®ã¢ããªã±ã¼ã·ã§ã³ãä½æãã
ã¬ãã«9ï¼ Perl ã«ã³ãã¡ã¬ã³ã¹ã«åºå¸ãããªã©ãPerl ã³ãã¥ããã£ã¸ã®é¢ä¸ãæ·±ãããwww.perlmonks.org ã#perlï¼ç¬¬12 ç« ãåç §ï¼ã«é »ç¹ã«ã¢ã¯ã»ã¹ãã¦ãããããããªããeval ã§ã³ã¼ãããã®å ´ã§ä½æããããã·ã³ãã«ãã¼ãã«ãæä½ããã¨ãã£ããã¨ã楽ã«è¡ãããã³ã¼ãã£ã³ã°ã«ããã¦ããã³ãã³ããã©ã¼ãã³ã¹ã®ãã¨ã«æ°ãé£ãï¼ãã¶ãå¿ è¦ä»¥ä¸ã«ï¼ãã¡ã¸ã£ã¼ãªã¢ã¸ã¥ã¼ã«ããµãã¯ã©ã¹åãã¦éè¦ãªæ©è½ãã¤ãå ããã¢ã¸ã¥ã¼ã«ãå ¬éãã
ã¬ãã«10ï¼ Perl ã®obfuscation ã³ã³ãã¹ãããgolfãã³ã³ãã¹ã*3 ã«åå ããããã¨ãã°ãæ®éã®ããã°ã©ããªã1 ã¤ã®ããã°ã©ã ã丸ãã¨å¿ è¦ã¨ãããããªé¢æ°ããåãè¾¼ã¿ã³ã¼ãã使ã£ã¦åä¸ã®æ£è¦è¡¨ç¾ã§å®è£ ãã¦ãã¾ããPerl ã³ã¢ã«ããããéã£ãããæ°ããã¡ã¸ã£ã¼ãªã¢ã¸ã¥ã¼ã«ãå¯è´ããããããã¨ã§ãPerl ã³ãã¥ããã£ã§æå人ã«ãªããããããªã
ããã«ã¬ãã«æ°ã大ãããã¦ããã¨ãããã«è©²å½è ãLarry Wall ã ãã«ãªãã¾ãã
ãããã§ãããããã¬ãã«ããã¤ã«ç¸å½ããã§ãããããåãç¥ãéããã¬ãã«7以ä¸ã®ããã°ã©ãã¯ãããªã«å¤ããªãããã§ããã¬ãã«8以ä¸ã«ãªãã¨ãå¨å²ã®ç¥äººããæ¢ãã®ãé£ãããªã£ã¦ãã¾ããã¬ãã«9以ä¸ã®äººã¯ãç¥äººã®ä¸ã«ã¯çæã§æ°ããããç¨åº¦ãããã¾ããã
ãã®ã¬ãã«10ãæ¸ãã¦ãã Perlããã°ã©ãã³ã°æå½ç æ£ (Programmerâs foundations)ãå®ã¯åãç£è¨³ãããã¦ããã ããæ¸ç±ã§ããåè㯠Perl Medic: Transforming Legacy Codeãuse strict ã使ã£ã¦ããªãã°ãã¼ãã«å¤æ°ã ããã®ã¹ãã²ããã£ã³ã¼ããããããã¬ã¬ã·ã¼ãªPerlã¹ã¯ãªãããã©ããã£ã¦ä»é¢¨ã«çã¾ãå¤ãããããããã®éç¨ãéãã¦Perlã®"ãã¼ã¯ãµã¤ã"ã«å ã¡ãªãããã«ããã«ã¯ã©ãããããããããæãã¦ãããä¸åã§ãã
ãããããã¬ãã«3 ãã ã¬ãã«8 ã¾ã§ã®ãã¹ã¦ã® Perl ããã°ã©ãã«ããããã§ããæ¬ã ã¨æãã¾ããçºå£²æ¥ã¯9æ5æ¥ã8æ27æ¥åææ¥ã«éå¬ããã Lightweight Language Day and Nightã§å è¡è²©å£²ããã¨ã®ãã¨ã§ãã
Perlã¯å¤æ°å®£è¨ããªã㦠typo ã«æ°ä»ããªãã£ããããã®ãå«ã¨æã£ã¦ããæ¹ãã使ããè¨èªã¯Perlã¨èãã¨èé«åå°ãã¦ãã¾ãæ¹ãªã©ã«æ¯éèªãã§ããã ãããã®ã¯ãã¡ããã綺éºãªã³ã¼ããæ¸ãããã«ã¯ã©ãããã°ããããCPAN ããæç¨ãªã¢ã¸ã¥ã¼ã«ãè¦ã¤ããã«ã¯ã©ãããããããããã¹ããèªååããããã«ã¯ã©ãããããããã¨ãã£ããã¨ã«é ãæ©ã¾ãã¦ããPerlããã«ã¼ã®æ¹ã ã«ãèªãã§ããã ããã¨å¬ããã§ãã