How to ensure a perl file will call modules in the same directory

Suppose you call a perl script remotely, or from a different directory, perhaps through a shell script call or bash alias.

What happens if your script uses a perl package inside the same directory?

Simple solution:

#!/usr/bin/perl
use strict;
# ensure that this specific directory 
# is in the path of the script
use File::Basename;
use lib dirname (__FILE__); 

No comments:

Post a Comment