package status; use strict; use Data::Dumper; my $order = {"new"=>1,"stage one"=>2,"stage two"=>3,"stage four"=>4,"end"=>5}; sub new{ my($class) = @_; my $this = { 'status'=>undef, 'time'=>undef, 'owner'=>undef}; bless($this, $class); return $this; } sub initiate{ my($this, $status, $owner) = @_; $this->status($status); $this->time(time()); $this->owner($owner); } sub status{ my($this, $status) = @_; if(defined $status){ $this->{'status'} = $status; } else{ return $this->{'status'}; } } sub status_code{ my($this, $status) = @_; if(defined $this->{'status'}){ return $order->{$this->{'status'}}; } else{ return undef; } } sub time{ my($this, $time) = @_; if(defined $time){ $this->{'time'} = $time; } else{ return $this->{'time'}; } } sub owner{ my($this, $owner) = @_; if(defined $owner){ $this->{'owner'} = $owner; } else{ return $this->{'owner'}; } } 1;