mifflin has asked for the wisdom of the Perl Monks concerning the following question:
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.
Is this the correct way to do this?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;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: distribution config file
by jhourcle (Prior) on Jun 18, 2006 at 15:57 UTC | |
by rinceWind (Monsignor) on Jun 19, 2006 at 15:27 UTC | |
by IOrdy (Friar) on Jun 20, 2006 at 00:22 UTC | |
|
Re: distribution config file
by IOrdy (Friar) on Jun 19, 2006 at 07:39 UTC |