diff options
author | Andrew Gaffney <agaffney@gentoo.org> | 2008-01-05 03:34:14 +0000 |
---|---|---|
committer | Andrew Gaffney <agaffney@gentoo.org> | 2008-01-05 03:34:14 +0000 |
commit | d8c52e5e9a848bab9e77a4db777027c3d710e57e (patch) | |
tree | 46b4885a36f86aa383792cc8db9d0dd01714ee84 | |
parent | fixed up the expansion w/ one last query. (diff) | |
download | scire-d8c52e5e9a848bab9e77a4db777027c3d710e57e.tar.gz scire-d8c52e5e9a848bab9e77a4db777027c3d710e57e.tar.bz2 scire-d8c52e5e9a848bab9e77a4db777027c3d710e57e.zip |
initial commit of Scire.pm
svn path=/branches/new-fu/; revision=320
-rw-r--r-- | client/Scire.pm | 37 |
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; + |