Proper class setup?



I'm presently learning OOP as Perl does it using online resources and and
Programming Perl as my tutors. I'm not certain I have it right though. Is this
correct for the package:
package Report;

require Exporter;
use strict;

our @ISA = qw(Exporter);
our @EXPORT = qw(new);


sub new {
my ($class) = @_;
my $self = {
_id => undef,
_queue => undef,
_owner => undef,
_priority => undef,
_worked => undef,
_timeLeft => undef,
_due => undef,
_created => undef,
_updated => undef,
_severity => undef,
_ccl => undef
};
bless $self, $class;
return $self;
}

# Accessor method for Reports _id
sub id {
my ($self, $id) = @_;
$self->{_id} = $id if defined($id);
return $self->{_id};
}

# Accessor method for Reports _queue
sub queue {
my ($self, $queue) = @_;
$self->{_queue} = $queue if defined($queue);
return $self->{_queue};
}

# Accessor method for Reports _owner
sub owner {
my ($self, $owner) = @_;
$self->{_owner} = $owner if defined($owner);
return $self->{_owner};
}

# Accessor method for Reports _owner
sub priority {
my ($self, $priority) = @_;
$self->{_priority} = $priority if defined($priority);
return $self->{_priority};
}

# Accessor method for Reports _owner
sub worked {
my ($self, $worked) = @_;
$self->{_worked} = $worked if defined($worked);
return $self->{_worked};
}

# Accessor method for Reports _owner
sub timeLeft {
my ($self, $timeLeft) = @_;
$self->{_timeLeft} = $timeLeft if defined($timeLeft);
return $self->{_timeLeft};
}

# Accessor method for Reports _owner
sub due {
my ($self, $due) = @_;
$self->{_due} = $due if defined($due);
return $self->{_due};
}

# Accessor method for Reports _owner
sub created {
my ($self, $created) = @_;
$self->{_created} = $created if defined($created);
return $self->{_created};
}

# Accessor method for Reports _owner
sub updated {
my ($self, $updated) = @_;
$self->{_updated} = $updated if defined($updated);
return $self->{_updated};
}

# Accessor method for Reports _owner
sub severity {
my ($self, $severity) = @_;
$self->{_severity} = $severity if defined($severity);
return $self->{_severity};
}

# Accessor method for Reports _owner
sub ccl {
my ($self, $ccl) = @_;
$self->{_ccl} = $ccl if defined($ccl);
return $self->{_ccl};
}

sub print {
my ($self) = @_;

# Print Report info
print $self->id . " " . $self->queue . "\n";
}

1;

Mathew
--
Keep up with me and what I'm up to: http://theillien.blogspot.com
.



Relevant Pages

  • Re: Proper class setup?
    ... _queue => undef, ... # Accessor method for Reports _queue ... sub queue { ... # Accessor method for Reports _owner ...
    (perl.beginners)
  • Re: Proper class setup?
    ... _queue => undef, ... # Accessor method for Reports _queue ... sub queue { ... # Accessor method for Reports _owner ...
    (perl.beginners)
  • Re: Report prints data twice on two different pages
    ... I would convert the forms to reports and get rid of the code in the ... Private Sub Print_Cert_Click ... "Duane Hookom" wrote: ... Part Certification with the key field of PartCertificationID with a one to ...
    (microsoft.public.access.reports)
  • Re: Help creating a database
    ... Private Sub cboCompany_NotInList ... one data-entry form and then whatever reports you want. ... > I need to create a database for our receptionist.Currently she has to ... and the status of the call (if the sales person took the call ...
    (microsoft.public.access.gettingstarted)
  • Re: Help creating a database
    ... Private Sub cboCompany_NotInList ... one data-entry form and then whatever reports you want. ... > I need to create a database for our receptionist.Currently she has to ... and the status of the call (if the sales person took the call ...
    (microsoft.public.access.gettingstarted)