<document source="test data">
<section ids="if-test" names="if test">
<title>
If Test
<paragraph>
Run with trusted=0.
<paragraph>
Make sure \n\
<literal>
perl
directive can't give privileges to \n\
<literal>
if
.
<system_message level="1" line="8" source="test data" type="INFO">
<paragraph>
No directive entry for "perl" in module "Text::Restructured::Directive".
Trying "perl" as canonical directive name.
<paragraph>
Trusted is not required for safe operations like the following.
<system_message level="1" line="12" source="test data" type="INFO">
<paragraph>
No directive entry for "if" in module "Text::Restructured::Directive".
Trying "if" as canonical directive name.
<paragraph>
This text should appear, since we're using the 'dom' writer.
<paragraph>
However, it is required for things like opening a file.
<system_message level="4" line="18" source="test data" type="SEVERE">
<paragraph>
Error executing "if" directive: open trapped by operation mask at (eval 66) line 2.
Run with -D trusted if you believe the code is safe.
<literal_block xml:space="preserve">
.. if:: $main::PARSER->{opt}{D}{trusted} = 1; open F,"include1.txt"
\n\
This text should *not* appear, since it tries an unsafe operation.
<paragraph>
Make sure we can't give ourselves privileges in previous \n\
<literal>
if
directive.
<system_message level="4" line="24" source="test data" type="SEVERE">
<paragraph>
Error executing "if" directive: open trapped by operation mask at (eval 72) line 2.
Run with -D trusted if you believe the code is safe.
<literal_block xml:space="preserve">
.. if:: open F,"include1.txt"
\n\
This text should also *not* appear.
<paragraph>
A paragraph.