how to add switches to a perl program like plackup or dzil


perl -d:Confess $( which dzil )  release

If you are using development tools like or, and are trying to figure out how to use them with applications with a shebang like dzil, plackup, etc, the 'which' command is your friend. Invoking those scripts with perl should be effectively the same thing, and you can pass whatever switches you want to pass to perl.

See the comments for other ways to achieve the same thing.


The other trick is simply:

PERL5OPT="-d:Confess" dzil release

Though that has the obvious downside that any child process spawned will inherit those switches.

That, and I'm forever forgetting if its PERL5OPT or PERL5OPTS

Much simpler: use -S flag of perl (see perlrun):

perl -d:Confess -S dzil release

See also my dzil profiling tricks from my talk at YAPC::EU.

I need to do this frequently because some people insist on using /usr/bin/env in the shebang line to find the first perl installed instead of using the one the installed it.

perl5.20.0 `which mojo` ...

Leave a comment

About Samuel Kaufman

user-pic CTO / Codemonkey,