cleaning up PostgresNode.pm - Mailing list pgsql-hackers

From Andrew Dunstan
Subject cleaning up PostgresNode.pm
Date
Msg-id 5fedb05a-0d0d-d721-2e7c-1ba99919f87d@dunslane.net
Whole thread Raw
Responses Re: cleaning up PostgresNode.pm  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
List pgsql-hackers
I would like to undertake some housekeeping on PostgresNode.pm.

1. OO modules in perl typically don't export anything. We should remove
the export settings. That would mean that clients would have to call
"PostgresNode->get_new_node()" (but see item 2) and
"PostgresNode::get_free_port()" instead of the unadorned calls they use now.

2. There are two constructors, new() and get_new_node(). AFAICT nothing
in our tests uses new(), and they almost certainly shouldn't anyway.
get_new_node() calls new() to do some work, and I'd like to merge these
two. The name of a constructor in perl is conventionally "new" as it is
in many other OO languages, although in perl this can't apply where a
class provides more than one constructor. Still, if we're merging them
then the preference would be to call the merged function "new". Since
we'd proposing to modify the calls anyway (see item 1) this shouldn't
impose a huge extra workload.

These changes would make the module look more like a conventional perl
module.

Another item that needs looking at is the consistent use of Carp.
PostgresNode, TestLib and RecursiveCopy all use the Carp module, but
contain numerous calls to "die" where they should probably have calls to
"croak" or "confess".


cheers


andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com




pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: decoupling table and index vacuum
Next
From: Alvaro Herrera
Date:
Subject: Re: cleaning up PostgresNode.pm