How do I provide @INC
externally for the cover script that is part of the Devel::Cover
module.
I want cover script to run by searching for libraries relative to where it is triggered.
Idea is to have cover as part of source, and whoever gets this should be able to run directly without concerning the libraries, which will be relative to where it is.
I tried to change the script and have a BEGIN
block inside this which will push paths to INC
.
It works fine, but changing a script is not so good. I want INC
to have my relative paths when it is called.
I would say there are 2 ways:
1-st In the actual script use:
use lib '/home/foobar/code';
2-nd When you are calling the script do -I on the command line (That's a capital i)
The last solution is the most temporary solution. Add a -I /home/foobar/code flag to perl when running the script.
perl -I /home/foobar/code script.pl
This will add /home/foobar/code to the beginning of @INC for this specific execution of the script.