Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^4: Data inheritance

by perlbaski (Sexton)
on Sep 23, 2011 at 21:15 UTC ( [id://927619]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Data inheritance
in thread Data inheritance

Hey..yes..that was a typo..i cant copy paste my code here. I had $self->$some_var="abcd";#This was not the problem.
package CommonObject; my $some_var; #constructor sub new{ my $class=shift; my $self = {} ; bless $self, $class; print Dumper($self); return $self; } 1; package MyObject; our @ISA = qw( CommonObject ); use strict; use warnings; sub new{ my $class=shift; my $testName=shift; my $self = CommonObject->new(); $self->$some_var="abcd"; print $self->$some_var; return $self; } 1; #!/usr/bin/perl use MyObject; my $obj=MyObject->new("lkj");
Thats the exact code

Replies are listed 'Best First'.
Re^5: Data inheritance
by ikegami (Patriarch) on Sep 23, 2011 at 21:17 UTC
    Of course that doesn't work. That's the same as your original code, just with a scalar instead of an array. Goto Re: Data inheritance

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://927619]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (2)
As of 2024-03-19 06:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found