manage Task::Padre::Plugins with ORDB::CPANTS

24 May 2009

To update a Task:: module is not so hard but trivial. you need find out the new version of existing modules, and those haven't added yet.
well, do it manually is not so Perl-ish. we have Perl, we should do it automatically by running a script.

it's pretty good we have ORDB::CPANTS from Alias.
1, we get all plugins by ORDB::CPANTS through used_by
2, split them into requires and feature.
3, get the META info through YAML::LoadURI
4, generate the main part of Makefile.PL and

you can find the code here:

I know I can generate Makefile.PL and directly, but it's good enough for now.


github instead of google code

19 May 2009

yes. I do love github more than google code. it's not the problem of git or svn. svn is fine.

the point is participation.
In google code, it's very hard to contribute some code to one project if you're not the author. it disappoints me a lot.
The "fork" button in github is very helpful. people forked my repos then pull requests to ask me to merge (like perl-net-github, dist-zilla-plugin-repository). I forked someone's repos then pull back (like theschwartz-moosified, dist-zilla, git-pureperl etc).

it's awesome. go start using github right now. :)

DBIx::Class::ResultSet::Void and TheSchwartz::Moosified

12 May 2009

Big thanks to ribasushi, the new DBIx::Class::ResultSet::Void 0.04 is using
# SELECT 1 FROM item me WHERE ( = ? ) LIMIT 1: '1'
# INSERT INTO item ( id, name) VALUES ( ?, ? ): '1', 'A'
instead of COUNT(*). it's much faster now.

Another big thanks to stash from socialtext, TheSchwartz::Moosified 0.04 with PostgreSQL support and bug fixes.



10 May 2009

some time I'm really feeling sick when I use update_or_create or find_or_create, the default DBIx::Class::ResultSet return DBIx::Class::Row object by using find.
it's useful when I need the $row object, but it's dummy if I don't care.

I wrote DBIx::Class::ResultSet::Void today. It would use count instead of find if not defined wantarray. it means when I call
$rs->find_or_create( { id => 1, name => 'A' } );
instead of
my $row = $rs->find_or_create( { id => 1, name => 'A' } );
it would generate SQLs like:
# SELECT COUNT( * ) FROM item me WHERE ( = ? ): '1'
# INSERT INTO item ( id, name) VALUES ( ?, ? ): '1', 'A'
it's a little better I think.

read more on the POD and Enjoy!

new DayDayUp

29 April 2009

inspired by jrock's Multimethods and Unshortening URLs with Modern Perl, I decided to rewrite my DayDayUp CPAN module.

it's really very cool to write code with KiokuDB and MooseX::Declare. less code. more focus on real.
I'm planing to write more, but it's for now.

even it fails on Win32, it's still worth to try. :)

planet you can't miss today

28 April 2009

CPAN updates

21 April 2009

I spent lots of time to write CPAN module in past two days. it's not so fun but enjoyable.

App::GitHub - 8 dists 3 days.
Dist::Zilla::Plugin::MetaResources - DEPERCATED, it will be supported in Dist::Zilla core.
Net::GitHub - also 8 dists 3 days.

To write a CPAN module is really not so hard. please go on and enjoy it.



20 April 2009

well, App::GitHub is a command line tool wrapped by Net::GitHub.

for a brief view:

Welcome to GitHub Command Tools! (Ver: 0.04)
Type '?' or 'h' for help.

github> ?
command argument description
repo :user :repo set owner/repo, eg: 'fayland perl-app-github'
login :login :token authenticated as :login
loadcfg authed by git config --global github.user|token
?,h help
q,exit,quit exit

rshow more in-depth information for the :repo in repo
rlist list out all the repositories for the :user in repo
rsearch WORD Search Repositories
watch watch repositories (authentication required)
unwatch unwatch repositories (authentication required)
fork fork a repository (authentication required)
create create a new repository (authentication required)
delete delete a repository (authentication required)
set_private set a public repo private (authentication required)
set_public set a private repo public (authentication required)
network see all the forks of the repo
tags tags on the repo
branches list of remote branches

ilist open|closed see a list of issues for a project
iview :number get data on an individual issue by number
iopen open a new issue (authentication required)
iclose :number close an issue (authentication required)
ireopen :number reopen an issue (authentication required)
iedit :number edit an issue (authentication required)
ilabel add|remove :num :label
add/remove a label (authentication required)

File/Path related
cd PATH chdir to PATH

rshow :user :repo more in-depth information for a repository
rlist :user list out all the repositories for a user

github> loadcfg

github> repo fayland perl-app-github

fayland/perl-app-github> rshow
"owner" : "fayland",
"private" : false,
"name" : "perl-app-github",
"description" : "App::GitHub CPAN module",
"homepage" : "",
"watchers" : 2,
"forks" : 0,
"fork" : false,
"url" : ""

fayland/perl-app-github> repo fayland sandbox2

fayland/sandbox2> ilist
"number" : 1,
"position" : 1,
"state" : "open",
"body" : "Test Issue body.",
"created_at" : "2009/04/19 06:08:30 -0700",
"updated_at" : "2009/04/19 06:09:17 -0700",
"user" : "fayland",
"title" : "Test Issue",
"votes" : 0
"number" : 2,
"position" : 2,
"state" : "open",
"body" : "new test 3\nnew test 2",
"created_at" : "2009/04/19 18:44:49 -0700",
"updated_at" : "2009/04/19 18:50:44 -0700",
"user" : "fayland",
"title" : "new test 2",
"votes" : 0
"number" : 3,
"position" : 3,
"state" : "open",
"body" : "s",
"created_at" : "2009/04/19 18:51:17 -0700",
"updated_at" : "2009/04/19 18:51:31 -0700",
"user" : "fayland",
"title" : "sssssssss",
"votes" : 0

fayland/sandbox2> q

for now, there are ONLY repos and issue related command. but I would add more in next few days.

Thanks and Enjoy.

Net::GitHub 0.06

19 April 2009

github just released its V2 API version days ago, I spent some hours to update the Net::GitHub.

it's really not a fun to both support V1 and V2 on the same time, I mean some code like follows:
use Net::GitHub;
my $g2 = Net::GitHub->new( version => 2 ); # use Net::GitHub::V2
my $g2 = Net::GitHub->new( version => 1 ); # use Net::GitHub::V1

after a nice sleep, I come out a solution like:
package Net::GitHub;

use Moose;

our $VERSION = '0.06';
our $AUTHORITY = 'cpan:FAYLAND';

sub new {
my $class = shift;
my $params = $class->BUILDARGS(@_);

my $obj;
if ( $params->{version} == 1 ) {
require Net::GitHub::V1;
$obj = Net::GitHub::V1->new($params);
} else {
require Net::GitHub::V2;
$obj = Net::GitHub::V2->new($params);

return $class->meta->new_object(
__INSTANCE__ => $obj,

no Moose;


maybe there is a better way, but it works at least for now.

Thanks and enjoy.


05 April 2009

I just uploaded the Dist-Zilla-Plugin-PerlTidy to CPAN today.

Dist::Zilla is a distribution builder. with it, you can write less, maintain less files. which means less bugs.
for more information, you can check the slides:

Dist-Zilla-Plugin-PerlTidy contains two parts.
one is the App Command, Dist::Zilla::App::Command::perltidy, which let you perltidy your real code.
the other one is the Plugin, Dist::Zilla::Plugin::PerlTidy. it doesn't affect your working code, it just perltidy the code for release (which means included in the tar.gz)

the code is simple, but it's useful.

Have fun!