LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-20-2004, 12:00 PM   #1
eastsuse
Member
 
Registered: Dec 2003
Location: Pacific Palisades
Distribution: Suse 9.0
Posts: 48

Rep: Reputation: 15
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;

}
 
Old 08-20-2004, 12:29 PM   #2
eastsuse
Member
 
Registered: Dec 2003
Location: Pacific Palisades
Distribution: Suse 9.0
Posts: 48

Original Poster
Rep: Reputation: 15
never, mind, this code actually works. I had a brain fart.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to write a object oriented c program? ssg14j Programming 2 08-17-2005 10:47 AM
How to write a object oriented program using c ssg14j Programming 6 08-10-2005 09:56 AM
How are object-oriented languages transformed to GCC's RTL ? desmond5 Programming 0 04-17-2005 01:38 AM
Problem with "Object Oriented Concepts" Mohsen Programming 6 03-24-2004 12:21 AM
Object-Oriented Design Citizen Bleys Programming 2 02-11-2002 01:25 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:59 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration