Commit 7ecca470 authored by Leo Gordon's avatar Leo Gordon
Browse files

use param_required() calls wherever a parameter value is required

parent 85880029
......@@ -71,7 +71,7 @@ sub param_defaults {
sub fetch_input {
my $self = shift @_;
my $inputfile = $self->param('inputfile') || die "'inputfile' is an obligatory parameter";
my $inputfile = $self->param_required('inputfile');
die "Cannot read '$inputfile'" unless(-r $inputfile);
if($inputfile=~/\.(?:gz|Z)$/) {
......
......@@ -40,7 +40,7 @@ use base ('Bio::EnsEMBL::Hive::Process');
sub fetch_input { # fetch all the (relevant) precomputed products
my $self = shift @_;
my $a_multiplier = $self->param('a_multiplier') || die "'a_multiplier' is an obligatory parameter";
my $a_multiplier = $self->param_required('a_multiplier');
my $adaptor = $self->db->get_NakedTableAdaptor();
$adaptor->table_name( 'intermediate_result' );
......@@ -62,7 +62,7 @@ sub fetch_input { # fetch all the (relevant) precomputed products
sub run { # call the function that will compute the stuff
my $self = shift @_;
my $b_multiplier = $self->param('b_multiplier') || die "'b_multiplier' is an obligatory parameter";
my $b_multiplier = $self->param_required('b_multiplier');
my $product_pair = $self->param('product_pair');
$self->param('result', _add_together($b_multiplier, $product_pair));
......
......@@ -42,7 +42,7 @@ use base ('Bio::EnsEMBL::Hive::Process');
sub fetch_input {
my $self = shift @_;
my $b_multiplier = $self->param('b_multiplier') || die "'b_multiplier' is an obligatory parameter";
my $b_multiplier = $self->param_required('b_multiplier');
my %digit_hash = ();
foreach my $digit (split(//,$b_multiplier)) {
......
......@@ -49,8 +49,8 @@ sub fetch_input {
sub run { # call the recursive function that will compute the stuff
my $self = shift @_;
my $a_multiplier = $self->param('a_multiplier') || die "'a_multiplier' is an obligatory parameter";
my $digit = $self->param('digit') || die "'digit' is an obligatory parameter";
my $a_multiplier = $self->param_required('a_multiplier');
my $digit = $self->param_required('digit');
$self->param('result', _rec_multiply($a_multiplier, $digit, 0) || 0);
......
......@@ -36,6 +36,13 @@ use strict;
use base ('Bio::EnsEMBL::Hive::Process');
sub param_defaults {
return {
'subject' => 'An automatic message from your pipeline',
};
}
=head2 fetch_input
Description : Implements fetch_input() interface method of Bio::EnsEMBL::Hive::Process that is used to read in parameters and load data.
......@@ -64,9 +71,9 @@ sub fetch_input {
sub run {
my $self = shift;
my $email = $self->param('email') || die "'email' parameter is obligatory";
my $subject = $self->param('subject') || "An automatic message from your pipeline";
my $text = $self->param('text') || die "'text' parameter is obligatory";
my $email = $self->param_required('email');
my $subject = $self->param_required('subject');
my $text = $self->param_required('text');
open(SENDMAIL, "|sendmail $email");
print SENDMAIL "Subject: $subject\n";
......
......@@ -38,7 +38,7 @@ use base ('Bio::EnsEMBL::Hive::Process');
sub fetch_input {
my $self = shift @_;
die "'inputquery' is a mandatory parameter" unless $self->param('inputquery');
$self->param_required('inputquery');
my $expected_size = $self->param('expected_size');
unless ($expected_size =~ /^\s*(=|==|>|>=|<|<=|<>|!=|)\s*(\d*)\s*$/) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment