|
8 | 8 | # Copyright (c) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
|
9 | 9 | # 2006, 2007, 2008, 2009, 2010, 2011 Comite Reseau des Universites
|
10 | 10 | # Copyright (c) 2011, 2012, 2013, 2014, 2015, 2016, 2017 GIP RENATER
|
11 |
| -# Copyright 2017, 2018 The Sympa Community. See the AUTHORS.md file at the |
12 |
| -# top-level directory of this distribution and at |
| 11 | +# Copyright 2017, 2018, 2019 The Sympa Community. See the AUTHORS.md file |
| 12 | +# at the top-level directory of this distribution and at |
13 | 13 | # <https://github.com/sympa-community/sympa.git>.
|
14 | 14 | #
|
15 | 15 | # This program is free software; you can redistribute it and/or modify
|
@@ -583,9 +583,11 @@ sub _compile_scenario {
|
583 | 583 | my $required = join "\n", map {
|
584 | 584 | my $req;
|
585 | 585 | if ($_ eq 'list_object') {
|
586 |
| - $req = 'return undef unless ref $that eq \'Sympa::List\';'; |
| 586 | + $req = 'die "No list context" unless ref $that eq \'Sympa::List\';'; |
| 587 | + } elsif ($_ eq 'message') { |
| 588 | + $req = sprintf '$context->{message} ||= Sympa::Message->new("\n");'; |
587 | 589 | } else {
|
588 |
| - $req = sprintf 'return undef unless exists $context->{%s};', $_; |
| 590 | + $req = sprintf 'die "Missing parameter \'%s\'" unless exists $context->{%s};', $_, $_; |
589 | 591 | }
|
590 | 592 | " $req";
|
591 | 593 | } sort keys %required;
|
@@ -785,7 +787,7 @@ sub _compile_condition {
|
785 | 787 | ## available.
|
786 | 788 | if (defined $index) {
|
787 | 789 | $value =
|
788 |
| - sprintf '[$context->{message}->get_header(\'%s\')]->[%s]', |
| 790 | + sprintf 'do { my @h = $context->{message}->get_header(\'%s\'); $h[%s] }', |
789 | 791 | $field_name, $index;
|
790 | 792 | } else {
|
791 | 793 | $value = sprintf '[$context->{message}->get_header(\'%s\')]',
|
|
0 commit comments