I have a perl module DB.pm, inside is somthing like:
package GUI::DB;
use strict;
use DBI;
use vars qw(@ISA @EXPORT);
use Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(fun);
sub fun {
my $dsn = "DBI:mysql:database=test";
return $dsn;
}
Then I wrote test.pl:
#!/usr/bin/perl
use strict;
use warnings;
use lib '~/Downloads/GUI'; #Here is the path of the DB.pm module.
use DB;
my $aa = fun();
I have been trying to fix it for hours, I tried to use comment perl -l /path/to/file aa.pl
and it gave me no error but the script didn't run at all, I am purely new to Perl, really stuck.
Please help me.
EDIT: So the module's name is DB.pm and folder's name is GUI now, and I an using use DB
in my script, still doesn't work, where should I save the DB.pm file?