Devel-ArgNames reviews

RSS | Module Info

Devel-ArgNames (0.03) *****

I was unaware of this module until I saw the previous review. This module is incredibly useful when you need to debug a long list of arguments. For example:

#!/usr/bin/perl -w

use strict;

use Devel::ArgNames;

my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime();

print_args($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst);

sub print_args {

my @args = arg_names();

my @values = @_;

for my $i (0 .. @args - 1) {

printf "%-10s = %s\n", $args[$i], $values[$i];





$sec = 25

$min = 43

$hour = 22

$mday = 7

$mon = 4

$year = 108

$wday = 4

$yday = 128

$isdst = 1

Devel-ArgNames (0.03) *****

I had to fix some horrible code. It was inserting into the database a huge blob of variables into one big row. It looked like:


$user, $name, $phone, $os, $version, $bitrate, ...

36 of these variables were counted between the parentheses. Before refactoring, I wanted to see the values it was inserting on the screen. So I started:

print "user: $user, name: $name..."

Which is no fun.

Luckily I recalled a module Yuval wrote during a lightning talk at a Perl workshop. showed my exact problem in the 3rd <code> block in the POD.

Replacing bind_to_insert above with the my_print_args from the docs did exactly what I wanted. Delicious.

Note this is not a case of a self praising author. I am on AUTHORS, but wrote not nothingmuch, but nothing at all of it. I think I am on AUTHORS because I sat next to him at the workshop.