LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   perl object Oriented Programming Question (https://www.linuxquestions.org/questions/programming-9/perl-object-oriented-programming-question-220216/)

eastsuse 08-20-2004 12:00 PM

perl object Oriented Programming Question
 
I've created a perl object where I would like to create a 2nd object inside the "new" constructer. By doing this, I hope that the 2nd object can persist throughout all subsequent method calls. However, retreiving the object through the self instance isn't happening. Can I even do this? Here's my example code:

sub new {

my($pkg) = shift;
my($self) = {};

bless $self, $pkg;

my $java = new Java();

$self->{'java'} = $java;

return $self;

}

eastsuse 08-20-2004 12:29 PM

never, mind, this code actually works. I had a brain fart.


All times are GMT -5. The time now is 05:28 PM.