Perlå ¥å¦å¼ å ¨6åã®Perlå ¥éè¬åº§ãæ±äº¬ã大éªãæ²ç¸ãæå¹ã§éå¬ã(æ±äº¬ã¯4æã¨10æã¹ã¿ã¼ãããã以å¤ã¯5æã¹ã¿ã¼ã) YAPC::Japan Perlã軸ã¨ããITã«é¢ããå ¨ã¦ã®äººã®ããã®ã«ã³ãã¡ã¬ã³ã¹ã æ±äº¬ å祥寺.pm äºåç°.pm å¤§éª ãªã«ãPerl æ²ç¸ æ²ç¸.pm
åå¶ DBIx::Class::Manual::Cookbook - ã¬ã·ããããã ã¬ã·ã¶ æ¤ç´¢Â¶ ãã¼ã¸å¦çãããçµæã»ã㶠When you expect a large number of results, you can ask DBIx::Class for a paged resultset, which will fetch only a small number of records at a time: çµæã»ãããè¨å¤§ã«ãªããããªãããã¼ã¸å¦çãããçµæãDBIx::Classã§åå¾ã§ãã¾ãã ä¸åã«ãå°ãã®ã¬ã³ã¼ãããã¨ã£ã¦ãã¾ãã: my $rs = $schema->resultset('Artist')->search( undef, { page => 1, # page to return (defaults to 1) rows => 10, #
以ä¸ããã®ãã¼ã¿ãã¼ã¹ãä½æããããã®éã®SQLã§ãããã®SQLãUTF8ã§ä¿åããmysqlã®ãã¼ã¿ãã¼ã¹ä½æ権éã®ããã¦ã¼ã¶ï¼ç®¡çè ãªã©ï¼ã§å®è¡ãã¾ãã /* ãã¼ã¿ãã¼ã¹ã¨ã¦ã¼ã¶ãä½æ */ DROP DATABASE IF EXISTS blog; CREATE DATABASE blog CHARACTER SET utf8; GRANT ALL ON blog.* TO blog_user IDENTIFIED BY 'blog_pass'; /* ãã¼ãã«ãä½æ */ use blog; DROP TABLE IF EXISTS blog_site; CREATE TABLE blog_site ( site_id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, url TEXT, description TEXT, dat
IntroTestMore - A Perl Testing Tutorial ç®æ¬¡ â ãªããã¹ãããã®ã â æããªãã§ï¼ â ãã¼ã·ãã¯ãã¹ã â Test::Simple ã¨ãã® API â éçºéç¨ã«ãã¹ããçãè¾¼ã â Test::More ã® API ã«ã¤ã㦠A Perl Testing Tutorial chromatic (http://wgz.org/chromatic/) (http://wgz.org/chromatic/perl/IntroTestMore.pdf) è±èªããã®ã¾ã¾æ®ã£ã¦ãé¨åã¯æå³ãããããªãã£ã¨ããªã®ã§ã é©å½ã«è£å®ãã¦ãã â ãªããã¹ãããã®ã ã³ã¼ããä»æ§ã©ããã®åãããããã¨ã確èªããã o å®è£ å¿ãã®é²æ¢ o ã¢ã¯ã·ãã³ãã«å¯¾ããåã o å ¨ã¦ã®ãã¹ãã«ãã¹ããã°å®æ å¢çæ¡ä»¶ã®ãã§ã㯠o ä¸æ£ãªå ¥åãã©ãæ±ãã o ã¤ã¸ã¯ã«ãªæä½ã«ã©ã対å¦ã
Perlã§Excelã¨ãã§ä½ã£ãã»ã«å æ¹è¡(è¤æ°è¡ã«ãããã¬ã³ã¼ã)ã¤ãCSVãã¡ã¤ã«ãå¦çããæ¹æ³ã æå¤ã¨ç¥ããªã人ãããã®ã§ã Text::CSV_XS ã使ã£ã¦ã #!/usr/local/bin/perl use strict; use warnings; use IO::File; use Text::CSV_XS; my $fh = IO::File->new('test.csv') or die 'cannot open file'; my $csv = Text::CSV_XS->new({binary => 1}); until ($fh->eof) { my $columns = $csv->getline($fh); # $columns->[0] } $fh->close; syntax highlight by VimColor binary ãªãã·ã§ã³ãå¿ è¦ã
Redirecting⦠Click here if you are not redirected.
ORM ãã¦ã§ãã¢ããªã±ã¼ã·ã§ã³é¢é£ã®ã©ã¤ãã©ãªãªã©ã®ãã¹ãã±ã¼ã¹ãæ¸ãã«ããã£ã¦ã¯ã RDBMS ã¸ã®ã¢ã¯ã»ã¹ãå¿ è¦ã«ãªãã¾ããããããSQLite ã®ãããªã¹ã¿ã³ãã¢ãã¼ã³ã®ãã¼ã¿ãã¼ã¹ã¨æ¯è¼ããã¨ããµã¼ãåãã¼ã¿ãã¼ã¹ã§ãã MySQL ã«æ¥ç¶ãã¦ãã¹ããæ¸ãã®ã¯ãæ¢åã® MySQL ã®æ¨©éè¨å®ããã¼ã¿ãã¼ã¹åãæ°ã«ããå¿ è¦ããã£ããã¨ãããããä¸ä¾¿ã§ããããã§ãMySQL ã®ã¤ã³ã¹ã¿ã³ã¹ããã³ãã©ãªãã£ã¬ã¯ããªã«èªåçæãããã¹ããçµãã£ããåé¤ãã¦ããã Perl ã¢ã¸ã¥ã¼ã« Test::mysqld ãæ¸ãã¾ããããããªæãã§ä½¿ãã¾ãã use DBI; use Test::mysqld; use Test::More; my $mysqld = Test::mysqld->new( my_cnf => { 'skip-networking' => '' }, # TCPæ¥ç¶ã
2009å¹´02æ22æ¥22:31 Perl perlã®æ³¢ããã·ã¥ã®æåã³ã¼ãå¤æã®ã¾ã¨ã perlã®æåã³ã¼ãå¨ãã¯ãªããªãã«ãªã¹ã§ããå¤é¨ã¨ã³ã³ã¼ãã¨ããperlå é¨ã§ã®æåã³ã¼ãã¨ããUTF8ãã©ã°ã¨ããUTF8ãã©ã°ï¼ãªã«ããï¼ãªäººã¯ãããã¨ããããè¦ã¦ã¿ãã¨è¯ããããï¼ã»âã»ï¼ åºæ¬çã«ã¯å¤é¨ããå ¥ã£ã¦ããæç¹ã§decodeãã¦ãåºåæã«encodeãã¦ããã°å ¨ã¦è§£æ±ºãããã§ãããããï¼æ³¢ããã·ã¥ï¼ãã¨ãâï¼å ¨è§ãã¤ãã¹ï¼ãã ãã¯ç¹å¥ã§ãã注æãå¿ è¦ãªã®ã¯ãã®2ãã¿ã¼ã³ã â utf8âshift_jis â¡ utf8âeuc-jp â ã«ã¤ãã¦ã¯ä»¥åãperl utf8âsjisã§æååãã¨ããè¨äºã§ç´¹ä»ãã¾ããããencodeæã«ã'sjis'ã§ã¯ç¡ãã¦ã'cp932'ãæå®ããã°OKãâ»ãããã¨ããâãã¯sjisã«ã¯å«ã¾ãã¦ããªãæåãªã®ãåå ã ä»åç´¹ä»ãããã®ã¯â¡ã®å ´åã§ã
perl 㯠5.8 ãã Unicode(utf-8) ããµãã¼ãããã¾ããï¼5.6 ã§ã Unicode ã«å¯¾å¿ã¯ãã¦ãã¾ãããï¼ãããã使ãç©ã«ãªããï¼ãããã 5.8 ã§ã¾ã¨ãã«ä½¿ããããã«ãªã£ãã¨ãããã¨ã§ãï¼ãã ãã£ãã使ããã«ããã ããã perldoc ãªã©ãè¦ã¦ãã¤ãã¤ã使ãæ¹ãããããªãã®ã§ï¼ç¬èªã«ã¾ã¨ ãã¦ã¿ãã®ããã®ãã¼ã¸ã§ãï¼ èª¤ã£ãæ¸ãæ¹ãåéãããã¦ã ããã¨ãããã®ã§ï¼å½¢å¼çã§ãããã®ãã¼ã¸ã®å 容ã¯ç¡ä¿è¨¼ã§ãï¼ å 容 æåã³ã¼ãå¤æ perlIO jperlããã®ç§»è¡ UTF-8ãã©ã° æåã³ã¼ãèªåå¤å¥ Unicode Standard Unicode æ£è¦å ãã®ä» åèè³æ æåã³ã¼ãå¤æ ã¨ãããã perl5.8 ã§æ°ããçµã¿è¾¼ã¾ããæ©è½ãè¦ãããã«ï¼euc-jp ãã shift_jis ã¸ã®å¤æã¹ã¯ãªãããããã¤ãè¼ãã¾ãï¼ openãå©ç¨ã
Short intro to Catalyst Catalyst = MVC web framework in Catalyst everything = $c $c->model() - use base 'Catalyst::Model'; $c->view() - use base 'Catalyst::View'; $c->controller() - use base 'Catalyst::Controller'; elegant way to have a tool organized $c methods build-in $c->config->{} - hash ref of configuration variables $c->stash->{} - hash ref of temporary (per request) variables $c->uri_for('
ãã®ãã¼ã¸ã¯ Perl5.6 ã対象ã¨ãã¦ãã¾ãï¼ perl ã¹ã¯ãªãã㯠EUC-JP ã§æ¸ããããã¨ãæ³å®ãã¦ãã¾ãï¼ ãã®ãã¼ã¸ã¯ æ£è¦è¡¨ç¾ã¡ã¼ãªã³ã°ãªã¹ã ãåèã«ï¼ç§ãç¬èªã«ã¡ã¢ã¨ãã¦ã¾ã¨ãããã®ã§ãï¼ ãã®ãã¼ã¸ã®æ£è¦è¡¨ç¾ãã¹ã¯ãªããã«ã¤ãã¦ã®è©³ãã説æï¼ ãããããã説æã¯ããããã§ãã¾ããï¼ ãã®ãã¼ã¸ã«æ¸ããã¦ããã¹ã¯ãªããã¯ï¼ å人ã®è²¬ä»»ã«ããã¦å®è¡ãã¦ãã ããï¼ ãã®ãã¼ã¸ã«æ¸ããã¦ããã¹ã¯ãªããã® å©ç¨ã»æ¹é ã¯èªç± ã§ãï¼ ãã®éã¯ã©ããã«ãã®ãã¼ã¸ã® URI( http://www.din.or.jp/~ohzaki/regex.htm )ãåèã¨ãã¦è¨è¿°ãã¦ããã ããã°å¹¸ãã§ã(ä»»æ)ï¼ ãæè¦ã»ãææ³ã»ãè¦æãªã©ã¯ ã«ãé¡ããã¾ãï¼ããæ¸ããæ¹ãããï¼ åããï¼ããããï¼ãã°ã£ã¦ãï¼ããæ¸ãï¼ãªã©ãªã©ãå¾ ã¡ãã¦ãã¾ãï¼ ãã®ãã¼ã¸ã¸ã® ãªã³ã¯ã¯èªç± ã«å¼µã£ã¦ã
UTF8 ãã©ã°ã«ã¤ãã¦ããã£ã¦ãã¤ããã ã£ããã§ããï¼utf8::is_utf8 considered harmful - Bulknews::Subtech - subtech ãèªãã§æ··ä¹±ããã®ã§ï¼èªåãªãã«ã¾ã¨ãã¦ã¿ã¾ãããééããããã¾ããããææããããã ã¾ã¨ã ã¹ã«ã©ã¼å¤æ°ã®å é¨è¡¨è±¡ã®ç¶æ ã示ããã®ã¨ã㦠UTF8 ãã©ã°ã¨ãããã®ããã ã¹ã«ã©ã¼å¤æ°ã¯ï¼ãªãã¡ã¬ã³ã¹çã¯å¥ã¨ãã¦ï¼ä¸è¨ã®ãã®ãæ ¼ç´ã§ãã (A) æååï¼å é¨è¡¨è±¡: UTF-8ï¼ (B) æååï¼å é¨è¡¨è±¡: ISO-8859-1ï¼ (C) ãã¤ããªå ç´ç²ãªãã¤ããªã¹ããªã¼ã ï¼ç»åãã¡ã¤ã«çï¼ãããããªããï¼ UTF-8 octet stream ãããããªããï¼ CP932 octet stream ãããããªããï¼etc, etc ... Perl ã¯ï¼å¾æ¹äºææ§ç¢ºä¿ãªã©ã®çç±ããï¼ISO-8859-1
å ã«è¨ã£ã¦ããã¨ãhide-kããã®ã¾ã¨ããåãããããã§ãã http://blog.hide-k.net/archives/2007/03/catalyst_2.php æãCatalystã使ãéã«ã¨è¨ãäºã§ããã utf8ãã©ã°ãç«ã¦ãªãã§TTã使ãå ´å ã½ã¼ã¹èªèº«ã¯utf8ã§æ¸ããã§ããã©ã #!/usr/bin/perl use strict; use warnings; use Carp::Clan; use Path::Class; use Template; my $base_dir = dir($ENV{HOME}, qw/tmp tt_test/); my $template = Template->new({ COMPILE_DIR => $base_dir->subdir('tt.cache')->stringify, COMPILE_EXT => 'c', })
Cache::Memcached::Fastã試ã Perlã®æ°ããmemcachedã¯ã©ã¤ã¢ã³ããCache::Memcached::Fastããã§ã¦ããã®ã§è©¦ãã¦ã¿ã çµè«ããè¨ãã¨ãããã¯ä½¿ãããã ã¾ããC::M::Fastã¯memcached-1.2.4ã§ãµãã¼ãããããappend, prepend, cas, gets, gets_multiããµãã¼ãããå¯ä¸ã®Perlã¯ã©ã¤ã¢ã³ãã§ããã¾ãã常ã«åé¡ã¨ãªãCacheåæ£ã«Ketama consistent hashing algorithmããµãã¼ããã¦ããããCacheã®çµã¿æ¿ããæå°éã«ãã¦Cacheãµã¼ãã®è¿½å ãè¡ãã¾ãã æå ã®ãã³ããã¼ã¯ã§ã¯50%ã80%ãå¦çã«ããã¾ãã300%以ä¸é«éåããã¦ã¾ã ã¤ã³ã¹ãã¼ã«ã¯æ®éã«CPANããè¡ãã¾ãããã ããmemached-.1.2.4ãåãã¦ããªãã¨make test
#åã«ç¤¾å wikiã«æ¸ãã¦ãããã®ãå ¬éãã¦ã¿ããã¹ãã Catalystã§ãã«ããã¤ããæ±ãæ©ä¼ãããã®ã¯ä¸»ã« ã¦ã¼ã¶ã¼ããã©ã¼ã ã§å ¥åããå¤ ($c->req->param()) ãã¼ã¿ãã¼ã¹ããã®å ¥åºå (DBIx::Class) ãã以å¤ã®æååã®è©ä¾¡ View::TTã«ããåºåã®çæ FillInFormã«ãããã©ã¼ã ã®åã込㿠HTTPã¬ã¹ãã³ã¹ ã§ãã ããã§ã¯ä»¥ä¸ã®æ¡ä»¶ã§ã¾ã¨ãã¦ã¿ã¾ããã æåã³ã¼ãã¯UTF8ã«çµ±ä¸ ãã¼ã¿ãã¼ã¹ã«ã¯mysqlãä½¿ç¨ ä¸æºå ãã³ãã¬ã¼ããperlã®ã³ã¼ãã¯å ¨ã¦UTF8ã§æ¸ãã¾ãã mysqlã®æåã³ã¼ãã®æå®ã¯/etc/my.cnfã« [mysqld] default-character-set = utf8 skip-character-set-client-handshake [mysql] default-character-set
NAME DBIx::Class::ResultSet - Responsible for fetching and creating resultset. SYNOPSIS my $rs = $schema->resultset('User')->search(registered => 1); my @rows = $schema->resultset('CD')->search(year => 2005); DESCRIPTION The resultset is also known as an iterator. It is responsible for handling queries that may return an arbitrary number of rows, e.g. via "search" or a has_many relationship. In th
« TaskPadã使ããªããä½æ¥ä½æ¥ | ããããã¼ã¸ | æ°å®¿ 磯å » DBICã®ãªã¬ã¼ã·ã§ã³ã·ãã [Perl] ãã£ã±ããDBIx::Class::Relationshipãèªã¿ç´ããã¨ã«ããã ããããã®ãã¡ããã¨ç解ãã¦ãããªãã¨è¶³ãããããããã ã¡ãã£ã¨ã¥ã¤æ¸ããããä½æ¥ãããã£ããã·ã§ã³ããªã ã¾ãã¯åæã¨ãªããã¼ã¿ ãããªæãã§ãAuthorãã¼ãã«ã¨ãBookãã¼ãã«ãããã¨ããã ID | Name | Age ------------------ 1 | Fred | 30 2 | Joe | 32 ID | Author | Name -------------------- 1 | 1 | Rulers of the universe 2 | 1 | Rulers of the galaxy ãªã¬ã¼ã·ã§ã³ã·ãããªãã®å ´å ããããª
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}