BEGIN {
# set the version for version checking
- $VERSION = 3.00;
+ $VERSION = 3.07.00.049;
}
=head1 NAME
$self->{'progress'} = 0;
$self->{'status'} = "running";
$self->{'jobID'} = Digest::MD5::md5_hex(Digest::MD5::md5_hex(time().{}.rand().{}.$$));
+ $self->{'extra_values'} = {};
bless $self, $class;
$self->_serialize();
sub results {
my $self = shift;
- return undef unless $self->{'status'} eq 'completed';
+ return unless $self->{'status'} eq 'completed';
return $self->{'results'};
}
my $session = get_session($sessionID);
my $prefix = "job_$jobID";
unless (defined $session->param($prefix)) {
- return undef;
+ return;
}
my $self = $session->param($prefix);
bless $self, $class;
return $self;
}
+=head2 set
+
+=over 4
+
+=item $job->set($hashref);
+
+=back
+
+Set some variables into the hashref.
+These variables can be retrieved using the get method.
+
+=cut
+
+sub set {
+ my ($self, $hashref) = @_;
+ while ( my ($k, $v) = each %$hashref ) {
+ $self->{extra_values}->{$k} = $v;
+ }
+ $self->_serialize();
+ return;
+}
+
+=head2 get
+
+=over 4
+
+=item $value = $job->get($key);
+
+=back
+
+Get a variable which has been previously stored with the set method.
+
+=cut
+
+sub get {
+ my ($self, $key) = @_;
+ return $self->{extra_values}->{$key};
+}
+
1;
__END__