edwardt_tril has asked for the wisdom of the Perl Monks concerning the following question:
package myObject; $VERSION = 1.00; use strict; use warnings; use diagnostics; use vars qw(@ISA); @ISA = qw(Class::Singleton); use Carp (); $Carp::Verbose =1; { my %serverMap = ( default => { ipaddress=127.0.0.1, dsn=""default, userid="sa", password="password", instance="instance" }, ); sub new{ my ($self, %args) = @_; my %array=(); %array = (%args); #? my $self={}; return bless {$self}; } sub printMe(){ my ($self) = @_; while ( ($server, $credentials) = each $self->%serverMap) { print "$server: "; while ( ($credentials, $value) = each %$roles ) { print "$credentials=$value "; } print "\n"; } } sub fillServerMap($){ <<<<< no idea how to input my ($self) = @_; for $server ( @_ ) { push @ <<<-- NO IDEA how to do this } } } sub removeServerMap($){ my ($self) = @_; $self->serverMap ={}; } sub deleteServer($){ my ($self,$server)=@_; delete $self->serverMap {$server}; } 1
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: how to code a class and use it with hash of hash as data member?
by roboticus (Chancellor) on Mar 17, 2006 at 03:09 UTC | |
by chromatic (Archbishop) on Mar 17, 2006 at 08:38 UTC | |
by edwardt_tril (Sexton) on Mar 17, 2006 at 15:57 UTC | |
by chromatic (Archbishop) on Mar 17, 2006 at 19:50 UTC | |
by edwardt_tril (Sexton) on Mar 17, 2006 at 20:17 UTC | |
by edwardt_tril (Sexton) on Mar 21, 2006 at 08:09 UTC | |
|
Re: how to code a class and use it with hash of hash as data member?
by xdg (Monsignor) on Mar 17, 2006 at 03:11 UTC |