The problem I have this:
I create an object and pass a value to my constructor like this: Conf->new(site=>'x'), this tells the constructor which site I want the config for, then at the end of the constructor I call $self->_init();
This passes a reference to $self ( I think ) using $self = shift; When I die out using: die %{$self};
I get the value that "x" equals ( x => '/usr/local/apache/htdocs/x' ) I need to perform additional logic in $self->_init(); and what I really need to do is get the name, which in this case is "x" instead of the value which in this case is "/usr/local/apache/htdocs/x". How do I do this I'm a bit lost with perl OO programming :(
Thank you for any light anyone can shed on this.
Graeme :)
################ Perl Code #################
sub new{ my ($caller, %arg) = @_; my $conv = { x => '/usr/local/apache/htdocs/x', y => '/usr/local/apache/htdocs/y', z => '/usr/local/apache/htdocs/z' }; my $caller_is_obj = ref($caller); my $class = $caller_is_obj || $caller; my $self = bless {}, $class; $self->{_doc_root} = $conv->{$arg{site}||'x'}; if(!exists $conv->{$arg{site}}){ die "check for typos in yer params"; } $self->_init(); }
sub _init{ my $self = shift; die %{$self}; } ##################### End of Perl Code ####################
_________________________________________________________________
Get a FREE connection, FREE modem and one month's FREE line rental, plus a US or European flight when you sign up for BT Broadband! http://www.msn.co.uk/specials/btbroadband
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>