use Test::More; plan tests => 10; if( $> != 0 ) { # re-exec as root: # hope we didn't have -Ilib or -Mblib on the invocation line exec 'sudo', $0, @ARGV; # Also see Devel::PL_origargv }; if( $> != 0 ) { SKIP: { skip "Must be root", 10; }; exit; }; ... run tests as root ...