Hi folks,

I'm after peoples opinions on my (beginner's) slant objects in perl.

In much of what I've read, there seems to be the implied rule that

Package Name == Class == Object Type,

specifically MyObject would be a object of class MyObject which would be held 
in a package MyObject,  and would probably be created by calling 
MyObject->new.

In my Package Trainset, I have class Trainset with variables global to that 
class.  However, I don't have an object type of Trainset (In a previous 
thread someone suggested creating one to hold the class variables instead of 
using globals, to enable me to create more than one trainset. I decided that 
would create more problems than it would solve here).

I do have object types:

* Block
* point (switch to american readers)
* signal
* lever
* signalbox

These are all created by calling Trainset->Block etc., and the code for all 
object types are in the Trainset package.

My question is:

Is there anything wrong with what I'm doing, or any pit-falls I need to watch 
out for?

Is there a better way to do this, without further complicating or slowing of 
the code (e.g. indirect access to the globals via Trainset methods as would 
be needed if I created a Trainset object)?
-- 
Gary Stainburn
 
This email does not contain private or confidential material as it
may be snooped on by interested government parties for unknown
and undisclosed purposes - Regulation of Investigatory Powers Act, 2000     


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to