OpenID module and Perl 5.10

30 October 2008


that's just a tip for Win32 user

>ppm install http://ppm.tcool.org/archives510/LWPx-ParanoidAgent.ppd
>ppm install http://ppm.tcool.org/archives510/HTTP-Server-Simple.ppd
>ppm install http://trouchelle.com/ppm10/Cache-FastMmap.ppd
>ppm install http://ppm.tcool.org/archives510/Cache-FastMmap-WithWin32.ppd
>ppm install http://trouchelle.com/ppm10/Test-WWW-Mechanize.ppd
>cpan
cpan> force install Catalyst::Authentication::Credential::OpenID

well, when u try to install module in Win32, ppm is a good choice. and try these two repos:
http://ppm.tcool.org/archives510/
http://trouchelle.com/ppm10/

Thanks.

new Locale::Country::Multilingual

29 October 2008


Bernhard Graf is making a huge step on Locale::Country::Multilingual

0.07 10/27/2008
- added correct Unicode support (Bernhard Graf)
- updated and fixed some errors in country data files (Bernhard Graf)
- tie language data to the class, not the instance (Bernhard Graf)
- possibility to preload language files at compile time (Bernhard Graf)
- added method assert_lang() to check availability (Bernhard Graf)
- changed from hashes to arrays where possible (Bernhard Graf)
- documentation (Bernhard Graf)
- tests for new features (Bernhard Graf)

and it has its own trunk now. http://code.google.com/p/perl-locale-country-multilingual/
hope you can join us.

Thanks.

new WWW::Contact code trunk and group

26 October 2008


Sachin Sebastian sent me a new WWW::Contact::Rediffmail and I merged it into WWW::Contact core and release a 0.04 version to CPAN.

since it's not a project which I'm the only developer :), I move it from my personal trunk to a new public trunk:
http://code.google.com/p/perl-www-contact/

and it has a new group: http://groups.google.com/group/perl-www-contact

I hope u can join us!

Thanks.

Acme::PlayCode 0.03

20 October 2008


I uploaded the 0.02 of Acme::PlayCode yesterday evening and 0.03 this morning.

0.02 adds Acme::PlayCode::Plugin::PrintComma

0.03 adds Acme::PlayCode::Plugin::Averything

Have fun.

Acme::PlayCode and MooseX::Types::IO

19 October 2008


I wrote Acme::PlayCode and MooseX::Types::IO and uploaded them to CPAN today.

Acme::PlayCode is just from:
learn PPI 1: double to single
Learn PPI 2: exchange in condition
I don't think it's useful now so I put it as Acme:: for fun.
Acme::PlayCode use MooseX::Object::Pluggable, so everyone can write a plugin for it.
the idea is directly from Devel::REPL. if you want to learn Moose, you should read the source. it's pretty elegant and clean. I think I'll write a plugin for it some days later.

MooseX::Types::IO is IO and IO::All type for Moose. I thought I would use it in Acme::PlayCode so I wrote it, but I didn't use it at last. hmm. but anyway, I'll use it one day later.

Have fun. Thanks.

Learn PPI 2: exchange in condition

18 October 2008


as what I posted before, I want to convert
if ( $a eq 'a' ) {
to
if ( 'a' eq $a ) {

PBP encourages it because it's less buggy.

I wrote another script today to fulfill the above request.
http://fayland.googlecode.com/svn/trunk/script/learn_ppi/02ExchangeCondition.pl

things like
my $a = "a";
my $b = "'b'";
my $c = 'c';
my $d = qq~d~;
if ( $a eq "a" ) {
print "1";
} elsif ( $b eq 'b') {
print "2";
} elsif ( $c ne qq~c~) {
print "3";
} elsif ( $c eq q~d~) {
print '4';
} else {
print '5';
}
if ( $a eq $b ) {
print '6';
}
if ( $c eq '$d' ) {
print 7;
}
if ( $a =~ /$b/ ) {
print 8;
}
if ( $a == '$b' or $c == '$d' ) {
print 9;
}
will be converted into
my $a = "a";
my $b = "'b'";
my $c = 'c';
my $d = qq~d~;
if ( "a" eq $a ) {
print "1";
} elsif ( 'b' eq $b ) {
print "2";
} elsif ( $c ne qq~c~) {
print "3";
} elsif ( q~d~ eq $c ) {
print '4';
} else {
print '5';
}
if ( $a eq $b ) {
print '6';
}
if ( '$d' eq $c ) {
print 7;
}
if ( $a =~ /$b/ ) {
print 8;
}
if ( '$b' == $a or '$d' == $c ) {
print 9;
}

I know it's not perfect. it's just a start.

hmm, I'm thinking about packaging the two scripts into modules then uploading to CPAN.
but I can't find a good name(or namespace) for them.

I'll try later.

Thanks and Enjoy!

learn PPI 1: double to single

18 October 2008


well, I'm very strict on Perl code (more than use strict;).
I want code like my $a = "a"; becomes my $a = 'a'; since it's better.
I'm not considering the speed since it's trivial for " to '. but u'd admit, 'a' is faster than "a".

PPI is really amazing.
it breaks Perl code down into the Perl document/structure we can read and analyze.

To do the task above. I just wrote a script based on PPI.
http://fayland.googlecode.com/svn/trunk/script/learn_ppi/01DoubleToSingle.pl
OK, it's my first time try with PPI, and it's really easy to understand and coding.

Many thanks to Adam Kennedy.

next time, I think I'll deal with
if ( $a eq 'a' ) {
to
if ( 'a' eq $a ) {

I think it's fun. and good to learn a new good thing.

Enjoy and have fun.

Catalyst on Moose

14 October 2008


http://search.cpan.org/~mramberg/Catalyst-Runtime-5.8000_01/

try it. it's new and on Moose.

$ cpan M/MR/MRAMBERG/Catalyst-Runtime-5.8000_01.tar.gz

ok, it fails, but u can download the source code and view a bit. I'm sure the next developer version will be kicked out ASAP.

Enjoy!

=updated

$ cpan parent
$ cpan M/MR/MRAMBERG/Catalyst-Runtime-5.8000_02.tar.gz

it should be working.

Thanks.

Learn Moose 4: augment and 0.02 IRC::Bot::Log::Extended

11 October 2008


augment can be used as trigger in sub, to let user do something he wants.

for example, I want to let user custom $message before insert into $file in IRC::Bot::Log::Extended.
so that he can skip some lines or URI::Find some URLs.

full code are:
http://fayland.googlecode.com/svn/trunk/CPAN/IRC-Bot-Log-Extended/examples/02b_with_filter.pl
http://fayland.googlecode.com/svn/trunk/CPAN/IRC-Bot-Log-Extended/examples/03advanced.pl

I also write a simple test script:
http://fayland.googlecode.com/svn/trunk/script/learn_moose/008_augment.pl

hmm, that's simple. just think about u defined a virtual sub in parent pm, then user can override it in child pm.
nothing special.

Thanks.

IRC::Bot::Log::Extended

10 October 2008


well, I do NOT want to miss the irc talk history when I go sleep. I want to store the talk into plain text, and read it when I'm free.

that's a simple and straight. IRC::Bot is good. really fast and have a logger built-in.
The only thing I don't like IRC::Bot is that it stores all talk history into one file channel.log regardless channel and day. I want to split them, to ease the reading.

so that's why IRC::Bot::Log::Extended is kicked out.
and the example script is http://fayland.googlecode.com/svn/trunk/script/web/irclog.pl

so it's logging for me. all #catalyst #dbix-class #tt #moose talk history.

Thanks.