summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'client/Scire.pm')
-rw-r--r--client/Scire.pm37
1 files changed, 37 insertions, 0 deletions
diff --git a/client/Scire.pm b/client/Scire.pm
new file mode 100644
index 0000000..8b94082
--- /dev/null
+++ b/client/Scire.pm
@@ -0,0 +1,37 @@
+package Scire::Job;
+
+sub new {
+ my $proto = shift;
+ my $class = ref($proto) || $proto;
+ my $filename = shift;
+ my $self = {};
+ bless ($self, $class);
+ if(defined $filename) {
+ $self->set_filename($filename);
+ }
+ return $self;
+}
+
+sub set_filename {
+ my $self = shift;
+ my $filename = shift;
+ $self->{filename} = $filename;
+ my $jobcontents;
+ my $jobdata;
+ open JOB, "< ${filename}" or die "Can't open file ${filename}";
+ $jobcontents = join("", <JOB>);
+ close JOB;
+ $jobdata = eval($jobcontents);
+ ($@) and print "ERROR: Could not parse job file ${filename}!\n";
+ if(defined $jobdata->{script}) {
+ for(keys %{$jobdata->{script}}) {
+ $self->{$_} = $jobdata->{script}->{$_};
+ }
+ }
+ for(keys %{$jobdata}) {
+ $self->{$_} = $jobdata->{$_};
+ }
+}
+
+1;
+