Inheriting PostgresNode object - Mailing list pgsql-hackers

From Victor Wagner
Subject Inheriting PostgresNode object
Date
Msg-id 20160913212153.573e378b@wagner.wagner.home
Whole thread Raw
Responses Re: Inheriting PostgresNode object  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List 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@wagner.pp.ru>



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Implement targetlist SRFs using ROWS FROM() (was Changed SRF in targetlist handling)
Next
From: Andres Freund
Date:
Subject: Re: kqueue