У меня проблема с perl: импорт символов в зависимости от элементов пути в @INC
и инструкции use
.
Если я введу полный путь в @INC
, импорт сработает. Если часть пути находится в операторе use
, модуль для импорта выполняется, но импорт должен быть выполнен явно:
########################################
# @INC has: "D:/plu/lib/"
#------------------------------------------------
# Exporting file is here: "D:/plu/lib/impex/ex.pm"
#
use strict;
use warnings;
package ex;
use Exporter;
our @ISA = 'Exporter';
our @EXPORT = qw( fnQuark );
sub fnQuark { print "functional quark\n"; }
print "Executing module 'ex'\n";
1;
#------------------------------------------------
# Importing file, example 1, is here: "D:/plu/lib/impex/imp.pl"
#
use strict;
use warnings;
package imp;
use impex::ex;
ex->import( @ex::EXPORT ); # removing this line makes fnQuark unavailable!
# Why is this necessary, 'ex.pm' being an Exporter?
fnQuark();
#------------------------------------------------
# Importing file, example 2, is here: "D:/plu/lib/impex/imp2.pl"
#
use strict;
use warnings;
package imp2;
use lib 'D:/plu/lib/impex';
use ex;
fnQuark(); # works without explicit import
#-------------------------------------------------
В чем моя ошибка?