use Errno qw( ENOSPC ); { local *CORE::GLOBAL::print = sub { $! = ENOSPC; return}; # make test call # see what happens when a device is full } #### { open local(LOG), '>>', '/dev/full' or die $!; # /dev/full is a Linux thing # call the test }