I want to include a configuration file in my distribution.
So far I've come up with the following in my class to get a config file name and pass it the the super class constructor. The config file will be in the same directory as the class but with a .txt extension.
package GetPaid::FlatFile::Artran;
use warnings;
use strict;
use File::Spec;
use base qw(GetPaid::FlatFile);
our $VERSION = '0.01';
my @Path = split /::/, __PACKAGE__;
my $Configfile = File::Spec->rel2abs((join '/', @Path). ".txt");
sub new {
my ($class, $dir) = @_;
$dir = '.' unless defined $dir;
my $this = $class->SUPER::new(
"$dir/" . uc(pop @Path) . '.TXT', # data file to create
$Configfile
);
bless $this, ref($class) || $class;
}
1;
Is this the correct way to do this?
Will there be any conditions under which this will not work?