Hi,

Sometime ago I wrote this code in my check_validrcptto_cdb plugin:

sub register {
    my ( $self, $qp, %args ) = @_;

    $self->{_cdb_file} = q{config/validrcptto.cdb};
    if ( defined( $args{cdb_file} ) ) {
        if ( $args{cdb_file} =~ /^\d+$/ ) {
            $self->{_cdb_file} = $args{cdb_file};
        }
    }
# etc.

I've just revisited it and I'm wondering... wtf does this line do:

        if ( $args{cdb_file} =~ /^\d+$/ ) {

I *think* it's saying "if the argument named "cdb_file" is made up
entirely of digits".

I suspect that, as I used the adaptive logging plugin as a guide, I've
just copied the tests used for the numeric adaptive logging parameters.
I've not noticed it didn't work since I've always had the cdb file in
the default location. Ooops.

I've changed the code to this:

        if ( -r $args{cdb_file} ) {
            $self->{_cdb_file} = $args{cdb_file};
        }


The full plugin is available here:

http://robinbowes.com/projects/check_validrcptto_cdb

R.

Reply via email to