#!/usr/bin/perl -w use strict; use warnings; use Class::DBI; package AvalancheDB; our $DBPath="avalanchedata.sqlite"; # Default file nme our $DBH; sub import{ my ($class,$newpath)=@_; $DBPath = $newpath || $DBPath; #print "IMPORT: Setting path to '$DBPath' \n\t \n"; ## Delay this setting till AFTER IMPORT !! AvalancheDB::DBI->connection(qq|dbi:SQLite:dbname=$DBPath|, "", "") or die "Cannot connect to Database at $DBPath;"; } ... #### ... my $ProgramDir; BEGIN{ ($ProgramDir) = ( $0=~m|(.+)\/.+$|, $0=~m|(.+)\\.+$| ,"."); } use lib ( $ProgramDir, ); # Current Program's Dir use AvalancheDB ("$ProgramDir/avalanchedata.sqlite"); ...