Commit | Line | Data |
6badd1a5 |
1 | package ops; |
2 | |
3 | use Opcode qw(opmask_add opset invert_opset); |
4 | |
5 | sub 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. |
2ea6c7ce |
10 | opmask_add(invert_opset opset(@_)) if @_; |
6badd1a5 |
11 | } |
12 | |
13 | sub unimport { |
14 | shift; |
2ea6c7ce |
15 | opmask_add(opset(@_)) if @_; |
6badd1a5 |
16 | } |
17 | |
18 | 1; |
19 | |
20 | __END__ |
21 | |
22 | =head1 NAME |
23 | |
24 | ops - 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 | |
f610777f |
34 | Since the ops pragma currently has an irreversible global effect, it is |
6badd1a5 |
35 | only of significant practical use with the C<-M> option on the command line. |
36 | |
37 | See the L<Opcode> module for information about opcodes, optags, opmasks |
38 | and important information about safety. |
39 | |
40 | =head1 SEE ALSO |
41 | |
42 | Opcode(3), Safe(3), perlrun(3) |
43 | |
44 | =cut |
45 | |