From d8c52e5e9a848bab9e77a4db777027c3d710e57e Mon Sep 17 00:00:00 2001 From: Andrew Gaffney Date: Sat, 5 Jan 2008 03:34:14 +0000 Subject: initial commit of Scire.pm svn path=/branches/new-fu/; revision=320 --- client/Scire.pm | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 client/Scire.pm 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("", ); + 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; + -- cgit v1.2.3-65-gdbad