0
爲什麼我無法訪問子包我不能工作了:如果我用同樣的無法加載Perl的分包
#!/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;
}
:
mbzdb
:
#!/usr/bin/perl -w
use lib "./lib";
use MbzDb::Instance;
my $instance = new MbzDb::Instance();
$instance->startFromCommandLine();
lib/MbzDb/Instance.pm
代碼lib/MbzDb.pm
導出正常。我究竟做錯了什麼?
給出的錯誤是:
無法找到對象的方法「新」經包裝「MbzDb ::實例」(也許你忘了裝載「MbzDb ::實例」?)在./mbzdb line 6.
是否在LIB相同的代碼工作/ Mbzdb.pm如果你註釋掉使用LIB? – 2013-04-11 07:21:26
如果我刪除'use lib「./lib」;'那麼它無法找到該模塊。如果我刪除它並將'.pm'移到另一個位置,我會得到相同的錯誤。 – 2013-04-11 07:28:36
嗯,並且在MbzDb下沒有另一個lib目錄(例如lib/Mbzdb/lib? – 2013-04-11 07:32:17