diff options
author | Matthew Somerville <matthew@mysociety.org> | 2015-12-02 18:05:08 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2015-12-02 18:05:08 +0000 |
commit | 0c9e00d52568843b1f4c3e8b02b9e47eccceb6ea (patch) | |
tree | 701e1c2a1ad556df31f56f43f3ff4099a9ddc7d7 | |
parent | b6fcd966d204d35c149b2bff91513e732f3101c8 (diff) |
Pass in EmailSend arguments as a hashref.
A fix to bb1e797; when started via a Catalyst model, e.g. send_email in
FixMyStreet::App, an empty hashref is passed in.
-rw-r--r-- | perllib/FixMyStreet/Email.pm | 2 | ||||
-rw-r--r-- | perllib/FixMyStreet/EmailSend.pm | 5 |
2 files changed, 4 insertions, 3 deletions
diff --git a/perllib/FixMyStreet/Email.pm b/perllib/FixMyStreet/Email.pm index a65a5e340..e81067da1 100644 --- a/perllib/FixMyStreet/Email.pm +++ b/perllib/FixMyStreet/Email.pm @@ -91,7 +91,7 @@ sub send_cron { if (!FixMyStreet->test_mode && $env_from eq FixMyStreet->config('CONTACT_EMAIL')) { $model_args{mailer} = 'FixMyStreet::EmailSend::ContactEmail'; } - my $result = FixMyStreet::EmailSend->new(%model_args)->send($email); + my $result = FixMyStreet::EmailSend->new(\%model_args)->send($email); return $result ? 0 : 1; } } diff --git a/perllib/FixMyStreet/EmailSend.pm b/perllib/FixMyStreet/EmailSend.pm index 29c93b2d6..1c6e2cf7a 100644 --- a/perllib/FixMyStreet/EmailSend.pm +++ b/perllib/FixMyStreet/EmailSend.pm @@ -64,7 +64,8 @@ if ( FixMyStreet->test_mode ) { } sub new { - my ($cls, %hash) = @_; - my %args = ( %$args, %hash ); + my ($cls, $hash) = @_; + $hash ||= {}; + my %args = ( %$args, %$hash ); return Email::Send->new(\%args); } |