@@ -41,6 +41,7 @@ use Sympa::Template;
41
41
use Sympa::Tools::Data;
42
42
43
43
my $language = Sympa::Language-> instance;
44
+ my $noout ;
44
45
45
46
sub run {
46
47
my $class = shift ;
@@ -113,7 +114,7 @@ sub run {
113
114
} elsif (
114
115
not Getopt::Long::GetOptionsFromArray(
115
116
\@argv , \%options ,
116
- qw( config|f=s debug|d lang|l=s log_level=s mail|m) ,
117
+ qw( config|f=s debug|d lang|l=s log_level=s mail|m noout ) ,
117
118
$class -> _options
118
119
)
119
120
) {
@@ -124,6 +125,8 @@ sub run {
124
125
return undef ;
125
126
}
126
127
128
+ $noout = $options {noout };
129
+
127
130
# Get privileges and load config if necessary.
128
131
# Otherwise only setup language if specified.
129
132
$language -> set_lang($options {lang }) if $options {lang };
@@ -347,26 +350,29 @@ sub _report {
347
350
my $class = shift ;
348
351
my $spindle = shift ;
349
352
350
- my @reports = @{$spindle -> {stash } || []};
351
- @reports = ([undef , ' notice' , ' performed' ]) unless @reports ;
352
-
353
- my $template = Sympa::Template-> new(' *' , subdir => ' mail_tt2' );
354
- foreach my $report (@reports ) {
355
- my ($request , $report_type , $report_entry , $report_param ) = @$report ;
356
- my $action = $request ? $request -> {action } : ' sympa' ;
357
- my $message = ' ' ;
358
- $template -> parse(
359
- { report_type => $report_type ,
360
- report_entry => $report_entry ,
361
- report_param => ($report_param || {}),
362
- },
363
- ' report.tt2' ,
364
- \$message
365
- );
366
- $message ||= $report_entry ;
367
- $message =~ s /\n / / g ;
368
-
369
- warn sprintf " %s [%s ] %s \n " , $action , $report_type , $message ;
353
+ unless ($noout ) {
354
+ my @reports = @{$spindle -> {stash } || []};
355
+ @reports = ([undef , ' notice' , ' performed' ]) unless @reports ;
356
+
357
+ my $template = Sympa::Template-> new(' *' , subdir => ' mail_tt2' );
358
+ foreach my $report (@reports ) {
359
+ my ($request , $report_type , $report_entry , $report_param ) =
360
+ @$report ;
361
+ my $action = $request ? $request -> {action } : ' sympa' ;
362
+ my $message = ' ' ;
363
+ $template -> parse(
364
+ { report_type => $report_type ,
365
+ report_entry => $report_entry ,
366
+ report_param => ($report_param || {}),
367
+ },
368
+ ' report.tt2' ,
369
+ \$message
370
+ );
371
+ $message ||= $report_entry ;
372
+ $message =~ s /\n / / g ;
373
+
374
+ warn sprintf " %s [%s ] %s \n " , $action , $report_type , $message ;
375
+ }
370
376
}
371
377
372
378
return $spindle -> success ? 1 : undef ;
@@ -406,7 +412,9 @@ sub _translate_warn {
406
412
return $output ;
407
413
}
408
414
409
- $SIG {__WARN__ } = sub { warn _translate_warn(shift ) };
415
+ $SIG {__WARN__ } = sub {
416
+ warn _translate_warn(shift ) unless $noout ;
417
+ };
410
418
411
419
my $arg_labels = {
412
420
list => {gettext_id => ' list' },
0 commit comments