Advent is coming again

02 December 2008


29 November 2008

Devel::NYTProf is the best dprof tool in Perl land. it's really easy to install, configure, run and read the results.

just be careful with Catalyst Application (which use NEXT), it can't be ran under 5.8.6
you need 5.8.8 or 5.10.

run under modperl 1/2 is simple with Devel::NYTProf::Apache.
it writes files under /tmp and you can mv it to your place and run nytprofhtml on it.

what in result page is:
Calls is how many times it's called.
P is Number of Places sub is called from
F is Number of Files sub is called from
Exclusive Time is time in sub excluding subs it called
Inclusive Time is time in sub including subs it called

it really helps me a lot. Thanks, Tim.

Learn Mojo 1: start a project and a bit more

19 November 2008

Mojo is created by sri, the one who created Catalyst.
since sri is very SMART, we should follow him a bit.

Mojo is not a web framework. it is "a collection of libraries and example web frameworks for web framework developers.". u can treat it as something like Catalyst::Engine or HTTP::Engine.

but Mojolicious is a web framework built on Mojo.

install Mojo should be very simple and it doesn't have the half of CPAN. :)

start a project based on Mojolicous, you just type:
mojolicious generate app DayDayUp
cd day_day_up
perl bin/day_day_up deamon
then you can view a sample through

it's like Catalyst but it's really much more faster than catalyst

Mojolicous is still in its early stage. but luckily, we have MojoX::Renderer::TT by ask.

something inside:
1, in Controller $c, it is an instance of DayDayUp::Context which based on Mojolicious::Context.
we added config and dbh there. after this, you can call $c->config and $c->dbh in controller like
it's very flexible. you can add DBIx::Class there, it's not a problem.
2, routines. you don't have any :Global :Regex :Chained in Mojolicous. instead, we defined all those url mapping things in sub start.
indeed, I like it. :)
remember it has an order. so you should put the default at the last of routines like
    # route
$r->route('/notes/:id/:action', id => qr/\d+/)
->to(controller => 'notes', action => 'index');
# Default route
->to(controller => 'index', action => 'index');

set ENV MOJOX_ROUTES_DEBUG on that you can debug the dispatch.
(1) / is matching ":/controller/:action" with default controller => 'index', action => 'index'
(2) /notes is matching ":/contorller/:action" with controller to be notes and action still be index.
(3) /notes/add is matching ":/controller/:action" with controller "notes" and action "add"
(4) /notes/1/edit is matching '/notes/:id/:action' with action as edit.
much much more you can find it here: Mojo::Manual::Mojolicious
it's simple but powerful.

I'll write more next time. but it's for now.


photos of diudiu

09 November 2008

my wife and I took my son to a photograph shop 1 month ago. diudiu was 6 months.

Padre committer

06 November 2008

if you are following padre, you may find that I'm a committer now.

[[email protected] padre]$ svn log | perl -MData::Dumper -n -e'if (/^r\d+\s*\|\s*(\w+)\s*\|/) {$c{$1}++} END {print Dumper \%c}'
$VAR1 = {
'tsee' => 19,
'adamk' => 90,
'fayland' => 12,
'patspam' => 6,
'bricas' => 2,
'szabgab' => 538

mainly I'm contributing something like follows:
* Wx::Choice ->SetSelection(0);
* add test 82-plugin-manager.t and cleanup _load_plugin in
* highlight with PPI for Perl5
* remove "no output" in ack
* Limit the search_terms/replace_terms
* add main_files_pos to goto last pos for those left files.

some are trivial and some are important. I feel proud with those commit.

and I update the plugins list a lot. now I have 7 plugins for padre.
Padre-Plugin-AcmePlayCode-0.02 Acme::PlayCode Plugin for Padre
Padre-Plugin-CPAN-0.01 CPAN in Padre
Padre-Plugin-PluginHelper-0.02 make building Padre plugin easy
Padre-Plugin-TabAndSpace-0.05 convert between space and tab within Padre
Padre-Plugin-Validator-0.02 validate HTML/CSS in Padre
Padre-Plugin-ViewInBrowser-0.01 view selected doc in browser for Padre
Padre-Plugin-WordStats-0.02 Word stats for Padre

Padre-Plugin-PluginHelper is useful to develop a new plugin, it loads plugin from a local dir, and it can be reloaded after change.

so start to play with padre, and tell us what you think. :)


Padre::Plugin::WordStats and Padre::Plugin::Validator

03 November 2008

writing Padre plugin is really easy and a lot fun.

I wrote another two today.
one is - count how many words, lines, chars (with or without) spaces.
the other is - validate editing HTML/CSS in Padre

well, it may be not a big deal, but I'm using them in my daily life. so I like it.

start use padre and my plugins. :)

Thanks, Enjoy!


03 November 2008

Padre::Plugin::TabAndSpace is to convert tabs to spaces OR convert spaces to tabs.

start use padre and my plugin, enjoy.


02 November 2008

Padre::Plugin::AcmePlayCode is nothing big deal. it's just a mixin of Padre and Acme::PlayCode.

now you can
* convert double to single
* exchange condition
etc. in Padre.

and I had submitted two patches to Padre developers.

Padre is nice, just start using it!


Perl Testing程序高手秘笈

01 November 2008

the Perl Testing book translated by chunzi and joe is available to buy online now.

go and buy one now!


31 October 2008

Padre is Perl Application Development and Refactoring Environment.

install Padre with Perl 5.10 with Win32 is a bit painful.
the ppm in wxperl is fine with Perl 5.8 while broken with 5.10

while it would be OK if you follows the instruction in
cpan> look Alien::wxWidgets
$ perl Makefile.PL
$ dmake
$ dmake test
$ dmake install
$ exit
cpan> look Wx
$ perl Makefile.PL
$ dmake
$ dmake test
$ dmake install
$ exit
cpan> install Padre

while install the Alien::wxWidgets it needs download wxWidgets-2.8.8.tar.gz from sourceforge. it's better to download it with your download tool instead of the Perl command.
it takes much more longer than what I thought. but finally it works.

Padre is good. it's pure Perl with Wx.
- highlight for Perl
- open from last
- bookmark
- subs in right
and others. it's really good.

while it has bugs. like
- can open many instance of one file
- no highlight for HTML
and others.

OK, it's still worthing to try. and I'm reading the source code now to see if I can fix a bug or contribute a plugin.