[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: What config file for a .pm perl module ?



On Fri, Dec 28, 2001 at 10:31:01AM +1100, Craig Sanders wrote:
> On Thu, Dec 27, 2001 at 07:03:38PM +0100, Eric Van Buggenhaut wrote:

[...]

> 
> you can verify that this does what you want by using the Data::Dumper
> module. e.g. by adding something like the following lines to the script:
> 
>     use Data::Dumper ;
> 	print $Dumper($virtual1);

All worked fine and I ended up with this:

package DBIx::Password;
use strict;
use DBI();

@DBIx::Password::ISA = qw ( DBI::db );
($DBIx::Password::VERSION) = ' $Revision: 1.7 $ ' =~ /\$Revision:\s+([^\s]+)/;

my %driver_cache;
my %virtual1 = {};

my $config = "/etc/dbix-password.conf";
open (IN,$config) || die "I need a config file: $!";

my @fields = qw(user username password port database attributes connect driver
host);

while (<IN>) {
        next if /^(#.*)?$/; #skip comments and blanks
        my @user = m/:?'([^']*)':?/g;
        foreach (0 .. 8) { #write fields
                $virtual1->{$user[0]}->{$fields[$_]} = $user[$_];
        };
}
close IN;

sub connect {

[...]


The only problem I face is a local/global one:

When running the script using this module, I get this error:

mrmime_SLASH:/# install-slashsite
Global symbol "$virtual1" requires explicit package name at /usr/lib/perl5/DBIx/Password.pm line 47.

What does it mean ??

Cheers,
-- 
Eric VAN BUGGENHAUT     "Hay tampones y tampones..." (Eva Serrano)
			Andago
        \_|_/           Av. Santa Engracia, 54
       \/   \/          E-28010 Madrid - tfno:+34(91)2041100
a n d a g o  |--        http://www.andago.com
       /\___/\ 		"Innovando en Internet"
        / | \           eric@andago.com



Reply to: