set_data Methode
authorSven Schöling <s.schoeling@linet-services.de>
Thu, 15 Nov 2012 14:10:12 +0000 (15:10 +0100)
committerSven Schöling <s.schoeling@linet-services.de>
Fri, 11 Jan 2013 12:56:53 +0000 (13:56 +0100)
SL/DB/BackgroundJob.pm

index 9f2f7cb..1a9c869 100644 (file)
@@ -5,10 +5,10 @@ use strict;
 use DateTime::Event::Cron;
 use English qw(-no_match_vars);
 
-use SL::DB::MetaSetup::BackgroundJob;
-use SL::DB::Manager::BackgroundJob;
+require SL::DB::MetaSetup::BackgroundJob;
+require SL::DB::Manager::BackgroundJob;
 
-use SL::DB::BackgroundJobHistory;
+require SL::DB::BackgroundJobHistory;
 
 use SL::System::Process;
 
@@ -77,6 +77,14 @@ sub data_as_hash {
   return {};
 }
 
+sub set_data {
+  my ($self, %data) = @_;
+
+  my $data = YAML::Load($self->data);
+  $data->{$_} = $data{$_} for keys %data;
+  $self->data(YAML::Dump($data));
+}
+
 sub validate {
   my ($self) = @_;