in reply to What restrictions are there on code execution when running perl in syntax check mode?

use happens at compile time, so any code in external modules actually runs in syntax check mode.

Taint mode "behaves", as you can easily find out yourself

$ perl -Tce 'BEGIN { system <> }' echo foo Insecure $ENV{PATH} while running with -T switch at -e line 1, <> line + 1. BEGIN failed--compilation aborted at -e line 1, <> line 1.

perl -c script.pl is not safer than running perl script.pl if script.pl is malicious. Just the chances of accidental "bad" code are smaller.

(Update: a few wording improvements)

Second update: constant folding also happens at compile time, but that's hardly unsafe.

  • Comment on Re: What restrictions are there on code execution when running perl in syntax check mode?
  • Select or Download Code