1ba47ec9dSmillertpackage ops; 2ba47ec9dSmillert 3*df042708Smillertour $VERSION = '1.02'; 479cd0b9aSmillert 5ba47ec9dSmillertuse Opcode qw(opmask_add opset invert_opset); 6ba47ec9dSmillert 7ba47ec9dSmillertsub import { 8ba47ec9dSmillert shift; 9ad15181aSmillert # Not that unimport is the preferred form since import's don't 10ba47ec9dSmillert # accumulate well owing to the 'only ever add opmask' rule. 11ba47ec9dSmillert # E.g., perl -Mops=:set1 -Mops=:setb is unlikely to do as expected. 12ba47ec9dSmillert opmask_add(invert_opset opset(@_)) if @_; 13ba47ec9dSmillert} 14ba47ec9dSmillert 15ba47ec9dSmillertsub unimport { 16ba47ec9dSmillert shift; 17ba47ec9dSmillert opmask_add(opset(@_)) if @_; 18ba47ec9dSmillert} 19ba47ec9dSmillert 20ba47ec9dSmillert1; 21ba47ec9dSmillert 22ba47ec9dSmillert__END__ 23ba47ec9dSmillert 24ba47ec9dSmillert=head1 NAME 25ba47ec9dSmillert 26ba47ec9dSmillertops - Perl pragma to restrict unsafe operations when compiling 27ba47ec9dSmillert 28ba47ec9dSmillert=head1 SYNOPSIS 29ba47ec9dSmillert 30ba47ec9dSmillert perl -Mops=:default ... # only allow reasonably safe operations 31ba47ec9dSmillert 32ba47ec9dSmillert perl -M-ops=system ... # disable the 'system' opcode 33ba47ec9dSmillert 34ba47ec9dSmillert=head1 DESCRIPTION 35ba47ec9dSmillert 367bfa9f44SmillertSince the C<ops> pragma currently has an irreversible global effect, it is 37ba47ec9dSmillertonly of significant practical use with the C<-M> option on the command line. 38ba47ec9dSmillert 39ba47ec9dSmillertSee the L<Opcode> module for information about opcodes, optags, opmasks 40ba47ec9dSmillertand important information about safety. 41ba47ec9dSmillert 42ba47ec9dSmillert=head1 SEE ALSO 43ba47ec9dSmillert 447bfa9f44SmillertL<Opcode>, L<Safe>, L<perlrun> 45ba47ec9dSmillert 46ba47ec9dSmillert=cut 47ba47ec9dSmillert 48