サブパッケージにアクセスできない理由がわかりません:
mbzdb
:
#!/usr/bin/perl -w
use lib "./lib";
use MbzDb::Instance;
my $instance = new MbzDb::Instance();
$instance->startFromCommandLine();
lib/MbzDb/Instance.pm
:
#!/usr/bin/perl -w
package MbzDb::Instance;
use strict;
use warnings;
use Getopt::Long;
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT = qw(new startFromCommandLine);
sub new {
my $class = shift;
return bless {}, $class;
}
sub startFromCommandLine {
my $self = shift;
}
lib/MbzDb.pm
エクスポートで同じコードを使用すると、正しく機能します。私は何を間違っていますか?
与えられたエラーは次のとおりです。
./mbzdb 行 6 で、パッケージ「MbzDb::Instance」を介してオブジェクト メソッド「new」を見つけることができません (「MbzDb::Instance」をロードするのを忘れた可能性がありますか?)。