Inheriting PostgresNode object

From: Victor Wagner <vitus(at)wagner(dot)pp(dot)ru>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Inheriting PostgresNode object
Date: 2016-09-13 18:21:53
Message-ID: 20160913212153.573e378b@wagner.wagner.home
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi hackers!

I've encountered need to extend functionality of PostgresNode class
from the TAP test framework. What I want can easily be done via perl
object inheritation.

But documentation in the PostgresNode.pm recommends to use get_new_node
function rather than call PostgresNode constructor directly.

I see following ways to solve this problem:

1. Ignore this recommendation and write new class which calls
SUPER->new() from the constructor and call its constructor directly

2. Get the PostgresNode object from get_new_node function and bless it
into new class

3. Use delegation instead of inheritance. This would require some black
magic with AutoLoader module to avoid writing wrapper for each
PostgresNode method.

Which approach would people recommend to take?

--
Victor Wagner <vitus(at)wagner(dot)pp(dot)ru>

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2016-09-13 18:23:06 Re: kqueue
Previous Message Tom Lane 2016-09-13 18:17:19 Re: Implement targetlist SRFs using ROWS FROM() (was Changed SRF in targetlist handling)