+ my $thing = shift;
+ my $chan = shift;
+ my $class;
+ if (@_) {
+ $class = shift;
+ } elsif ($chan->isa('DXChannel')) {
+ $class = ref $chan;
+ }
+
+ # generate the line which may (or not) be cached
+ my @out;
+ if (my $ref = $thing->{class}) {
+ push @out, ref $ref ? @$ref : $ref;
+ } else {
+ no strict 'refs';
+ my $sub = "gen_$class";
+ push @out, $thing->$sub() if $thing->can($sub);
+ }
+ $chan->send(@out) if @out;