use Errno qw( ENOSPC ); { local *CORE::GLOBAL::print = sub { $! = ENOSPC; return}; # make test call # see what happens when a device is full }