cleaning up PostgresNode.pm

Поиск
Список
Период
Сортировка
От Andrew Dunstan
Тема cleaning up PostgresNode.pm
Дата
Msg-id 5fedb05a-0d0d-d721-2e7c-1ba99919f87d@dunslane.net
обсуждение исходный текст
Ответы Re: cleaning up PostgresNode.pm
Список 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 по дате отправления:

Предыдущее
От: Peter Geoghegan
Дата:
Сообщение: Re: decoupling table and index vacuum
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: cleaning up PostgresNode.pm