移転ãã¾ãã http://please-sleep.cou929.nu/20090425.html
移転ãã¾ãã http://please-sleep.cou929.nu/20090425.html
[2013-11-20: Print::IndentedãCPANã«ãªãã¦ãããã¼ããã¦ããã ã¨ã®ãã¨ã§ shipit ãããã¾ããã ããã¼ãï¼] éå»ã®ããåãããªãã³ã¼ãã®æåãææ¡ãããã¨ãã«ã¯ print (warn) ããã®ãå°ãªãã¨ãã¨ããããã®æ¹æ³ã¨ãã¦ã¯å¸¸å¥æ段ã§ãããããããã å¹³å¦ã«ç»é¢ã«ç¾ããã ãã ã¨è¦ã¥ãããä¾ãã°æ¡ä»¶åå²ãã«ã¼ãã®ä¸ã«ããæã¯åºåãã¤ã³ãã³ãããããã«ããã¨åããæ´ã¿ããããªãããã©ããã ã§ãã人éã«åç´å´åã課ã print ãããã°ã«ããã¾ã§å´åã使ãã®ã¯è¾ããããããé¢åããæ¸ãããã¨ããåæ©ã§ããã®ã¢ã¸ã¥ã¼ã«ã¯æ¸ããã¾ããã https://github.com/motemen/perl5-Print-Indented ä¸ä½ä½ãããã®ãã¨ããã¨ä»æ¸ããéãã§ãããprint æã«ããã® print é¢æ°ã®å¼ã³åºãã³ã¼ãã®ã¤ã³ãã³ãã«å¿ãã¦
注ï¼æ¬ç¨¿ã¯ã¾ã æ¸ãããã§ãï¼æ¸ãããã§ãï¼ã¾ã ä¸è¬ã«ç¥ãããããã¨ããåã«ãã¯ãããã¾ããï¼ï½ ééãã®ææãã³ã¡ã³ãç㯠lestrrat @twitter ã«ãã ããï¼ Perlç°å¢ã®è¨å®æ¹æ³ã¯ããæ°å¹´ã§å¤§ããé²åããå¤ãã£ã¦ãã¾ãããããã§ã¯ã¢ããªã±ã¼ã·ã§ã³ã®ãããã¤ãè¦æ®ãããã¢ãã³ãªperlç°å¢ã®æ´ãæ¹ãç´¹ä»ãã¦ããã¾ããå ·ä½çã«ã¯perlæ¬ä½ãå¤é¨ã¢ã¸ã¥ã¼ã«ã®ã¤ã³ã¹ãã¼ã«æ¹æ³ã解説ããã®ã¡ãPerlã使ã£ãã¢ããªã±ã¼ã·ã§ã³ã管çã»éç¨ãã¦ããéã«ä¾åé¢ä¿çã¯ã¢ããªã±ã¼ã·ã§ã³æ¯ã«ç®¡çã§ããããã«ãã¦ã°ãã¼ãã«ç°å¢ã«å¯è½ãªéãå¹²æ¸ããªãæ¹æ³ãç´¹ä»ãã¾ãã ç®æ¬¡ 1.1 Perlæ¬ä½ã®ã¤ã³ã¹ãã¼ã« 1.2 ä¾åã¢ã¸ã¥ã¼ã«ã®ç®¡çã»ã¤ã³ã¹ãã¼ã« 1.3 Cartonã«ããã¢ããªã±ã¼ã·ã§ã³ã®å®è¡ç°å¢ã®æ§ç¯ tl;dr æ¬ç¨¿ãèªãåã«ãã¤ã³ãã ãç¥ãããï¼ã¨ããæ¹åãã®ã¾ã¨ãã§ãï¼ OSã«å
çµã¿åããèªç±ãªãã¼ã«ããã Template Toolkitãé称TTã¯ããã®ååããããããããã«ããã¨ãã¨ã¯åãªããã³ãã¬ã¼ãã¨ã³ã¸ã³ã§ã¯ãªãããã³ãã¬ã¼ãã¨ã³ã¸ã³ãã¤ããããã®ãã¼ã«ç¾¤ãã¾ã¨ãããã®ã§ãããã®ãã¼ã«ç¾¤ãçµã¿åãããæ¨æºã®ã¨ã³ã¸ã³ãæ¨æºã®ããã³ãã¨ã³ãã¨å¼ã¹ããã®ãããã¾ãããããã¯ããã¾ã§ãTTã®ããããå©ç¨æ³ã®ã²ã¨ã¤ã§ãã£ã¦ããã®ãã¹ã¦ã§ã¯ããã¾ããã ãã¨ãã°ãCPANã«ã¯Apache::Templateã¨ãããTTã®ã¨ã³ã¸ã³é¨åãmod_perlç¨ã«ã«ã¹ã¿ãã¤ãºããããã§mod_perlç¨ã®ããã³ãã¨ã³ãããã¶ããã¢ã¸ã¥ã¼ã«ãããã¾ãããããã使ãã°ãæåã«å¤å°ã®è¨å®ã¯å¿ è¦ã«ãªããã®ã®ããã¨ã¯TTã®ãã³ãã¬ã¼ããé©åãªãã¹ã«ç½®ãã ãã§ããã©ã¡ã¼ã¿ã®åå¾ããã«ã¼ãã£ã³ã°ãã¬ã³ããªã³ã°ã¾ã§ãããªã«è¨ãã£ã¦ãããããã«ãªãã¾ãï¼TTã®ææ³ããµãã¼ãããPHPã®ãããª
Windowsã«ãããPerlã®ä»£åè©ã¨è¨ã£ã¦ãéè¨ã§ãªãã»ã©æ®åãã¦ããActivePerlãé常使ãã«ã¯ããã§ååãªã®ã§ãããPerlã使ãããªãä¸ã§ã¯æ¬ ç¹ãããã¾ãã ããã¯ãããæå³Perlã®èã¨ãè¨ããCPANã使ãã«ãããã¨ã åã«ã¢ã¸ã¥ã¼ã«ãã¤ã³ã¹ãã¼ã«ãããã ãã§ããã°ppmã使ãã°ç°¡åã«è¡ãã¾ãããåé¡ã¯ppmã§ä½¿ãããã¢ã¸ã¥ã¼ã«ãæä¾ããã¦ããªãå ´åã§ãã CPANããã½ã¼ã¹ããã¦ã³ãã¼ããã¦ã³ã³ãã¤ã«ããã®ã¯ãåå¿è ã«ã¯ã¡ãã£ã¨æ·å± ãé«ãæ¹æ³ã§ãã ããã§ãåºã¦ããã®ãPerlèªä½ãActivePerl以å¤ã«ããæ¹æ³ã§ããPerlã®ã½ã¼ã¹èªä½ã¯å ¬éããã¦ãã¾ãã®ã§ããããã³ã³ãã¤ã«ããã°Windowsã§ä½¿ããPerlãã§ãã¾ãããåãç°å¢ã§ã³ã³ãã¤ã«ããã°CPANã®ã½ã¼ã¹ã使ç¨ã§ãã¾ãã ã³ã³ãã¤ã«ç°å¢ãCygwinãcoLinuxã使ãã°ç¡æã§æ´ãããã¨ãã§ãã¾ãã
Apache ãã¤ã³ã¹ãã¼ã«ã§ãããã次ã¯è¨å®ã§ããããã©ã«ãã®ã¾ã¾ã§ãåé¡ãªãåä½ããã¯ãã§ãã®ã§ãã¾ãã¯ããã©ã«ããã©ã®ãããªç¶æ ã«ãªã£ã¦ãããã説æãã¾ããããã¦ãåãããã¤ãã¼ãã¬ã³ã¿ã«ãµã¼ãã«è¿ãç°å¢ã«è¨å®ãå¤æ´ãã¦ããã¾ãã ããã§ã¯ãããã©ã«ãã®è¨å®ãã©ã®ããã«ãªã£ã¦ããããã®è¨å®ãã©ã®ããã«ãªããã¦ããããè¦ã¦ããã¾ããã¾ã Apache ã®è¨å®ã¯ä½å¦ã§è¡ãããç¥ããªããã°ããã¾ããããããã§ã¯ãåºæ¬çãªè¨å®ã«çµã£ã¦èª¬æãã¾ãã é常ããã®ã¾ã¾ã¤ã³ã¹ãã¼ã«ãã¦ããã°ãC:\Program Files\Apache Group\Apache\conf ã®ä¸ã«å種è¨å®ãã¡ã¤ã«ãããã¯ãã§ããApache ã®å ´åãæ®å¿µãªãããGUI ã§ã®è¨å®ã¯ãªãããã¡ã¤ã«ãç·¨éãããã¨ã§è¨å®ããã®ã§ããWindowsã¦ã¼ã¶ã«ã¯åããã«ããããããã¾ããããUnixã§ã¯ä¸è¬çãªææ³ã§ãWindo
éçºã¡ã¢ãã®3ã§ããä»å㯠Perl ã®ãã¯ãªãã ä½å¹´ãåã«ä½ã£ãã¦ã§ãã¢ããªã±ã¼ã·ã§ã³ã®ã³ã¼ããéãã¦ã¿ããé»æ´å²ãªã³ã¼ããåºã¦ãã¦æ鬱ãªæ°åã«ãªãããããªçµé¨ããã¾ããããç§ã¯ããã¾ãããã£ã¨ãããªç¾å®ããç®ãèãã¦çãã¦ãã¾ããã ãã¦ãå æ¥ Perl + CGI ã§æ¸ã㦠Apache::Registry ã§é«éåãã¦ãããå®è¡ç°å¢ã Apache ã«ççãã CGIã¢ããªã±ã¼ã·ã§ã³ãçºè¦ãã¾ããããããã£ãä¸ããä½ãç´ãããæ°æã¡ããã£ã¨å ªãã¦ãããã Plack åãããã¨ãªãã©ã¼ã ãã¦ããã¨ãã¾ãããããã®éç¨ã以ä¸è¨ãã¾ããåçããã©ã¢ã»ã¢ãã¿ã¼! ・・・ã¨ãã¯æå¾ ãããå°éãªå¤æ´ãç©ã¿éãã¦ããã®ãã³ãã§ãã æ¹é ãããªãã³ã¼ããããããæ¸ãæãã¦ããã¨ããããã¯ã試è¡é¯èª¤ã®ããããç°å¢ã«ç§»è¡ããã¦ãããªãããªãã©ã¼ã ãé²ãã¾ããé åãã§ãããçµæçã«ãã®å¾ã®éç¨ã楽
æè¿ç¤¾å ã§vimåå¼·ä¼ããã£ãããã¦ãvimããããªããã¨æã£ã¦ããã®ã§ããããã£ã±ããã¼ãã¤ã³ãã«æ £ããªãã£ã¦Emacsã«æ»ã£ã¦ãã¾ãããæè¿Emacsã§Perlé¢é£ã®è¨å®ãè¦ãªãããã®ã§ãã¡ã¢ãã¦ãæ¸ãã¦ããã¾ããèªåãPerlã®ã³ã¼ããæ¸ãã¨ãã«ä½¿ã£ã¦ããelispã¯ä»¥ä¸ã®5ã¤ã§ãã cperl-mode flymake + set-perl5lib anything + auto-complete + perl-completion yasnippet ããããä¸ã¤ä¸ã¤ç´¹ä»ãã¦ããã¾ãã cperl-mode cperl-mode ã¯ãããªæãã§è¨å®ãã¦ãã¾ããã¨ããããè²ä»ãã¨é©åãªã¤ã³ãã³ãããªãããã°ããããªã¨ããæãã (autoload 'cperl-mode "cperl-mode" "alternate mode for editing Perl programs"
ã¯ããã¾ãã¦ãããã«ã¡ã¯ãéã¾ã人æ°ãããããã£ã¦ããã®ã«åæã« Win32 Track ãå§ãã¦æ¢ã«å¾æã®é¦ããã·ãã·ãæ¼ã£ã¦ãã xaicron ã§ãã Windows 㧠Perl ãæ¥å¸¸çã«æ¸ãã¦ãã人ã¯ãæ¥æ¬ã«3人ããããªãã¨è¨ããã¦ãã¾ã*1ã ãããªç¶æ³ãè±å´ããããã¿ã㪠Windows 㧠Perl ã使ããï¼ã ã£ã¦ãæ¬å½ã¯å¿ã®ã©ãã㧠Windows ã好ããªã¯ãã ããï¼ï¼ï¼ ã¨ã¯ããããWindows 㧠Perl ã£ã¦ã»ãã¾ã«åãããããªï¼ãã¨æãããããç¥ãã¾ãããããããæå¤ã¨ã¡ããã¨åãã¾ãã æµè¡ãã® Plack ã ã£ã¦åãããDBI ãåãããã¹ã¯ã¬ã¤ãã³ã°ã Excel æä½ã¾ã§ãæã®ç©ã§ãã ãã® Track ã§ã¯ãWindows ã§ å ¨ã Perl ãåããããã¨ããªã人ããæ¥å¸¸çã« Windows 㧠Perl ãåããã«è³ãããã«æ´è³ãã¾ãã®ã§ã
ãããããã³ã°ã¢ã³ã¹ã¿ã¼ã®ã¿ããªãå æ°ãã¼ãï¼ ã¼ãã¯æ®éã§ãã ãããã¯ã¿ããªã§ãã°ããããã¼ã¦ãããã±ã¿ã ã±ã¿ã ãã¡ãããï¼ããããã«ã¡ã¯ bayashi ã§ãã ãã¦ããã°ã¯è¦ã¦ãããï¼cat ãã¦ãããï¼ tail ãã¦ãããï¼ GBåä½ã®ãã°ã vim ã§éãã¦ããªã¼ãºããã¦ãããªãããï¼ãã°ã¯åãããçµãããããããªããï¼ã¡ããã¨ããã£ã¡ããªãã¨é¬¼ãã§ã¡ãããï¼ï¼ ã¨ã¯ããããããªãã°ããããã¦ãã¯1è¡ã«ã¤ãã¤ãã¨æ¸ããã¦ã¦è¦ãã®ãã¤ãããï¼ï¼ä¾ãã°ãããªãã¤ã ã $ tail log 127.0.0.1 - bayashi [10/Oct/2000:13:55:36 -0700] "GET /apache_pb.gif HTTP/1.0" 200 2326 "http://www.example.com/start.html" "Mozilla/4.0 (compatible
Perl Advent Calendar 4æ¥ç®ãæ å½ãã¾ãokamuuuã§ãã çããæåºããããã¨ãããé¨ãéã£ã¦ãã¦åãåãã«æ»ã£ãçµé¨ã¯ããã¾ãããï¼ ä»ä½ãã§ããã¨ããã¯ã¨ã¬ãã¼ã¿ã¼ä»ããªã®ã§ããããªãã¨ãããã¨ä¸ã¾ã§éãã¦ãã¾ãæã£ã¦ãååã£ã¦æ¥ã¦ã¾ãéããã£ã¦ããç¡é§ãªä½æ¥ãçºçãã¾ãã æ æ ¢ãªçããã¯ãã§ã«ãæ°ã¥ãã ã¨æãã¾ãããããã¯ããã¤ã¾ã§ãç¹°ãè¿ãããã§ãããç¡é§ãªä½æ¥ãã§ãã ãããªã®ããããã¯ãã¡ããã¾ãããã â»ã¡ãªã¿ã«ãã®è¨äºMacã¦ã¼ã¶ã¼ã対象ã«ãã¦ãã¾ãããäºæ¿ä¸ããã 天æ°æ å ±ãåå¾ãã ã¨ããããã§é©å½ãªå¤©æ°äºå ±ãµã¤ããå·¡åãã¾ããä»åã¯ä»¥ä¸ã®URLã使ãã¾ãã æ±äº¬é½ä»¥å¤ã®äººã¯é©å®èªåã®å°åã«ç½®ãæãã¦ä¸ããã http://weather.yahoo.co.jp/weather/jp/expo/umbrella/13/4410.html curl
ããã¹ãææ¸ããç°¡åã«HTMLãªã©ã®ã¿ã°ä»ãããã¹ããçæããããã®æ¹æ³ã®ã²ã¨ã¤ã¨ãã¦ããWikiè¨æ³ãã¨ãããã®ãããã¾ããããã¯HTMLãç´ã«ããªããªæ¸ãã®ã¯ãããªãã«æéããããããã«ä½ããã軽éãã¼ã¯ã¢ããè¨èªã§ãWikipediaã§ä½¿ãããç¬èªè¨æ³ããã¯ã¦ãªãã¤ã¢ãªã¼ã§ä½¿ç¨ã§ããã¯ã¦ãªè¨æ³ãªã©ããããã£ã軽éãã¼ã¯ã¢ããè¨èªã®ç¯çã«å ¥ãã¾ãã ãããã£ããã®ã®ã²ã¨ã¤ã§ãæ¯è¼çã¡ã¸ã£ã¼ãªãã®ã«ãMarkdownè¨æ³ãâ»1ãããããã®è¨æ³ã§æ¸ãããããã¹ãããHTMLã«å¤æããããã®ãText::Markdownãã¨ããPerlã®ã¢ã¸ã¥ã¼ã«ãå ¬éããã¦ãã¾ãã®ã§ãé»åæ¸ç±å¶ä½ã®ãã¼ã«ã¨ãã¦å©ç¨ã§ããã®ã§ã¯ãªããã¨æããã¡ãã£ã¨è©¦ãã¦ã¿ã¾ããã CPANããText::Markdownãã¤ã³ã¹ãã¼ã«ãã Mac OS Xã«ã¯æ¨æºã§Perlãã¤ã³ã¹ãã¼ã«ããã¦ãããç¹ã«ã¤ã³ã¹ãã¼ã«çã®
First you make a template - this is just a normal HTML file with a few extra tags, the simplest being <TMPL_VAR> For example, test.tmpl: æåã«ãã³ãã¬ã¼ããä½ãã¾ã - ãã㯠<TMPL_VAR> ã®ããã«ã¨ã¦ãç°¡åãªã 2ã»3 ã®ç¹æ®ãªã¿ã°ãå ¥ã£ãæ®éã® HTML ãã¡ã¤ã«ã§ãã ä¾ãã°ã test.tmpl: <html> <head><title>Test Template</title> <body> My Home Directory is <TMPL_VAR NAME=HOME> <p> My Path is set to <TMPL_VAR NAME=PATH> </body> </html>
ç¡æã®é«æ©è½ã§ä½ãæ¹ãç°¡åãªã¡ã¼ã«ãã©ã¼ã ããCGIã§ããè¤æ°éä¿¡ãã¢ã³ã±ã¼ããã©ã¼ã ãå¿åãã©ã¼ã ã¨ãã¦å©ç¨ã§ãã¾ããæåã³ã¼ãUTF-8対å¿ã§ã¬ã¹ãã³ã·ãWebãã¶ã¤ã³ã§ã¹ãã¼ããã©ã³ã«ã対å¿ãMTã§ãWordPressã§ã使ããã·ã§ããã³ã°ã«ã¼ãæ©è½ä»ãé«æ©è½ç¡æã¡ã¼ã«ãã©ã¼ã CGIã§ããä¸å½èªãéå½èªã¸ã®å¯¾å¿ãã¯ã¬ã¸ãã決æ¸æ©è½ããGoogleã¹ãã¬ããã·ã¼ãã¨ã®é£æºãå¯è½ã ã¡ã¼ã«ãã©ã¼ã ããCGIã®æ¦è¦Perlã§æ¸ãããã¢ã³ã±ã¼ããã©ã¼ã ãå¿åãã©ã¼ã ã¨ãã¦ç¡æã§å©ç¨ã§ããã¡ã¼ã«ãã©ã¼ã ï¼ã¨ã³ããªã¼ãã©ã¼ã ï¼ã®CGIé«æ©è½çã§ããé«æ©è½ã¨è¨ããã¨ã§ãDOMãé§ä½¿ãã確èªç»é¢ã¨ä¸è¬çãªã¡ã¼ã«ãã©ã¼ã ã«ãã¶ããã¾ãä»ãã¦ããªãå¹æè¨æ¸¬æ©è½ãå®è£ ããã¦ããã¾ããç°¡åè¨ç½®ã®æ¦å¿µãå¹¾åæããå ¨ã¦ã®è¨å®ãCGIå´ã«è¨å®ããå¿ è¦ãããç¹ãå¤§å¹ ãªå¤æ´ç¹ã¨ãªãã¾ãã ãã¡ããã¹ãã¼ããã©ã³ã¸ãå®
以åãCUPSãããããããªã³ãã«åºåããç°¡åãªããã°ã©ã ãç´¹ä»ããããæè¿ãããåããªããªã£ãã¨ã³ã¡ã³ããé ããã®ã§ãè²ã æ¸ãç´ãã¦ã¿ãã ä»çµã¿ CUPS-PDFã§PDFãã¡ã¤ã«ãçæãããããã»ãã³ã¤ã¬ãã³ã®ãããããªã³ããµã¼ãã¹ã«æããã ããAPIã¯ç¨æããã¦ããªãã®ã§CGIãç´æ¥å©ãã ããæ¹ ã¢ã«ã¦ã³ãåå¾ http://www.printing.ne.jp/register/index.html ã«ã¢ã¯ã»ã¹ãã¦ã¦ã¼ã¶IDã¨ãã¹ã¯ã¼ããåå¾ããã CUPS-PDFã®ã¤ã³ã¹ãã¼ã« ã¾ãCUPS-PDFãã¤ã³ã¹ãã¼ã«ããã Linux/*BSDã§ããã°åãã£ã¹ããªãã¥ã¼ã·ã§ã³ã®ããã±ã¼ã¸ã¾ãã¯æ¬å®¶ãµã¤ãã«ããtarball/rpmãã¤ã³ã¹ãã¼ã«ãgentooã¯emerge cups-pdfã§okã Mac OS Xã¯CUPS-PDF for Mac OS Xããã¦ã³ãã¼ããã¦ã¤ã³ã¹
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}