Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1laNk0-0001wb-57 for pgsql-hackers@arkaria.postgresql.org; Sat, 24 Apr 2021 19:14:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1laNjz-0007yA-0j for pgsql-hackers@arkaria.postgresql.org; Sat, 24 Apr 2021 19:14:55 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1laNjy-0007y3-QZ for pgsql-hackers@lists.postgresql.org; Sat, 24 Apr 2021 19:14:54 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1laNju-000465-J4 for pgsql-hackers@postgresql.org; Sat, 24 Apr 2021 19:14:54 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 6674C5C00BD; Sat, 24 Apr 2021 15:14:48 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Sat, 24 Apr 2021 15:14:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=osUXhqR1898cCINyqfJlOhd/n0BDhLBhFniuBdTOeDI=; b=A4cZgsxX DK5Zhm2niT6V2REswuj6Hx3IY51E/ZbS/yZnXOqrWlYrWRO0Aonk8pkZDGlaf1k1 evDc5bu+QXBoeKhaP5NPDMLne8DyIbSifF/K2+p6u2vh9+rtgiIynC/Hylm1STb7 BgHNu9hy81EBeEDxBWaPdNGtm6cvZFE1IBkbJXFkc5rkKvOdKXjq13RKmdtBXPnj c8g8Gwusr4X0mRrhpYt+umfhN5OmZ9m7vtxMfkjDOXFBtnOI/hqMfXrQ/rv5ZyiT GrCTel6cd/bHHHit8/fni6qrI7SpVpoMiTvLIXtwp5qEWozGqsB9z19vpeaVBv3a 3h7l1HQOeU5Nsw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvddugedgudefgecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvuffkgggtugfgjggfsehtkeertddtredunecuhfhrohhmpeetlhhv rghrohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorh hgqeenucggtffrrghtthgvrhhnpeeufffhjeeiueeuffegvddukeegledtveeivdeiueef ieeivefgteehueefteehvdenucfkphepudeltddrleehrdduledrleehnecuvehluhhsth gvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghlvhhhvghrrhgvsegr lhhvhhdrnhhoqdhiphdrohhrgh X-ME-Proxy: Received: from perhan.alvh.no-ip.org (unknown [190.95.19.95]) by mail.messagingengine.com (Postfix) with ESMTPA id CBA8524005A; Sat, 24 Apr 2021 15:14:47 -0400 (EDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id BAFE52A079D; Sat, 24 Apr 2021 15:14:44 -0400 (-04) Date: Sat, 24 Apr 2021 15:14:44 -0400 From: Alvaro Herrera To: Andrew Dunstan Cc: PostgreSQL-development Subject: Re: cleaning up PostgresNode.pm Message-ID: <20210424191444.GA25008@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <5fedb05a-0d0d-d721-2e7c-1ba99919f87d@dunslane.net> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2021-Apr-24, Andrew Dunstan wrote: > > 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. +1 > 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. +1 on "new". I think we weren't 100% clear on where we wanted it to go initially, but it's now clear that get_new_node() is the constructor, and that new() is merely a helper. So let's rename them in a sane way. > 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". I wonder if it would make sense to think of PostgresNode as a feeder of sorts to Test::More and the like, so make it use diag(), note(), explain(). -- Álvaro Herrera Valdivia, Chile "If you have nothing to say, maybe you need just the right tool to help you not say it." (New York Times, about Microsoft PowerPoint)