I would have your object contain two other objects, one for input and one for output. The connect method could then be implemented something like this (untested):
Similarly for your output method.sub connect_read { my $self = shift; my $class = shift; $class = "Obj::Driver::$class"; # Load the class if need be then instantiate require $class; $self->{input} = $class->connect_read(@_); }
For both types of class (input and output) I would define a base class that is worthwhile to inherit from. For instance many of your drivers might need a number of rather low-level functions, but in your object code you may want to talk to a rather high-level functions. Well in your base class put the layer of obvious functions between the simple functions your drivers need to provide and the complex functions you would like to call. Then a driver only need inherit from the base and write a set of low-level functions, and the high-level functions will just work.
In reply to RE (tilly) 1: Object Heirarchy / Design
by tilly
in thread Object Heirarchy / Design
by lattice
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |