July 2012 Archives

Stop writing Perl books!*

People should write (more) books on CPAN instead. Here are some ideas.

1) The best of CPAN. A curated list of modules, picked by the editor. I would prefer a task-oriented organization. Every mention of modules should also at least mentions its maintenance status (is it actively maintained? is the author responsive? bug queue? are bugs getting fixed?), performance characteristics, strong points, drawbacks, interface. Tasks doable by Perl's builtins and core modules can be mentioned too, although the editor should not dwell too much on those.

2) Creating and maintaini…

Including Changes information in POD

Is including Changes information in main module's POD a good idea?

You bet. Typing "man Foo" or "perldoc Foo" beats having to go to search.cpan.org or metacpan.org and search for Foo and click some more. Or having to download the distribution, extract the tarball, and viewing the Changes file.

Well, actually, it's a good idea as long as module authors don't have to do it manually.

So, Pod::Weaver::Section::Changes. Example Changes POD sectio…

Even less hassle when benchmarking Perl code

About a year ago I blogged about Bench, a simpler alternative to Benchmark. I got tired of having to type this on the terminal:

% perl -MBenchmark -e'timethis($count, "code")'
% perl -MBenchmark -e'timethese($count, {label1 => sub { code1 }, label2 => sub { code2 })'

I dislike the interface because it forces me to remember/decide/do too many…

Introducing trash-u (File::Trash::Undoable)

Python has trash-cli, Bash has rmv, now Perl has trash-u (from File::Trash::Undoable, which in turns wraps File::Trash::FreeDesktop).

To trash your files:

% trash-u foo.tmp *.bak

To see the contents of your trash:

% trash-u…

List of Perl modules comparison articles

Just created a wiki page at the Perl 5 Wiki, mainly to catalog the great work that Neil Bowers has done. Hopefully it can be helpful for module shoppers. The page should probably be linked from elsewhere.

(Some lessons in) optimizing Org::Parser

Here's what I have been using in my ~/.bashrc for the past few months:

list-org-todos --due-in 7 --group-by-tags ~/o/todo.org
list-org-anniversaries --has-tags '[remind_anniv]' --due-in 14 --max-overdue 7 ~/o/addressbook.org

list-org-todos and list-org-anniversaries come with App-OrgUtils, which in turn uses Org::Parse…

Wishlist for Perl-related websites #1

One of the purpose of blogging for me is to record ideas and thoughts. So, here's another series: features I'd like to see on various Perl-related websites (like search.cpan.org, MetaCPAN, cpanratings, blogs.perl.org, etc). There will be future posts.

  • cpanratings: comment on a review. Sometimes a review is so $adjective that you just want to say something about it :)

  • /users/steven_haryanto/2012/07/index.html
  • Moo 1.0 released

    Just noticed from my CPAN feed that Moo 1.000000 is released. Yay. Also wishing mst to reach 1.000000 in recovery soon.

    (I remember about a year ago when only my dists were the ones mainly using Moo. It's nice to see the list has grown. Not far behind Mouse and ="https://metacpan.org/requires/distribution/Moose?p=2&sort=%5B%5B2%2C…

    Data::Format::Pretty::Console just got a bit prettier - dates

    One of the small annoyances I have when displaying data is with dates (timestamps), which some APIs produce.

    $ perl -MData::Format::Pretty::Console=format_pretty \
      -e'print format_pretty([map {{msg=>"msg$_", send_date=>1342610186+$_*12345}} 1..3])'
    | msg  | send_date  |
    | msg1 | 1342622531 |
    | msg2 | 1342634876 |
    | msg3 | 1342647221 |

    Often I have to copy paste the timestamp to irb and do something like 'Time.at(X)'.

    No more. The latest release of ="http://me…

    How does your module's abstract fare?

    I've seen lots of bad module abstracts in CPAN uploads. So today I thought let's make a module to evaluate that (dzil plugin coming "soon"). A proof of concept: CPAN::Critic::Module::Abstract. It's modelled after Perl::Critic, with policies/profiles/themes/severity and all that (albeit simpler and not everything is configurable yet). Sample output:

    $ critic-cpan-module-abstract ""
    | message      …

    Perl module ideas #4

    About the Perl Module Ideas posting series. Previous posts: #1, #2, #3.

    1. JSON::Color, YAML::Color. I'm loving colors on the terminal. Only recently (yes, recently!) found out that terminals can support 256 colors. A…

    Logging LWP HTTP requests with Log::Any

    Yet another effort to add Log::Any logging to a popular module, this time LWP. Presenting: Net::HTTP::Methods::patch::log_request. Inside, tt's currently just a wrapper for format_request() method in Net::HTTP::Methods, which is where the raw HTTP request is being formed.

    To use it:

    use Net::HTTP::Methods::patch::log_request;

    # now all your LWP HTTP requests are logged

    use LWP::UserAgent;
    my $ua = LWP::Use…

    Logging your SQL statements with Log::Any

    In the accidental quest of conquering the logging world with Log::Any, presenting Log::Any::For::DBI. I needed something like DBIx::Log4perl but for Log::Any, so I wrote one. Internally it's much simpler than DBIx::Log4perl currently and only logs method calls like connect(), prepare(), do(), selectrow_hashref(). Suggest or send a patch if you want more features. The module builds upon the more general /users/steven_haryanto/2012/07/index.html

    So apparently this is creepy

    Responding to RT #78146 (and a recent CPAN rating) I am pulling the library off CPAN.

    However, I would like to elicit some comments here, especially from members of the discussed gender (that is, if they want to expose themselves). I admit, having never worked or lived in America/Europe/anywhere abroad really, I am pretty oblivious to the politics of the whole thing. Were this done in my country, I w…

    About Steven Haryanto

    user-pic A programmer (mostly Perl 5 nowadays). My CPAN ID: SHARYANTO. I'm sedusedan on perlmonks. My twitter is stevenharyanto (but I don't tweet much). Follow me on github: sharyanto.