--- 3m-810.pl 2009/06/01 18:36:42 38 +++ 3m-810.pl 2009/06/01 21:07:11 39 @@ -398,7 +398,6 @@ sub writechunk { my $str=shift; -warn "DEBUG: ", as_hex($str); my $count = $port->write($str); my $len = length($str); die "wrong write length $count != $len in ",as_hex( $str ) if $count != $len; @@ -440,6 +439,8 @@ sub assert { my ( $from, $to ) = @_; + return unless $assert->{expect}; + $from ||= 0; $to = length( $assert->{expect} ) if ! defined $to; @@ -517,7 +518,7 @@ } sort { length($a) <=> length($b) } keys %$dispatch; warn "?? payload dispatch to ",dump( $payload, $dispatch, $to ) if $debug; - if ( defined $to ) { + if ( defined $to && $payload ) { my $rest = substr( $payload, length($to) ); warn "## DISPATCH payload to with rest", dump( $payload, $to, $rest ) if $debug; $dispatch->{ $to }->( $rest );