in reply to Re: Inherit from a Role (or something like that)
in thread Inherit from a Role (or something like that)
Thanks, the other node you're referring to was an answer to my previous question :)
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");
In Section
Seekers of Perl Wisdom