I can't work out why I am unable to access a subpackage:
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;
}
If I use the same code in lib/MbzDb.pm
the export works correctly. What am I doing wrong?
The error given is:
Can't locate object method "new" via package "MbzDb::Instance" (perhaps you forgot to load "MbzDb::Instance"?) at ./mbzdb line 6.