Saturday, January 02, 2010


this one is my first module of 2010 - WWW::Google::Contacts

it's nothing big but implement the Google Contacts Data API.

so Enjoy!

Friday, December 25, 2009

The End of 2009 CN Perl Advent Calendar

I'm really very happy that we get it done today. the last article is perlthanks from I. and we didn't miss one day. 25 tips 25 days.

I have totally 18 articles published, really Wow! they include ack, autodie, dzil, local::lib, Devel::NYTProf, Padre, pip, Plack, REPL, perlthanks and more.
check them if you missed. :)



Tuesday, December 01, 2009

2009 CN Perl Advent Calendar

we just have the first article for our first advent calendar, from I. :)


Enjoy! Thanks


Friday, October 23, 2009

PSGI and Plack

The most exciting thing in Perl world today is PSGI

The homepage is

I tried that today. there are some tips for Win32 user.
* Don't try to run under Standalone server, the alarm is not supported in Win32
* after install Plack (maybe notest install Plack), try install Plack::Server::AnyEvent or Plack::Server::ServerSimple
* at last, to know a bit of the Plack, cd the cpan build dir or download the tar.gz
C:\strawberry\cpan\build\Plack-0.9006-ZEaDbK\eg\dot-psgi>plackup -a Hello.psgi -s AnyEvent
Accepting requests at
C:\strawberry\cpan\build\Plack-0.9006-ZEaDbK\eg\dot-psgi>plackup -a Hello.psgi -s ServerSimple
Plack::Server::ServerSimple: You can connect to your server at http://localhost:5000/ - - [23/十月/2009 22:19:15] "GET / HTTP/1.1" 200 11 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20090824 Firefox/3.5.3 GTB5" - - [23/十月/2009 22:19:15] "GET /favicon.ico HTTP/1.1" 200 11 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20090824 Firefox/3.5.3 GTB5"
try visit then you'll get the access_log like above.

well, I think the Plack::Middleware::AccessLog should use &POSIX::setlocale(&POSIX::LC_ALL); on qw( .ISO8859-1 .ISO_8859-15 .US-ASCII .UTF-8 ) to avoid 十月 the Chinese.

you can try more with the all the .psgi files under eg/dot-psgi, and you might have some ideas to write a Middleware. :)


(Updates on Oct 24th)
miyagawa applied the patch with some changes and it works pretty well now.
Thanks very much. :)


《Perl 语言入门(第五版)》

《Perl 语言入门(第五版)》

Translated by chunzi, joe.jiang and cnhackTNT

Saturday, September 26, 2009

Canon IXUS 95 IS

I bought a digit camera today: Canon IXUS 95 IS (Chinese).

not so bad. :)

Thursday, September 17, 2009

OpenSocialX::Shindig::Crypter long story

The long story is

we (Zorpia) were developing OpenSocial in last days. The first choice to build a opensocial container is Shindig.

unlucky, it ONLY has PHP and Java version. yeah, I do all my code in Perl, I know nothing about PHP or Java. (well, I know a little PHP now because I was writing Service package with PHP in last days, and I must say, PHP sucks.)

lucky, the Shindig author points me to an URL: Using Shindig in a non PHP or Java environment
that I can write the 'Application' section in Perl. It IS great, really very great.

so at last, I google around and wrote my last solution: OpenSocialX::Shindig::Crypter and the php lib BasicBlobCrypter.php

and now I'm happy to share it with your guys. if you have the same situation with me, you can try that module and tell me your feeling. :)

Thanks. (OK, it's not so long.)

Labels: , ,

OpenSocialX::Shindig::Crypter short story

the short story is that I released the OpenSocialX::Shindig::Crypter yesterday.

the short story is if you want to find a way that encrypt data by Perl and decrypt the encrypted data by PHP, you come to the right place.

my $str = 'o=1&v=3&p=5';
my $cipher = Crypt::CBC->new( {
    'key' => 'length16length16',
    'cipher'=> 'Rijndael',
    'iv' => '1234567890abcdef',
    'literal_key' => 1,
    'padding' => 'null',
    'header' => 'none',
    keysize => 128/8
} );
my $encrypted = $cipher->encrypt($str);
print "encrypted: ".encode_base64($encrypted)."\n";
print "decrypted: ".$cipher->decrypt($encrypted)."\n";

my $hmac = Digest::SHA::hmac_sha1($encrypted, 'hmackey');
print "hmac: " . encode_base64($hmac) . "\n";
print "total: " . encode_base64($encrypted . $hmac) . "\n";
PHP: crypt.php
$str = 'o=1&v=3&p=5';
$encrypted = mcrypt_cbc(MCRYPT_RIJNDAEL_128, 'length16length16', $str, MCRYPT_ENCRYPT, '1234567890abcdef');
$decrypted = mcrypt_cbc(MCRYPT_RIJNDAEL_128, 'length16length16', $encrypted, MCRYPT_DECRYPT, '1234567890abcdef');
echo "encrypted: ".base64_encode($encrypted)."\n"; 
echo "decrypted: ".$decrypted."\n"; 

$blabla = hash_hmac('sha1', $encrypted, 'hmackey', 1);
echo "hmac: " . base64_encode($blabla) . "\n";
echo "total: " . base64_encode($encrypted . $blabla) . "\n";

both of them show the same output:
# perl
encrypted: rgPZe6swWb3t3yIoIZFQaQ==
decrypted: o=1&v=3&p=5
hmac: WLTGeyesYTUhwg6fjVqDudrKRz0=
total: rgPZe6swWb3t3yIoIZFQaVi0xnsnrGE1IcIOn41ag7naykc9
# php crypt.php
encrypted: rgPZe6swWb3t3yIoIZFQaQ==
decrypted: o=1&v=3&p=5
hmac: WLTGeyesYTUhwg6fjVqDudrKRz0=
total: rgPZe6swWb3t3yIoIZFQaVi0xnsnrGE1IcIOn41ag7naykc9

I'll post a long story later today.


Labels: , ,

Thursday, September 03, 2009

use Moose; or no Moose;

recently "Moose or no Moose" is spreading to the Perl world.

Moose or No Moose
Command Line Moose or Knowing what You Don't know.
Re: Moose Or No Moose
Take arms against a sea of troubles
Re: Re: Moose Or No Moose
Moose Startup Time over Time

basically I agree with Adam Kennedy that Array::Compare shouldn't based on Moose. Test::Warn is a popular module and Array::Compare without Moose can totally ease the install of the Test::Warn.

in the meantime, I would agree with Stevan Little that we shouldn't hold the usage of the Moose. it's a great module with great idea and great contributors. I use it in my daily life and it works great. once more and more people/module use Moose, the problem wouldn't become a problem.

I think Padre should use Moose, I know Adam would reject that, but I insist on that Padre will benefit from Moose even Class::XSAccessor is the fastest accessor module now. Padre will be in a better structure and much more easy to read if it's coded with Moose. Plugin/Document/Highlighter would be easily written and plugged.

another thing is that I met the problem before. Long time ago people rate down WWW::Contact because it uses Moose. but I think it's not true. Moose helps me to build the module.

at last and in short, I think simple module (like only use the accessor of Moose) shouldn't use Moose but large software/module like Padre should use Moose.

Thanks. just personal thoughts.