Gary Stainburn wrote:
> 
> Hi folks,

Hello,

> as many of you who follow this list will know, a while back I decided to learn
> OOP and set myself the task of simulating a railway system.
> 
> A number of people asked if I could make the code available for viewing in
> order to help me with my questions.
> 
> I think that I have now done enough of the coding to show my intentions.  I am
> (not very) quietly chuffed with what I've achieved so far.
                     ^^^^^^^
Is that a good thing or a bad thing?

> Many thanks to all who helped. For those who are interested, the code is
> available at http://www.stainburn.com/trainset-0.0.1.tgz

James already made some good points on which I concur, especially adding
whitespace!  I usually run unknown code through Perltidy which really
improves readability.  James also mentioned nested subs.  If you define
a sub inside of another sub it may appear that the sub is only visible
inside that sub however sub names are package variables and are visible
anywhere in the entire package.  If you want a lexically scoped sub you
have to assign a sub reference to a lexically scoped scalar like:

my $sub_name = sub { do something };



John
-- 
use Perl;
program
fulfillment

-- 
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