Re: Perl Inheritance(take-2)

2006-11-06 Thread Muttley Meen
On 11/6/06, JupiterHost.Net <[EMAIL PROTECTED]> wrote: Muttley Meen wrote: > Hi! Hello, > $a = Package1::new(); > $a->Package2->Create(); # this should call IncErr too > print "ERR1: $a->{err}\n"; # should print 1 > doent't work as I expected. > > Is there something wrong with the way I `bles

Re: Perl Inheritance(take-2)

2006-11-06 Thread JupiterHost.Net
Muttley Meen wrote: Hi! Hello, $a = Package1::new(); $a->Package2->Create(); # this should call IncErr too print "ERR1: $a->{err}\n"; # should print 1 doent't work as I expected. Is there something wrong with the way I `bless`-ed the class Package2 ? use strict, warnings, and most import

Re: Perl Inheritance(take-2)

2006-11-04 Thread Mumia W.
On 11/04/2006 06:05 AM, Muttley Meen wrote: On 11/3/06, Mumia W. <[EMAIL PROTECTED]> wrote: Please bottom-post. Why should a call to Create() on an object returned by Package2() update the object $a ? It shouldn't normally update the containing object, and it doesn't in your program. For you

Re: Perl Inheritance(take-2)

2006-11-04 Thread Muttley Meen
On 11/3/06, Mumia W. <[EMAIL PROTECTED]> wrote: Please bottom-post. Why should a call to Create() on an object returned by Package2() updatethe object $a ? It shouldn't normally update the containing object, and it doesn't in your program. For your education, try this, print "Inside ERR:\t",

Re: Perl Inheritance(take-2)

2006-11-03 Thread Mumia W.
On 11/03/2006 10:16 AM, Muttley Meen wrote: On 11/3/06, Rob Dixon <[EMAIL PROTECTED]> wrote: Mumia W. wrote: > > On 11/03/2006 02:23 AM, Muttley Meen wrote: >> >> In the attached script I implement two packages: >> Package1 and Package2. >> >> Package2 is derived from Package1, which I guess I

Re: Perl Inheritance(take-2)

2006-11-03 Thread Mumia W.
On 11/03/2006 04:57 AM, Rob Dixon wrote: Mumia W. wrote: > On 11/03/2006 02:23 AM, Muttley Meen wrote: In the attached script I implement two packages: Package1 and Package2. Package2 is derived from Package1, which I guess I dont well. Now Package1 has a method called IncErr which increment

Re: Perl Inheritance(take-2)

2006-11-03 Thread Muttley Meen
Well , here is what I come up with: #! /usr/bin/perl use strict; use warnings; package Package1 ; sub new { my ($class) = @_ ; print "Call new [".$class."]\n" ; my @r = []; my $this = {}; $this->{err} = 0 ; $this->{r}->[0] = Package2->new(); $this->{r}->[0]->{err} =

Re: Perl Inheritance(take-2)

2006-11-03 Thread Rob Dixon
Mumia W. wrote: > On 11/03/2006 02:23 AM, Muttley Meen wrote: In the attached script I implement two packages: Package1 and Package2. Package2 is derived from Package1, which I guess I dont well. Now Package1 has a method called IncErr which increments a variable named $err. If I call somet

Re: Perl Inheritance(take-2)

2006-11-03 Thread Rob Dixon
Muttley Meen wrote: > > Hi! > Sorry if I double post, but the maillserver seems to have something against > perl scripts attachements, so my first email was droped by the MTA : / > Maybe if I put the code inline will be ok > > In the attached script I implement two packages: > Package1 and Package

Re: Perl Inheritance(take-2)

2006-11-03 Thread Mumia W.
On 11/03/2006 02:23 AM, Muttley Meen wrote: Hi! Sorry if I double post, but the maillserver seems to have something against perl scripts attachements, so my first email was droped by the MTA : / Maybe if I put the code inline will be ok In the attached script I implement two packages: Package1 a