<?xml version='1.0' encoding='UTF-8'?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'><id>tag:blogger.com,1999:blog-23855943</id><updated>2008-10-02T11:09:10.356+08:00</updated><title type='text'>Fayland and Perl Programming</title><subtitle type='html'>Perl is not the whole part of life. I know!</subtitle><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/posts/default'/><link rel='alternate' type='text/html' href='http://www.fayland.org/blog/'/><link rel='next' type='application/atom+xml' href='http://www.fayland.org/atom.xml?start-index=26&amp;max-results=25'/><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://www.fayland.org/atom.xml'/><author><name>Fayland</name><uri>http://www.blogger.com/profile/07225127136123374560</uri><email>noreply@blogger.com</email></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>160</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-23855943.post-3552333629158807632</id><published>2008-10-02T11:06:00.002+08:00</published><updated>2008-10-02T11:09:10.365+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Catalyst'/><category scheme='http://www.blogger.com/atom/ns#' term='Foorum'/><title type='text'>Foorum 0.2.7 release</title><content type='html'>Please download from &lt;a href="http://foorum.googlecode.com/files/Foorum-0.2.7.tar.gz"&gt;http://foorum.googlecode.com/files/Foorum-0.2.7.tar.gz&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;it's a good code source to learn Catalyst+DBIx::Class+Template and others.&lt;br /&gt;&lt;br /&gt;try &lt;a href="http://www.foorumbbs.com/"&gt;http://www.foorumbbs.com/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Patches or suggestion is really appreciated.&lt;br /&gt;&lt;br /&gt;Thanks.</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/3552333629158807632/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23855943&amp;postID=3552333629158807632' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/posts/default/3552333629158807632'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/posts/default/3552333629158807632'/><link rel='alternate' type='text/html' href='http://www.fayland.org/blog/2008/10/foorum-027-release.html' title='Foorum 0.2.7 release'/><author><name>Fayland</name><uri>http://www.blogger.com/profile/07225127136123374560</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-23855943.post-5966492653974711598</id><published>2008-09-29T19:35:00.002+08:00</published><updated>2008-09-29T19:38:20.103+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Moose'/><title type='text'>My 3rd CPAN module Today: Sphinx::Control</title><content type='html'>the code and idea is directly from &lt;a href="http://search.cpan.org/perldoc?Lighttpd::Control"&gt;Lighttpd::Control&lt;/a&gt; and &lt;a href="http://search.cpan.org/perldoc?Nginx::Control"&gt;Nginx::Control&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://search.cpan.org/perldoc?Sphinx::Control"&gt;Sphinx::Control&lt;/a&gt; controls &lt;a href="http://www.sphinxsearch.com"&gt;Sphinx&lt;/a&gt; searchd.&lt;br /&gt;&lt;br /&gt;Thanks.</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/5966492653974711598/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23855943&amp;postID=5966492653974711598' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/posts/default/5966492653974711598'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/posts/default/5966492653974711598'/><link rel='alternate' type='text/html' href='http://www.fayland.org/blog/2008/09/my-3rd-cpan-module-today-sphinxcontrol.html' title='My 3rd CPAN module Today: Sphinx::Control'/><author><name>Fayland</name><uri>http://www.blogger.com/profile/07225127136123374560</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-23855943.post-7656696578370718395</id><published>2008-09-29T13:30:00.002+08:00</published><updated>2008-09-29T13:32:13.302+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Catalyst'/><category scheme='http://www.blogger.com/atom/ns#' term='CPAN'/><title type='text'>two new CPAN modules</title><content type='html'>* &lt;a href="http://search.cpan.org/perldoc?Task::BeLike::FAYLAND"&gt;Task::BeLike::FAYLAND&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;OK, it's not so useful for u I think. just ignore it.&lt;br /&gt;&lt;br /&gt;* &lt;a href="http://search.cpan.org/perldoc?Catalyst::Plugin::CHI"&gt;Catalyst::Plugin::CHI&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;mix the CHI and Catalyst. :)</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/7656696578370718395/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23855943&amp;postID=7656696578370718395' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/posts/default/7656696578370718395'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/posts/default/7656696578370718395'/><link rel='alternate' type='text/html' href='http://www.fayland.org/blog/2008/09/two-new-cpan-modules.html' title='two new CPAN modules'/><author><name>Fayland</name><uri>http://www.blogger.com/profile/07225127136123374560</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-23855943.post-2435492544600163469</id><published>2008-09-25T09:56:00.002+08:00</published><updated>2008-09-25T10:08:07.563+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='PerlChina'/><category scheme='http://www.blogger.com/atom/ns#' term='YAPC'/><title type='text'>Beijing Perl Workshop on Nov 08, 2008</title><content type='html'>It is jointly organized with the postgresql china that means there will be some postgresql talks as well. We have also secured few sponsorships to fly Jesse Vincent and two other postgresql hackers to the workshop.&lt;br /&gt;&lt;br /&gt;If you are planning a trip to beijing in the early November, send a email to conference[at]perlchina.org to register the workshop, or even better come give a talk(20,40 minutes or lighting talk)!&lt;br /&gt;&lt;br /&gt;From &lt;a href="http://use.perl.org/~Qiang/journal/37527"&gt;http://use.perl.org/~Qiang/journal/37527&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;==============&lt;br /&gt;&lt;br /&gt;I'm not sure if I can go there, but I want to!</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/2435492544600163469/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23855943&amp;postID=2435492544600163469' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/posts/default/2435492544600163469'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/posts/default/2435492544600163469'/><link rel='alternate' type='text/html' href='http://www.fayland.org/blog/2008/09/beijing-perl-workshop-on-nov-08-2008.html' title='Beijing Perl Workshop on Nov 08, 2008'/><author><name>Fayland</name><uri>http://www.blogger.com/profile/07225127136123374560</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-23855943.post-3040146667084883005</id><published>2008-09-19T13:38:00.002+08:00</published><updated>2008-09-19T13:42:01.379+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CPAN'/><title type='text'>a busy release day today</title><content type='html'>I just kicked out 2 new modules and 1 refreshing module to CPAN.&lt;br /&gt;&lt;br /&gt;2 new modules:&lt;br /&gt;  * &lt;a href="http://search.cpan.org/perldoc?Pod::Simple::Wiki::Googlecode"&gt;Pod::Simple::Wiki::Googlecode&lt;/a&gt;&lt;br /&gt;  * &lt;a href="http://search.cpan.org/perldoc?Pod::From::GoogleWiki"&gt;Pod::From::GoogleWiki&lt;/a&gt; for &lt;a href="http://use.perl.org/~schwern/journal/37476"&gt;http://use.perl.org/~schwern/journal/37476&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;and 1 refreshing module:&lt;br /&gt;  * &lt;a href="http://search.cpan.org/perldoc?Foorum"&gt;Foorum&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;well, just enjoy!</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/3040146667084883005/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23855943&amp;postID=3040146667084883005' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/posts/default/3040146667084883005'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/posts/default/3040146667084883005'/><link rel='alternate' type='text/html' href='http://www.fayland.org/blog/2008/09/busy-release-day-today.html' title='a busy release day today'/><author><name>Fayland</name><uri>http://www.blogger.com/profile/07225127136123374560</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-23855943.post-1778761834496717354</id><published>2008-09-18T12:40:00.003+08:00</published><updated>2008-09-18T12:49:52.909+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Moose'/><title type='text'>Learn Moose 3: around</title><content type='html'>for example I want a shuffled list everytime when I can $t-&gt;shuffled_list;&lt;br /&gt;I know I can use a sub to do the request. but with Moose, it's much more elegant.&lt;br /&gt;&lt;br /&gt;the main code is like:&lt;pre&gt;&lt;code&gt;around 'shuffled_list' =&gt; sub {&lt;br /&gt;    my $next = shift;&lt;br /&gt;    &lt;br /&gt;    my $ret = $next-&gt;(@_);&lt;br /&gt;    $ret = [ shuffle( @$ret ) ];&lt;br /&gt;    &lt;br /&gt;    return $ret;&lt;br /&gt;};&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;full source code can be found in &lt;a href="http://fayland.googlecode.com/svn/trunk/script/learn_moose/002_around.pl"&gt;http://fayland.googlecode.com/svn/trunk/script/learn_moose/002_around.pl&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;the output looks like:&lt;pre&gt;1, 10, 6, 4, 2, 7, 9, 8, 3, 5&lt;br /&gt;3, 4, 7, 2, 1, 9, 5, 6, 8, 10&lt;/pre&gt;Here we use 'around' instead of 'before' or 'after' because 'before' doesn't work according to this FAQ: &lt;a href="http://search.cpan.org/~drolsky/Moose-0.57/lib/Moose/Cookbook/FAQ.pod#How_can_I_affect_the_values_in_@__using_before?"&gt;http://search.cpan.org/~drolsky/Moose-0.57/lib/Moose/Cookbook/FAQ.pod#How_can_I_affect_the_values_in_@__using_before?&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;the example above is a case of 'deflate' as &lt;a href="http://search.cpan.org/~drolsky/Moose-0.57/lib/Moose/Cookbook/FAQ.pod#How_can_I_get_Moose_to_inflate/deflate_values_in_the_accessor?"&gt;http://search.cpan.org/~drolsky/Moose-0.57/lib/Moose/Cookbook/FAQ.pod#How_can_I_get_Moose_to_inflate/deflate_values_in_the_accessor?&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;please read the FAQ and Cookbook for more details.&lt;br /&gt;&lt;br /&gt;Thanks.</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/1778761834496717354/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23855943&amp;postID=1778761834496717354' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/posts/default/1778761834496717354'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/posts/default/1778761834496717354'/><link rel='alternate' type='text/html' href='http://www.fayland.org/blog/2008/09/learn-moose-3-around.html' title='Learn Moose 3: around'/><author><name>Fayland</name><uri>http://www.blogger.com/profile/07225127136123374560</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-23855943.post-8914309486769414971</id><published>2008-09-17T15:13:00.001+08:00</published><updated>2008-09-17T15:17:27.652+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='git'/><title type='text'>jrock's git repos</title><content type='html'>http://git.jrock.us/?o=age&lt;br /&gt;&lt;br /&gt;well, it has a lot of beautiful code.&lt;br /&gt;&lt;br /&gt;git clone git://git.jrock.us/Ernst&lt;br /&gt;&lt;br /&gt;Thanks.</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/8914309486769414971/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23855943&amp;postID=8914309486769414971' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/posts/default/8914309486769414971'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/posts/default/8914309486769414971'/><link rel='alternate' type='text/html' href='http://www.fayland.org/blog/2008/09/jrocks-git-repos.html' title='jrock&apos;s git repos'/><author><name>Fayland</name><uri>http://www.blogger.com/profile/07225127136123374560</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-23855943.post-4199912708354003829</id><published>2008-09-15T13:32:00.001+08:00</published><updated>2008-09-15T13:34:20.170+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Foorum'/><title type='text'>Foorum 0.2.2 release</title><content type='html'>0.2.2 Mon Sep 15 12:03:00&lt;br /&gt;        - use Catalyst::Plugin::PageCache '0.19' and key_maker&lt;br /&gt;        - split Model/Validation.pm into ResultSet and remove it&lt;br /&gt;        - use 'MooseX::TheSchwartz' and 'TheSchwartz::Simple' to replace 'TheSchwartz'&lt;br /&gt;&lt;br /&gt;Please download it from &lt;a href="http://foorum.googlecode.com/files/Foorum-0.2.2.tar.gz"&gt;http://foorum.googlecode.com/files/Foorum-0.2.2.tar.gz&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Thanks.</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/4199912708354003829/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23855943&amp;postID=4199912708354003829' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/posts/default/4199912708354003829'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/posts/default/4199912708354003829'/><link rel='alternate' type='text/html' href='http://www.fayland.org/blog/2008/09/foorum-022-release.html' title='Foorum 0.2.2 release'/><author><name>Fayland</name><uri>http://www.blogger.com/profile/07225127136123374560</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-23855943.post-3473664276277367439</id><published>2008-09-11T18:16:00.000+08:00</published><updated>2008-09-11T18:33:28.214+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Moose'/><category scheme='http://www.blogger.com/atom/ns#' term='TheSchwartz'/><title type='text'>MooseX::TheSchwartz</title><content type='html'>I just released a new version of &lt;a href="http://search.cpan.org/perldoc?MooseX::TheSchwartz"&gt;MooseX::TheSchwartz&lt;/a&gt; today.&lt;br /&gt;&lt;br /&gt;it's written on the way when I learn Moose. and most of the code is copied from &lt;a href="http://search.cpan.org/perldoc?TheSchwartz"&gt;TheSchwartz&lt;/a&gt; and &lt;a href="http://search.cpan.org/perldoc?TheSchwartz::Simple"&gt;TheSchwartz::Simple&lt;/a&gt;.&lt;br /&gt;yet that's cool to write such things with Moose.&lt;br /&gt;&lt;br /&gt;Moose rocks!</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/3473664276277367439/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23855943&amp;postID=3473664276277367439' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/posts/default/3473664276277367439'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/posts/default/3473664276277367439'/><link rel='alternate' type='text/html' href='http://www.fayland.org/blog/2008/09/moosextheschwartz.html' title='MooseX::TheSchwartz'/><author><name>Fayland</name><uri>http://www.blogger.com/profile/07225127136123374560</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-23855943.post-6560791987512244839</id><published>2008-09-05T13:10:00.002+08:00</published><updated>2008-09-05T13:16:55.730+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Moose'/><title type='text'>Learn Moose 2: trigger</title><content type='html'>I want a scoreboard on MooseX::TheSchwartz.&lt;br /&gt;so I defined one like "has 'scoreboard'  =&gt; ( is =&gt; 'rw', isa =&gt; 'Str' );", but that's not what I want for all, I want more.&lt;br /&gt;I want it to be a temp file related to $$ when I set it as 1 or 'on'.&lt;br /&gt;I want I can custom a temp file for it.&lt;br /&gt;&lt;br /&gt;I know I can write a method like the one in TheSchwartz. but with Moose, it's much more elegant as what u want!&lt;pre&gt;&lt;code&gt;has 'scoreboard'  =&gt; (&lt;br /&gt;    is =&gt; 'rw',&lt;br /&gt;    isa =&gt; 'Str',&lt;br /&gt;    trigger =&gt; sub {&lt;br /&gt;        my ($self, $dir) = @_;&lt;br /&gt;        &lt;br /&gt;        return unless $dir;&lt;br /&gt;        # no endless loop when it's a file&lt;br /&gt;        if ($dir =~ /\/theschwartz\/scoreboard\./is) {&lt;br /&gt;            # get the real dir from $dir regardless a file&lt;br /&gt;            my (undef, $dir) = File::Spec-&gt;splitpath( $dir );&lt;br /&gt;            unless (-e $dir) {&lt;br /&gt;                mkdir($dir, 0755) or die "Can't create scoreboard directory '$dir': $!";&lt;br /&gt;            }&lt;br /&gt;            return;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        # They want the scoreboard but don't care where it goes&lt;br /&gt;        if (($dir eq '1') or ($dir eq 'on')) {&lt;br /&gt;            $dir = File::Spec-&gt;tmpdir();&lt;br /&gt;        }&lt;br /&gt;    &lt;br /&gt;        $dir .= '/theschwartz';&lt;br /&gt;        unless (-e $dir) {&lt;br /&gt;            mkdir($dir, 0755) or die "Can't create scoreboard directory '$dir': $!";&lt;br /&gt;        }&lt;br /&gt;        &lt;br /&gt;        $self-&gt;{scoreboard} = $dir."/scoreboard.$$";&lt;br /&gt;    }&lt;br /&gt;);&lt;/code&gt;&lt;/pre&gt;now I have all I want.&lt;br /&gt;&lt;br /&gt;just be careful, when u want to change itself in trigger like "$self-&gt;{scoreboard} = 'xxx'" or "$self-&gt;scoreboard('xxx');", u must make sure there isn't a endless loop since change itself will call trigger again.&lt;br /&gt;&lt;br /&gt;test code can be found here: &lt;a href="http://fayland.googlecode.com/svn/trunk/script/learn_moose/001_attribute_trigger.pl"&gt;http://fayland.googlecode.com/svn/trunk/script/learn_moose/001_attribute_trigger.pl&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Thanks.</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/6560791987512244839/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23855943&amp;postID=6560791987512244839' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/posts/default/6560791987512244839'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/posts/default/6560791987512244839'/><link rel='alternate' type='text/html' href='http://www.fayland.org/blog/2008/09/learn-moose-2-trigger.html' title='Learn Moose 2: trigger'/><author><name>Fayland</name><uri>http://www.blogger.com/profile/07225127136123374560</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-23855943.post-1149265457752706430</id><published>2008-09-04T15:22:00.004+08:00</published><updated>2008-09-05T13:00:49.485+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Moose'/><title type='text'>Learn Moose 1: subtype</title><content type='html'>finally I wrote my first Moose script.&lt;br /&gt;mainly I want to write a MooseX::Schwartz if I have enough time.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://search.cpan.org/perldoc?Moose"&gt;Moose&lt;/a&gt; is very powerful.&lt;br /&gt;I want a common function like set a flag to debug, besides that, we can define debug logger sub ourself.&lt;br /&gt;something like:&lt;pre&gt;&lt;code&gt;-&gt;verbose(1);&lt;br /&gt;-&gt;verbose(0);&lt;br /&gt;-&gt;verbose( sub {&lt;br /&gt;    my $msg = shift;&lt;br /&gt;    $msg =~ s/\s+$//;&lt;br /&gt;    print STDERR "[CUS] $msg\n";&lt;br /&gt;} );&lt;br /&gt;# then call -&gt;debug depends on -&gt;verbose.&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;final code is here: &lt;br /&gt;&lt;a href="http://fayland.googlecode.com/svn/trunk/script/learn_moose/007_subtype.pl"&gt;http://fayland.googlecode.com/svn/trunk/script/learn_moose/007_subtype.pl&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I'm not a Moose guru, but Moose sounds pretty exciting!</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/1149265457752706430/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23855943&amp;postID=1149265457752706430' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/posts/default/1149265457752706430'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/posts/default/1149265457752706430'/><link rel='alternate' type='text/html' href='http://www.fayland.org/blog/2008/09/learn-moose-1-subtype.html' title='Learn Moose 1: subtype'/><author><name>Fayland</name><uri>http://www.blogger.com/profile/07225127136123374560</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-23855943.post-8576744227224260467</id><published>2008-07-16T10:37:00.003+08:00</published><updated>2008-07-16T10:40:51.692+08:00</updated><title type='text'>upgrade pain</title><content type='html'>Recently I upgrade subversion to 1.5.0 on my WinXP box. but GOD, that's not working with svn+ssh at all. It's too painful to point out the plink is not working in svn 1.5.0 as before. &lt;br /&gt;&lt;br /&gt;&lt;a href="http://sphinxsearch.com/"&gt;Sphinx&lt;/a&gt; 0.9.8 is out. but I think I would upgrade it after 1 week or more.&lt;br /&gt;&lt;br /&gt;upgrade is painful.&lt;br /&gt;&lt;br /&gt;Thanks.</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/8576744227224260467/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23855943&amp;postID=8576744227224260467' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/posts/default/8576744227224260467'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/posts/default/8576744227224260467'/><link rel='alternate' type='text/html' href='http://www.fayland.org/blog/2008/07/upgrade-pain.html' title='upgrade pain'/><author><name>Fayland</name><uri>http://www.blogger.com/profile/07225127136123374560</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-23855943.post-4695671680333826352</id><published>2008-07-07T14:14:00.000+08:00</published><updated>2008-07-07T14:15:05.334+08:00</updated><title type='text'>tip: one line force install CPAN module</title><content type='html'>$&gt; perl -MCPAN -e 'force("install","Foorum");'&lt;br /&gt;&lt;br /&gt;that's it. Thanks.</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/4695671680333826352/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23855943&amp;postID=4695671680333826352' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/posts/default/4695671680333826352'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/posts/default/4695671680333826352'/><link rel='alternate' type='text/html' href='http://www.fayland.org/blog/2008/07/tip-one-line-force-install-cpan-module.html' title='tip: one line force install CPAN module'/><author><name>Fayland</name><uri>http://www.blogger.com/profile/07225127136123374560</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-23855943.post-3630936259932610631</id><published>2008-06-17T09:55:00.003+08:00</published><updated>2008-06-17T10:02:21.393+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Foorum'/><title type='text'>3 day 3 release</title><content type='html'>CPAN generally means responsibility. I released 3 Foorum distribution in the last 3 days.&lt;br /&gt;&lt;br /&gt;CPAN means better document. so I tried to use &lt;a href="http://search.cpan.org/perldoc?DBICx::Autodoc"&gt;DBICx::AutoDoc&lt;/a&gt; to create docs for Foorum::Schema. it's a bit different from the original method in DBICx::AutoDoc. I changed a bit to write pod into Schema files directly.&lt;br /&gt;&lt;br /&gt;code are:(briefly)&lt;pre&gt;my $ad = DBICx::AutoDoc-&gt;new(&lt;br /&gt;    schema =&gt; 'Foorum::Schema',&lt;br /&gt;    output =&gt; File::Spec-&gt;catdir($Bin, '..', '..', 'docs'),&lt;br /&gt;);&lt;br /&gt;&lt;br /&gt;# rewrite the Schema pm POD&lt;br /&gt;use Template;&lt;br /&gt;&lt;br /&gt;my $tt2 = Template-&gt;new( { INCLUDE_PATH =&gt; $ad-&gt;include_path, POST_CHOMP =&gt; 0, PRE_CHOMP =&gt; 0 } );&lt;br /&gt;my $vars = $ad-&gt;get_vars;&lt;br /&gt;&lt;br /&gt;# first get the lists of all Foorum::Schema pm files&lt;br /&gt;my @sources = @{ $vars-&gt;{sources} };&lt;br /&gt;foreach my $source (@sources) {&lt;br /&gt;    my $class = $source-&gt;{class}; # Foorum::Schema::User&lt;br /&gt;    &lt;br /&gt;    # make file dir&lt;br /&gt;    my @parts_of_modules = split('::', $class);&lt;br /&gt;    $parts_of_modules[-1] .= '.pm';&lt;br /&gt;    my $file_dir = File::Spec-&gt;catfile( $Bin, '..', '..', 'lib', @parts_of_modules );&lt;br /&gt;    &lt;br /&gt;    my $output;&lt;br /&gt;    $tt2-&gt;process('pod.html', { source =&gt; $source }, \$output)&lt;br /&gt;        || die $tt2-&gt;error(), "\n";&lt;br /&gt;    &lt;br /&gt;    # replace POD in real module&lt;br /&gt;    open(my $fh, '&lt;', $file_dir);&lt;br /&gt;    local $/ = undef;&lt;br /&gt;    my $in = &lt;$fh&gt;;&lt;br /&gt;    close($fh);&lt;br /&gt;    &lt;br /&gt;    my ($code, $pod) = split(/\n1;\n/, $in);&lt;br /&gt;    open(my $fh2, '&gt;', $file_dir);&lt;br /&gt;    print $fh2 "$code\n1;\n__END__\n\n$output\n";&lt;br /&gt;    close($fh2);&lt;br /&gt;    &lt;br /&gt;    print "working on $class\n";&lt;br /&gt;}&lt;/pre&gt; Full code can be found in &lt;a href="http://foorum.googlecode.com/svn/trunk/bin/misc/dbicx_autodoc.pl"&gt;http://foorum.googlecode.com/svn/trunk/bin/misc/dbicx_autodoc.pl&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Thanks.</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/3630936259932610631/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23855943&amp;postID=3630936259932610631' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/posts/default/3630936259932610631'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/posts/default/3630936259932610631'/><link rel='alternate' type='text/html' href='http://www.fayland.org/blog/2008/06/3-day-3-release.html' title='3 day 3 release'/><author><name>Fayland</name><uri>http://www.blogger.com/profile/07225127136123374560</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-23855943.post-8598686960447859868</id><published>2008-06-15T16:45:00.001+08:00</published><updated>2008-06-15T16:46:46.840+08:00</updated><title type='text'>Father's Day</title><content type='html'>&lt;a href="http://cn.zorpia.com/fayland/album/1078303/album/page=all/"&gt;http://cn.zorpia.com/fayland/album/1078303/album/page=all/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Today is my first Father's Day. :)</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/8598686960447859868/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23855943&amp;postID=8598686960447859868' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/posts/default/8598686960447859868'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/posts/default/8598686960447859868'/><link rel='alternate' type='text/html' href='http://www.fayland.org/blog/2008/06/father.html' title='Father&apos;s Day'/><author><name>Fayland</name><uri>http://www.blogger.com/profile/07225127136123374560</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-23855943.post-7002196913929447467</id><published>2008-06-15T15:55:00.003+08:00</published><updated>2008-06-15T15:59:09.379+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Foorum'/><title type='text'>Foorum 0.1.5 release</title><content type='html'>Finally I release the Foorum 0.1.5 after 2 months later. &lt;br /&gt;&lt;br /&gt;CHANGES:&lt;br /&gt;1, Foorum::Search with backend Foorum::Search::Database and Foorum::Search::Sphinx&lt;br /&gt;2, change DATETIME to INT(11) for tables.&lt;br /&gt;&lt;br /&gt;it's a release for my little boy diudiu. :)&lt;br /&gt;&lt;br /&gt;u can get it from &lt;a href="http://foorum.googlecode.com/files/Foorum-0.1.5.tar.gz"&gt;http://foorum.googlecode.com/files/Foorum-0.1.5.tar.gz&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;and I uploaded to CPAN too. &lt;br /&gt;&lt;br /&gt;Thanks.</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/7002196913929447467/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23855943&amp;postID=7002196913929447467' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/posts/default/7002196913929447467'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/posts/default/7002196913929447467'/><link rel='alternate' type='text/html' href='http://www.fayland.org/blog/2008/06/foorum-015-release.html' title='Foorum 0.1.5 release'/><author><name>Fayland</name><uri>http://www.blogger.com/profile/07225127136123374560</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-23855943.post-4221369060881247809</id><published>2008-05-23T23:36:00.002+08:00</published><updated>2008-05-23T23:44:24.577+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Foorum'/><title type='text'>use INT(11) instead of DATETIME for time</title><content type='html'>well, don't use DATETIME or DATE in database for time, use INT(11) UNSIGNED instead.&lt;br /&gt;&lt;br /&gt;the benefits are:&lt;br /&gt;1, u don't need care about MySQL or SQLite or others. NOW() is used by MySQL while CURRENT_TIMESTAMP is used by SQLite. that's important while u developer in MySQL and write test cases by SQLite.&lt;br /&gt;2, compare. while in TT, if u want to compare topic.time with date.now, u need wrap date.now by String.Compare or convert topic.time to int. that's not so easy. and date.format can convert INT to any format u want.&lt;br /&gt;&lt;br /&gt;I spent some hours to do the upgrade for Foorum.&lt;br /&gt;and the upgrade pl is simple: create a temp column then update as UNIX_TIMESTAMP, then drop old column and rename temp column.&lt;br /&gt;&lt;br /&gt;code is here: &lt;a href="http://foorum.googlecode.com/svn/trunk/bin/upgrade/0.1.5/up.pl"&gt;http://foorum.googlecode.com/svn/trunk/bin/upgrade/0.1.5/up.pl&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Enjoy.</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/4221369060881247809/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23855943&amp;postID=4221369060881247809' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/posts/default/4221369060881247809'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/posts/default/4221369060881247809'/><link rel='alternate' type='text/html' href='http://www.fayland.org/blog/2008/05/use-int11-instead-of-datetime-for-time.html' title='use INT(11) instead of DATETIME for time'/><author><name>Fayland</name><uri>http://www.blogger.com/profile/07225127136123374560</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-23855943.post-1464896622809056447</id><published>2008-04-11T15:32:00.002+08:00</published><updated>2008-04-11T15:36:01.186+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Catalyst'/><title type='text'>Catalyst trap: param and params</title><content type='html'>well, if we write code as follows:&lt;pre&gt;&lt;code&gt;sub test : Local {&lt;br /&gt;   my ($self, $c) = @_;&lt;br /&gt;     my $test = {&lt;br /&gt;       a =&gt; $c-&gt;req-&gt;param('a'),&lt;br /&gt;       b =&gt; $c-&gt;req-&gt;param('b'),&lt;br /&gt;       c =&gt; $c-&gt;req-&gt;param('c'),&lt;br /&gt;   };&lt;br /&gt;   $c-&gt;res-&gt;body(Dumper(\$test));&lt;br /&gt;} &lt;/code&gt;&lt;/pre&gt; then try to visit test?b=1, guess what we get? that's not what we expected. &lt;pre&gt;&lt;code&gt;$VAR1 = \{&lt;br /&gt;           '1' =&gt; 'c',&lt;br /&gt;           'a' =&gt; 'b'&lt;br /&gt;         }; &lt;/code&gt;&lt;/pre&gt;a weird result!&lt;br /&gt;&lt;br /&gt;please use follows, that's much better.&lt;pre&gt;&lt;code&gt;sub test : Local {&lt;br /&gt;    my ($self, $c) = @_;&lt;br /&gt;&lt;br /&gt;    my $test = {&lt;br /&gt;        a =&gt; $c-&gt;req-&gt;params-&gt;{'a'},&lt;br /&gt;        b =&gt; $c-&gt;req-&gt;params-&gt;{'b'},&lt;br /&gt;        c =&gt; $c-&gt;req-&gt;params-&gt;{'c'},&lt;br /&gt;    };&lt;br /&gt;    $c-&gt;res-&gt;body(Dumper(\$test));&lt;br /&gt;} &lt;/code&gt;&lt;/pre&gt; and get what we want:&lt;pre&gt;&lt;code&gt;$VAR1 = \{&lt;br /&gt;            'a' =&gt; undef,&lt;br /&gt;            'b' =&gt; '1',&lt;br /&gt;            'c' =&gt; undef&lt;br /&gt;          };&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;so do remember that. and don't write dbix insert/update code like that.</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/1464896622809056447/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23855943&amp;postID=1464896622809056447' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/posts/default/1464896622809056447'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/posts/default/1464896622809056447'/><link rel='alternate' type='text/html' href='http://www.fayland.org/blog/2008/04/catalyst-trap-param-and-params.html' title='Catalyst trap: param and params'/><author><name>Fayland</name><uri>http://www.blogger.com/profile/07225127136123374560</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-23855943.post-6844958914413092366</id><published>2008-04-11T08:08:00.000+08:00</published><updated>2008-04-11T08:09:10.252+08:00</updated><title type='text'>my shell history</title><content type='html'>-bash-3.00$ history|awk '{a[$2]++ } END{for(i in a){print a[i] " " i}}' |sort -rn|head&lt;br /&gt;290 perl&lt;br /&gt;235 svn&lt;br /&gt;67 ls&lt;br /&gt;60 screen&lt;br /&gt;46 vim&lt;br /&gt;27 mysql&lt;br /&gt;25 cp&lt;br /&gt;23 rm&lt;br /&gt;22 ps&lt;br /&gt;22 exit</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/6844958914413092366/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23855943&amp;postID=6844958914413092366' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/posts/default/6844958914413092366'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/posts/default/6844958914413092366'/><link rel='alternate' type='text/html' href='http://www.fayland.org/blog/2008/04/my-shell-history.html' title='my shell history'/><author><name>Fayland</name><uri>http://www.blogger.com/profile/07225127136123374560</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-23855943.post-2156783003518136342</id><published>2008-04-10T12:06:00.002+08:00</published><updated>2008-04-10T12:13:23.562+08:00</updated><title type='text'>please support Perl in Google App Engine</title><content type='html'>&lt;a href="http://code.google.com/p/googleappengine/issues/detail?id=34"&gt;http://code.google.com/p/googleappengine/issues/detail?id=34&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;star it please. so that we will have a free Perl host by Google!</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/2156783003518136342/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23855943&amp;postID=2156783003518136342' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/posts/default/2156783003518136342'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/posts/default/2156783003518136342'/><link rel='alternate' type='text/html' href='http://www.fayland.org/blog/2008/04/please-support-perl-in-google-app.html' title='please support Perl in Google App Engine'/><author><name>Fayland</name><uri>http://www.blogger.com/profile/07225127136123374560</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-23855943.post-4453328370691084813</id><published>2008-04-07T21:35:00.002+08:00</published><updated>2008-04-07T21:37:37.035+08:00</updated><title type='text'>I have a son</title><content type='html'>My son (nickname: diudiu 丢丢, formal name: 林锦喆) was born a week ago on April Fool's Day (4.1) and weight was 3kg. I'm pretty happy with that. I'll upload some photos later. :)</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/4453328370691084813/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23855943&amp;postID=4453328370691084813' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/posts/default/4453328370691084813'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/posts/default/4453328370691084813'/><link rel='alternate' type='text/html' href='http://www.fayland.org/blog/2008/04/i-have-son.html' title='I have a son'/><author><name>Fayland</name><uri>http://www.blogger.com/profile/07225127136123374560</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-23855943.post-7734739550227923028</id><published>2008-03-21T11:40:00.001+08:00</published><updated>2008-03-21T11:40:43.164+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='trip'/><title type='text'>KunMing Trip</title><content type='html'>I'll be in KunMing next week with all my Zorpia colleges. it would be a nice trip. :)</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/7734739550227923028/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23855943&amp;postID=7734739550227923028' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/posts/default/7734739550227923028'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/posts/default/7734739550227923028'/><link rel='alternate' type='text/html' href='http://www.fayland.org/blog/2008/03/kunming-trip.html' title='KunMing Trip'/><author><name>Fayland</name><uri>http://www.blogger.com/profile/07225127136123374560</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-23855943.post-6264860916781034312</id><published>2008-03-19T21:13:00.001+08:00</published><updated>2008-03-19T21:15:22.579+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='memcached'/><title type='text'>memcached for Windows</title><content type='html'>&lt;a href="http://www.splinedancer.com/memcached-win32/"&gt;http://www.splinedancer.com/memcached-win32/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;have fun.</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/6264860916781034312/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23855943&amp;postID=6264860916781034312' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/posts/default/6264860916781034312'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/posts/default/6264860916781034312'/><link rel='alternate' type='text/html' href='http://www.fayland.org/blog/2008/03/memcached-for-windows.html' title='memcached for Windows'/><author><name>Fayland</name><uri>http://www.blogger.com/profile/07225127136123374560</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-23855943.post-1763870688095471344</id><published>2008-03-14T18:22:00.000+08:00</published><updated>2008-03-14T18:25:09.200+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Catalyst'/><title type='text'>Catalyst Tip: bind STDOUT with res-&gt;body</title><content type='html'>&lt;pre&gt;&lt;code&gt;sub test_body : Local {&lt;br /&gt;    my ($self, $c) = @_;&lt;br /&gt;&lt;br /&gt;    $c-&gt;res-&gt;body(\*STDOUT);&lt;br /&gt;    print "a\n";&lt;br /&gt;    print "b\n";&lt;br /&gt;}&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;I think that's pretty useful when u are trying to use "Benchmark" module (or others use STDOUT).&lt;br /&gt;&lt;br /&gt;Have fun!</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/1763870688095471344/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23855943&amp;postID=1763870688095471344' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/posts/default/1763870688095471344'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/posts/default/1763870688095471344'/><link rel='alternate' type='text/html' href='http://www.fayland.org/blog/2008/03/catalyst-tip-bind-stdout-with-res-body.html' title='Catalyst Tip: bind STDOUT with res-&gt;body'/><author><name>Fayland</name><uri>http://www.blogger.com/profile/07225127136123374560</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-23855943.post-3028673279595254930</id><published>2008-03-05T15:49:00.003+08:00</published><updated>2008-03-05T16:15:50.657+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MySQL'/><title type='text'>MySQL tip TIMESTAMPDIFF</title><content type='html'>Thanks for my college CY.&lt;br /&gt;&lt;br /&gt;UNIX_TIMESTAMP(birthday) is not working when birthday is before 1970.&lt;br /&gt;I should use TIMESTAMPDIFF(DAY, '1900-01-01', birthday) to get the DAY or SECOND&lt;br /&gt;&lt;pre&gt;&lt;code&gt;mysql&gt; select TIMESTAMPDIFF(DAY, '1900-01-01', '1998-05-01');&lt;br /&gt;+------------------------------------------------+&lt;br /&gt;| TIMESTAMPDIFF(DAY, '1900-01-01', '1998-05-01') |&lt;br /&gt;+------------------------------------------------+&lt;br /&gt;|                                          35914 |&lt;br /&gt;+------------------------------------------------+&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_timestampdiff"&gt;http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_timestampdiff&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;in Perl, we can do:&lt;br /&gt;&lt;pre&gt;&lt;code&gt;use Date::Calc qw/Delta_Days/;&lt;br /&gt;print Delta_Days(1900,1,1, 1998,5,1);&lt;br /&gt;^Z&lt;br /&gt;35914&lt;/code&gt;&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/3028673279595254930/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23855943&amp;postID=3028673279595254930' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/posts/default/3028673279595254930'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23855943/posts/default/3028673279595254930'/><link rel='alternate' type='text/html' href='http://www.fayland.org/blog/2008/03/mysql-tip-timestampdiff.html' title='MySQL tip TIMESTAMPDIFF'/><author><name>Fayland</name><uri>http://www.blogger.com/profile/07225127136123374560</uri><email>noreply@blogger.com</email></author></entry></feed>