On Monday, July 22, 2002, at 04:36 , chris wrote:
> Here is what I am doing > > use A; > my $this = {}; > bless $this; > my $result = $this->A::sub1 (my $args); why pass in an uninitialized value??? that is scoped to pass out of existence???? also this blessed "object" gambit should be in the package - not in the calling script, see details below... > > Package A; > sub1 { > my $this = shift > my ($data) = @_; > my $result = $this->sub2($data); #### $this->sub2($data) does not load > return "$result"; > } > > sub2 { > ... > } > > I think I can understand why sub2 cannot load when sub1 does > $this->sub2($data). I am unable to change package A. How to fix? p0: clearly you want to start with h2xs and spin out the template for your perl module in a classical way cf perldo h2xs p1: it would be simpler to have a new() and DESTORY() in your package and make them a more traditional model What your my $this = {}; bless $this; is trying for is to offload that to the caller, rather than give them the cannonical solution: #------------------------ # So that we have our _init do our initializing sub new { my $type = shift; my $self = {}; my $class = ref($type) || $type ; bless $self, $class ; $self; } # end New # # so that the autoloader does not have to look for one # sub DESTROY { }; now notice that you can have your use A; my $a_type = A::new; hence the simpler approach of $a_type-><methodName>(@args); which will be what you are looking for in your subs themselves - which appear to be moving in the right direction. p2: do the perldoc Data::Dumper and perldoc ref and you will be able to see what is going on inside... ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]