Hi all I'm trying to write a basic class that will contain some configuration details, unfortunately it bombs out and doesn't do anything.

################### start of class ###########################
#configuration.pm
package configuration;
use strict;


sub new{ my $class=shift; my $self=shift;

   bless($self, $class);
   return $self;
}

sub get_conf{
   my $self=shift;
   my %conf=(
             db_name="bla1",
              username="bla2",
              password="bla3"

   );

return \%conf;

}

1;
################ end of class ####################


Mt CGI script is this:

##################### CGI Script #######################
#!/usr/bin/perl -w
use strict;
use configuration;

print "Content-type: text/html\n\n";

my $conf=configuration->new;
my $conf->get_conf;

print "$conf->{'db_name'}";
###########################################


All I want to do is print off the value of the hash refs at the moment before I start building on it. I know I'm not passing anything to the "new" constructor but I'm not sure what I should be passing to it. The name of the class shouldn't be defined outside the class surely?


Anyone have any ideas?


Cheers,

Graeme :)



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to