|From:||Andrew Dunstan <andrew(at)dunslane(dot)net>|
|Subject:||cleaning up PostgresNode.pm|
|Views:||Raw Message | Whole Thread | Download mbox | Resend email|
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
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".
|Next Message||Alvaro Herrera||2021-04-24 19:14:44||Re: cleaning up PostgresNode.pm|
|Previous Message||Peter Geoghegan||2021-04-24 18:59:29||Re: decoupling table and index vacuum|