http://www.perlmonks.org?node_id=766440


in reply to Re: Test::MockObject not showing args when mocking a sub
in thread Test::MockObject not showing args when mocking a sub

OK, so the arg list in the mocked call gets a MockObject ref unshifted into the first position. Saying
$port->mock ('write', sub {my $Mock=shift;my $arg=shift;$arg=~s/\r/\n/g;print " +wrote $arg to the serial port\n";});
gives
wrote ATE0 to the serial port wrote AT+CMGF=1 to the serial port wrote AT+CPIN=9532 to the serial port wrote ATI to the serial port
Thank you!

This signature will be ready by Christmas