Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question: ⭐ (object-oriented programming)
sub new
{
my $self = {};
bless $self, shift;
$self->_init();
return $self;
}
{
my(%registry,%regattrs)
...
sub _parseStart
sub _parseEnd
...
sub _init()
{
$self = shift;
parse file....
$self = { 'modules' => { %registry },
'site' => $regattrs{site}
};
}
}
The problem is that upon returning from init back in the constructor, $self doesn't seem to be referring to anything anymore, even though i know it's been assigned properly (tested to see if the content was there before exiting _init - it was). Am i having scoping issues?
This isn't the first time I've done something like this, but I had no difficulties last time.
Thanks much,
Stephen
Originally posted as a Categorized Question.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: having difficulty getting $self back from an _init() function⭐
by Fastolfe (Vicar) on Oct 13, 2000 at 02:10 UTC | |
|
Re: having difficulty getting $self back from an _init() function
by Anonymous Monk on Oct 13, 2000 at 08:04 UTC |