Perl OO ã«ããããªã¼ãã¼ããã
ãã¬ã¼ã ã¯ã¼ã¯ãèããã«ããã£ã¦ãæ°ã«ãªãé¨åã®ãã³ããã¼ã¯ãåã£ã¦ã¿ãã
ãã¤ã³ãã¯æ¬¡ã®ï¼ç¹ã
- é¢æ°ã®å¼ã³åºãæ¹æ³ï¼ Class::func() 㨠Class->func() å½¢å¼
- ã¯ã©ã¹ãç¶æ¿ããå ´åã®ããã«ãã£ï¼ Class->() 㨠SuperClass->()
- é£æ³é åã¸ã®ç´æ¥ã¢ã¯ã»ã¹ã¨ãã¢ã¯ã»ãµçµç±ã®ã¢ã¯ã»ã¹
Perl ã«ãããé¢æ°åã®å®è£ 㨠OO ã®å®è£ ã§ãé¢æ°å¼ã³åºã/ã¡ã½ããå¼ã³åºãã§ã©ã®ç¨åº¦ã®ãªã¼ãã¼ãããã®å·®ããããããã³ããã¼ã¯ããçµæãåå¼·ã«ãªãã¾ããçµæã¨ãã¦ã¯é¢æ°åã«å¯¾ã㦠OO ã®æ¹ãæ°åé ããã¨ããçµæã
ããã§ãçµè«ã®æ¹ãªã®ã§ãã
æ¬æ¥ãªããã¢ããªã±ã¼ã·ã§ã³ããä¸ä½ã«ãããã©ã¤ãã©ãªé¢é£ã¯ããªãã¸ã§ã¯ãåãã㦠mod_perl ä¸ã§å ±æãããã¡ãªããã¯ãããããããªãããã¢ããªã±ã¼ã·ã§ã³ã®ä¸ä½ã«ããããã¬ã¼ã ã¯ã¼ã¯ã¯ãmod_perl ä¸ã§å ±æãããæ義ã¯ãã¾ããªãï¼å°ãªãã¨ããã©ã¤ãã©ãªã»ã©ã§ã¯ãªãï¼ã¨æãããã
ã¨ããã®ã¯å°ãããã³ããå ¥ãã¦ããããããªãã¨æãã¾ãã
ã¾ããPerl 㧠OO ãªå®è£ ãããã¨ãã®é度ã§æãåé¡ã«ãªãã®ã¯ã©ãããã¨ããã¨ãããªã®ã§ãããã¡ã½ããå¼ã³åºããããé¥ãã«å¤§ããã®ãã¯ã©ã¹ã®ãã¼ãã«ããã£ã¦ãããªã¼ãã¼ãããã§ããOO ã§å®è£ ããã¨ãã¢ããªã±ã¼ã·ã§ã³ã®èµ·åæã«å¤ãã®ã¢ã¸ã¥ã¼ã« = ã¯ã©ã¹ããã¼ãããå¿ è¦ãåºã¦ãã¾ãããåç¥ã®éã Perl ã¯ã¢ããªã±ã¼ã·ã§ã³å®è¡æã«ã½ã¼ã¹ã³ã¼ããä¸åº¦ã³ã³ãã¤ã«ããã®ã§ãããã¢ã¸ã¥ã¼ã«ãå¤æ°ã«ãªã£ãå ´åãããã§ãªãå ´åã«æ¯è¼ãã¦ããã«å¿ è¦ã¨ãããå¦çéã¯ããªãã®ãã®ã«ãªãããã§ãã
ããã¯å¥ã« Perl ã«éã£ã話ã§ã¯ããã¾ãããJava ã«ãã¦ãä»ã®è¨èªã«ãã¦ããã¢ããªã±ã¼ã·ã§ã³èµ·åæã«ã¯ã©ããã¦ãä½ãããã®ãªã¼ãã¼ãããããããã¾ãã1ãªã¯ã¨ã¹ããã¨ã«ã¦ã§ããµã¼ãã¼ã®ãµãããã»ã¹ãçæãçµäºãç¹°ãè¿ã CGI ã®ãããªç°å¢ã§ã¯ã1ãªã¯ã¨ã¹ãæ¯ã«ã¢ããªã±ã¼ã·ã§ã³ãèµ·åãçµäºããããããã®ãªã¼ãã¼ããããã¢ããªã±ã¼ã·ã§ã³ã®å¦çãµã¤ã¯ã«ã®ä¸ã§ããªãæ¯é çãªãã®ã«ãªãã¾ãã
ããã§ãèµ·åæã®ãªã¼ãã¼ãããããªããããã«ãããã»ã¹ãçµäºãããã«ã³ã³ãã¤ã«æ¸ã¿ã®ã³ã¼ããã¡ã¢ãªä¸ã«ãã¼ãããã¾ã¾ã«ãã¦ããã次åã¢ã¯ã»ã¹æã«ãããã使ãã¾ããã¨ããæ°¸ç¶åã®ææ³ã§ãã®åé¡ã解決ãã¾ãããã¨ããã¢ããã¼ããåããããã¨ã«ãªãã¾ããããã Java Servlet ã ã£ãã mod_perl ã ã£ãã FastCGI ã ã£ãããã¾ãã
ã¨ãããã¨ã§ãOO 㪠Perl ã®ã¦ã§ãã¢ããªã±ã¼ã·ã§ã³ãã¬ã¼ã ã¯ã¼ã¯ã¯ãmod_perl ã®æ©æµã«ãããããæãããã®ãã¨ããã®ãåã®èªèã§ãã
éã« mod_perl ç°å¢ä¸ã§åä½ããããã¨ãã§ããªãå ´åã¯ãOO å®è£ ã«ãããªã¼ãã¼ããããåé¿ãããã¨ãã§ããªãããããã©ããã¨ãããã¨ã«ãªãã¾ãããããããããç¨åº¦ã®åé¿æ¹æ³ãããã¾ããèµ·åæã«æ¥µåæä½éã®ã¯ã©ã¹ã®ã¿ãã¼ããã¦ããããã¨ã¯å¿ è¦ã«ãªã£ãã¨ããã§åçã«ãã¼ããããã¨ããæ¹æ³ã§ããå ·ä½çã«ã¯ãæä½éã®ã¯ã©ã¹ã¯ã¹ã¯ãªããå é 㧠use ã§ãã¼ããã¦ããã以å¤ã¯ã¡ã½ããã®ä¸ãªã©ã§ require ã eval & use ã«ããå¼ã³åºããã¨ããæ¹æ³ã§ãã
å¼ç¨å ã§ãèå¯ãå ãããã¦ãã Movable Type ã¯ãé å¸åããã±ã¼ã¸ã§ãããã CGI ã§ãåãã mod_perl ã§ãåãã¨ããå®è£ ã«ãªã£ã¦ãã¾ããCGI ã§åä½ãããå ´åãèããã¨ãèµ·åæã®ãªã¼ãã¼ããããæããªããã°ãªããªãã®ã§ã主ãªå¤é¨ã©ã¤ãã©ãªã¯ require ã«ãããªãã¹ãå¿ è¦ã«ãªãç´åã§ãã¼ããããããªå®è£ ãæ½ããã¦ããããã§ããMovable Type ã mod_perl ç°å¢ä¸ã§åä½ãããã¨åçã«é度ãåä¸ããã®ã¯ãä¸åº¦èªã¿è¾¼ãã ã¢ã¸ã¥ã¼ã«ã mod_perl ãæ°¸ç¶åãããããèµ·åæã¨requireã«ããåçãã¼ãã®ãªã¼ãã¼ãããããªããªãããã§ãã
ä¸æ¹ãã¯ã¦ãªãæä¾ããä¸é£ã®ãµã¼ãã¹ã®ãããªãµã¼ãã¼ãµã¤ãã¢ããªã±ã¼ã·ã§ã³ã§ã¯ããã®è¾ºãä¸åèæ ®ããªãã¦ããã®ã§ãèµ·åæã«ä¸æ°ã«ã¾ã¨ãã¦ãã¼ãããã®ãåã§ããmod_perl ã«é¢ãã¦ã¯ããµãããã»ã¹ã§åãã¦ãã¼ããããã¢ã¸ã¥ã¼ã«ã¯ã親ããã»ã¹ã¨ã®éã§ã¡ã¢ãªå ±æãçºãããªãã¨ããä»æ§ã«ãªã£ã¦ãã¦ãApache ã®èµ·åæã«ãã¹ã¦ãèªã¿è¾¼ã¾ããæ¹ãã¡ã¢ãªã®ç¯ç´ã«ãªãã¾ããããã§ã¯ã¦ãªã§ã¯ããã®ãµã¼ãã¹ã«å¿ è¦ãªã¢ã¸ã¥ã¼ã«ã¯ãã¾ã¨ãã¦å ¨é¨ãã¼ãããããã« startup.pl ã«å·¥å¤«ãæ½ãã¦ããã¾ãã
ã¨ãããã¨ã§ãmod_perl ã«ãããã¨ã§ Perl OO ã®æ大ã®åé¡ç¹ã¯ææã§ãã¾ããããã¾ã§æ¥ã¦ããããã¡ã½ããå¼ã³åºãã®ãªã¼ãã¼ããããèããå¿ è¦ãã§ã¦ããããã§ãããã¦ã§ãã¢ããªã±ã¼ã·ã§ã³ã®ã©ã¤ããµã¤ã¯ã«ã®ä¸ã§ã¯ãé¢æ°å¼ã³åºãã¨ã¡ã½ããå¼ã³åºãã®å·®ã¨ããã®ã¯ç¸å¯¾çã«èãã¦ãã»ã¨ãã©ç¡è¦ã§ããã¨è¨ã£ã¦ãããã¨æãã¾ãããããããããããã¯ã¼ã¯ã§ã®ããã¨ãããã£ã¹ã¯I/O ããã¼ã¿ãã¼ã¹ã¢ã¯ã»ã¹ãfork ã«ãããµãããã»ã¹ã®çæã¨ãã£ãå¤çãªè¦å ãæ¯é çã«ãªããã¨ãã»ã¨ãã©ã§ãããããã©ãã ãæå°éã«ã¾ã§æããåªåãããã¨ãã¦ããã¡ã½ããå¼ã³åºãã使ããã«é¢æ°å¼ã³åºãã«ããå¹æãæ¯é çã«ãªãã»ã©æãããããã¨ã¯ãªãã¨æãã¾ãã
ãã¨ã¯ããä¸ç¹ãç¹ã«ãããéè¦ãªãã¤ã³ãã ã¨æãã¾ãã以åã«ãå¼ç¨ãããDamian Conway ã® OO æ¬ã®ä¸ç¯ã§ãã
ä¸è¬ã«ã¯ããªãã¸ã§ã¯ãæåPerlã«ããã·ã¹ãã ã®å®è£ ã¯ãããã¨ç価ã®éãªãã¸ã§ã¯ãæåå®è£ ãããé«éã«ãªããã¨ã¯ãªããå®éã«ã¯æ¯è¼ãã¦é常20ã50ãã¼ã»ã³ãã»ã©ä½éã«ãªãã
ãã®æ°åã¯ãªãã¸ã§ã¯ãæåPerlããå¤ãã®ã¦ã¼ã¶ãé ãããã»ã©ååã«å¤§ãããããããªããããªãã¸ã§ã¯ãæåã®è¨è¨é¢ããã³å®è£ é¢ã®ãããè£ããã¾ãã¾ãªãç¹ãè¦éãã®ã¯æ²åçã§ããã
(ä¸ç¥)æ®å¿µãªããå¤ãã®äººã¯ãã20ã50ãã¼ã»ã³ãã®ä½éåãã¨ããæ°åã«æããããéå»6ãæéã§ããã»ããµé度ã2åã«ãªã£ãã«ãããããããä½ãæå³ãã¦ãããå¿ããã¡ã«ãªãã
CPUã®é²åãèããã°ãPerl OO ã«ãããé度ä½ä¸ã«ãããã¡ãªããããã OO ã«ãã£ã¦å¾ãããã¡ãªããã®æ¹ãå§åçã«å¤§ããã®ã ãã¨ãã話ãããã¯åãæ¿ããåæãªã®ã§ãã
ã¨ãããã¨ã§ããã¬ã¼ã ã¯ã¼ã¯ã«ãªãã«ãã¦ããå°æ¥ã®ä¿å®æ§ã®ãã¨ãèããã®ã§ããã° Perl OO ã§ããããæ¸ãã¦ããã¾ããããã¨ãã話ã§ããã
- ä½è : ããã¢ã³ã³ã³ã¦ã§ã¤,Damian Conway,å±±æ ¹ããã¥ã¡ã³ãã¼ã·ã§ã³
- åºç社/ã¡ã¼ã«ã¼: ãã¢ã½ã³ã¨ãã¥ã±ã¼ã·ã§ã³
- çºå£²æ¥: 2001/02
- ã¡ãã£ã¢: åè¡æ¬
- è³¼å ¥: 6人 ã¯ãªãã¯: 154å
- ãã®ååãå«ãããã° (38件) ãè¦ã
追è¨: C ã Java ã®ãããªã¹ã¿ãã£ãã¯ãªè¨èªã«æ¯è¼ã㦠Perl ãä¸å©ã«ãªãç®æã¯ç´ç²ãªæå³ã§ã®è¨ç®å¦çã§ããPerl ã使ã£ã¦ãããã¨ã§ãããåé¡ã«ãªãå ´åã¯ãããã XS å®è£ ã«ãã¦è§£æ±ºããã¨ããæ¹æ³ãããã¾ããã¯ã¦ãªã®ããã°ã©ãã¯ã¿ãª Perl ã¯å¾æã ããã©ããã®ã»ãã®è¨èªã«ã¯çããã¨ããç¶æ³ã ã£ãã®ã§ãããPerl ãããä½ãã¬ã¤ã¤ã§ã®å®è£ ãå¾æãªid:higepon ãã¯ã¦ãªã« join ãã¦ããããããã§ããã®è¾ºã®å¹ ãåºãã£ã¦ãã¾ãããæ¢ã«ããã¤ã XS ã§å®è£ ãç´ãã¦ããã£ãå¦çãªããããã£ã¦ããã®å¹æã¯ããªã大ããªãã®ã«ãªã£ã¦ãã¾ãã
ãã¨ã¯ãXML é¢é£ã®å¦çãåããããªãã®ã§ãããªã¯ã¨ã¹ãã®æ°ã«å¯¾ã㦠XML ã® parse ã®å¦çåæ°ãæ¯ä¾ãããããªã±ã¼ã¹ã§ãä¸ã¤ãªã¯ã¨ã¹ãæ°ãç¸å½ãªãã®ã«ä¸ãç®æã§ã¯ XML parser ãå©ç¨ãããªã¼ãã¼ãããã大ããã®ã§ãããããå ´å㯠parser ã¯ä½¿ããã«æ£è¦è¡¨ç¾ã使ããªã©ãã¦å¦çé度ãåä¸ãããããã¨ãããã¨ããã£ã¦ãã¾ãã(å é¨ã§ expat ã使ã XML::Parser ã使ã£ã¦ããã¢ã¸ã¥ã¼ã«ãä¾ãã° XML::RSS ãªããã¯ãã®æããä¾ã§ããããããã«é¢ãã¦ã¯ XML::RSS::LibXML ã¨ãã expat ãããããªãé«éãªå®è£ ãåºã¦ãã¦ããã®ã§ãæè¿ã¯ãã¡ãã使ã£ã¦æ£è¦è¡¨ç¾ã¯ä½¿ããªãããã«ããªã£ã¦ãããã¾ãã)