Hi, I'm starting to look at OO in PERL, I've written a working class but I don't know how to implement private and public variables and accessor functions, any idea how to do that?

Here's wot I have so far:
###############################################
#!/usr/bin/perl -w

use strict;
use CGI;
my $q = new CGI;

my $count = 0;

# this class takes no constructor parameters
package TRACKER::GraemeTestClass;
sub new{
 my $classname = shift;  # we know our class name
 $count++;               # remember how many objects
 bless {}, $classname;   # and bless an anonymous hash
}
sub count{
 my $self = shift;       # this is the object itself
 return $count;
}

sub GetNameFromForm{
 my $self = shift;
 $self->{name}=$q->param("name");
}

sub PrintName{
 my $self=shift;
 return $self->{name};
}

1;
####################################


Cheers in advance for any tips,

Graeme :)

_________________________________________________________________
Use MSN Messenger to send music and pics to your friends http://www.msn.co.uk/messenger



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