1package ops; 2 3use Opcode qw(opmask_add opset invert_opset); 4 5sub import { 6 shift; 7 # Not that unimport is the prefered form since import's don't 8 # accumulate well owing to the 'only ever add opmask' rule. 9 # E.g., perl -Mops=:set1 -Mops=:setb is unlikely to do as expected. 10 opmask_add(invert_opset opset(@_)) if @_; 11} 12 13sub unimport { 14 shift; 15 opmask_add(opset(@_)) if @_; 16} 17 181; 19 20__END__ 21 22=head1 NAME 23 24ops - Perl pragma to restrict unsafe operations when compiling 25 26=head1 SYNOPSIS 27 28 perl -Mops=:default ... # only allow reasonably safe operations 29 30 perl -M-ops=system ... # disable the 'system' opcode 31 32=head1 DESCRIPTION 33 34Since the ops pragma currently has an irreversible global effect, it is 35only of significant practical use with the C<-M> option on the command line. 36 37See the L<Opcode> module for information about opcodes, optags, opmasks 38and important information about safety. 39 40=head1 SEE ALSO 41 42Opcode(3), Safe(3), perlrun(3) 43 44=cut 45 46