in reply to Re: Inherit from a Role (or something like that)
in thread Inherit from a Role (or something like that)
Are you saying that Server and Client each want a different derived class of the Connection, but the Connection may already be different concrete classes?I'm not sure if I understand you here correctly: The basic idea is to have 2 interchangeable ways of providing "remote access" functionality to the Server and Client objects. The application will then do something like:
Where in this example "run" is defined in the Role and implemented by SSH and Socket.my $server = Server->new(type => "ssh"); # to create an SSH connection $server->run("ifconfig"); my $server2 = Server->new(type => "socket"); # to create a socket conn +ection $server2->run("ifconfig"); my $client = Client->new(type => "ssh"); $client->run("ls");
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Inherit from a Role (or something like that)
by John M. Dlugosz (Monsignor) on May 20, 2011 at 23:37 UTC | |
by elTriberium (Friar) on May 21, 2011 at 00:15 UTC | |
by John M. Dlugosz (Monsignor) on May 21, 2011 at 12:41 UTC |