user1720753
user1720753

Reputation: 55

Perl exporting module function from higher directory

I have file .../module.pm and file .../somedir/program.pl How to export function from module.pm to program.pl? Or how to get path to current script?

Upvotes: 2

Views: 59

Answers (1)

Andomar
Andomar

Reputation: 238296

You can use FindBin to retrieve the path of the current script:

use FindBin;  # locate this script
use lib "$FindBin::Bin/../module.pm";  # use the parent directory
use yourlib;

Upvotes: 3

Related Questions