Skip to Content.
Sympa Menu

devel - Re: [sympa-developpers] [sympa-commits] sympa[10314] trunk/src: [dev] use plain english names for magic variables

Subject: Developers of Sympa

List archive

Chronological Thread  
  • From: IKEDA Soji <address@concealed>
  • To: address@concealed
  • Subject: Re: [sympa-developpers] [sympa-commits] sympa[10314] trunk/src: [dev] use plain english names for magic variables
  • Date: Mon, 3 Mar 2014 12:04:44 +0900

Hi,

For example someones can prefer to $!, OTOH others $ERRNO or
$OS_ERROR.

I feel nice to use English names for rarely used variables.
However, what means "rarely used" may be differ from one another.

So I'll propose as below ---

A) $_ and @_ :

Use non-English names everytime.

Never use $ARG and @ARG.

B) Other variables "mnemonic" of them are described in perlvar(1) :

May use English names along with non-English names, however, if
multiple English names are given, only shortest one may be used.

e.g. $! and $ERRNO may be used but not $OS_ERROR.
Anyone shouldn't blame use of $ERRNO and others shouldn't blame
use of $!.

Other examples (imcomplete):
$" $$ $( $) $0 $; $< $> $& $` $' $+ $, $. $/ $\ $| $! $? $@

C) Others :

Use English names if any.

e.g. Use %LAST_MATCH_START but not %-.

e.g. We use $^M, because there are no English alternatives.

e.g. We use $], because some versions of Perl don't have
$OLD_PERL_VERSION.


Regards,

--- Soji

On Fri, 28 Feb 2014 17:23:05 +0100 (CET)
address@concealed wrote:

> sympa[10314] trunk/src: [dev] use plain english names for magic variables
> Revision 10314 Author rousse Date 2014-02-28 17:23:04 +0100 (ven. 28 févr.
> 2014)
> Log Message[dev] use plain english names for magic variables
>
> $] has not been replaced, because $OLD_PERL_VERSION seem to be missing in at
> least perl 5.18.2
> Modified Paths
> trunk/src/bin/arc2webarc.pl.in
> trunk/src/bin/mod2html.pl.in
> trunk/src/bin/sympa_wizard.pl.in
> trunk/src/bin/tpl2tt2.pl.in
> trunk/src/cgi/sympa_soap_server.fcgi.in
> trunk/src/cgi/wwsympa.fcgi.in
> trunk/src/lib/Sympa/Admin.pm
> trunk/src/lib/Sympa/Archive.pm
> trunk/src/lib/Sympa/BounceMessage.pm
> trunk/src/lib/Sympa/Bulk.pm
> trunk/src/lib/Sympa/ClassicSpool.pm
> trunk/src/lib/Sympa/Conf.pm
> trunk/src/lib/Sympa/DBManipulatorSQLite.pm
> trunk/src/lib/Sympa/DatabaseDescription.pm
> trunk/src/lib/Sympa/DatabaseManager.pm
> trunk/src/lib/Sympa/Family.pm
> trunk/src/lib/Sympa/KeySpool.pm
> trunk/src/lib/Sympa/LDAP.pm
> trunk/src/lib/Sympa/List.pm
> trunk/src/lib/Sympa/Lock.pm
> trunk/src/lib/Sympa/Log.pm
> trunk/src/lib/Sympa/Mail.pm
> trunk/src/lib/Sympa/Marc/Search.pm
> trunk/src/lib/Sympa/Message.pm
> trunk/src/lib/Sympa/ModDef.pm
> trunk/src/lib/Sympa/PlainDigest.pm
> trunk/src/lib/Sympa/SQLSource.pm
> trunk/src/lib/Sympa/Scenario.pm
> trunk/src/lib/Sympa/SharedDocument.pm
> trunk/src/lib/Sympa/Spool.pm
> trunk/src/lib/Sympa/TaskInstruction.pm
> trunk/src/lib/Sympa/Template.pm
> trunk/src/lib/Sympa/TimeUtils.pm
> trunk/src/lib/Sympa/Tools.pm
> trunk/src/lib/Sympa/Upgrade.pm
> trunk/src/lib/Sympa/Wwslib.pm
> trunk/src/libexec/alias_manager.pl.in
> trunk/src/libexec/ldap_alias_manager.pl.in
> trunk/src/libexec/mysql_alias_manager.pl.in
> trunk/src/sbin/archived.pl.in
> trunk/src/sbin/bounced.pl.in
> trunk/src/sbin/bulk.pl.in
> trunk/src/sbin/sympa.pl.in
> trunk/src/sbin/task_manager.pl.in
> Diff
> Modified: trunk/src/bin/arc2webarc.pl.in (10313 => 10314)
> --- trunk/src/bin/arc2webarc.pl.in 2014-02-28 16:19:49 UTC (rev 10313)
> +++ trunk/src/bin/arc2webarc.pl.in 2014-02-28 16:23:04 UTC (rev 10314)
> @@ -58,7 +58,7 @@
> #$main::options{'debug'} = 1;
> #$main::options{'debug2'} = 1 if ($main::options{'debug'});
>
> -$| = 1;
> +$OUTPUT_AUTOFLUSH = 1;
>
> my %opt;
> unless (GetOptions(\%opt, 'input-directory=s')) {
> @@ -72,7 +72,7 @@
> my $robot_id = $ARGV[1];
>
> ## Check UID
> -unless ([getpwuid $<]->[0] eq Sympa::Constants::USER) {
> +unless ([getpwuid $UID]->[0] eq Sympa::Constants::USER) {
> printf
> "You should run this script as user \"%s\", ignore ? (y/CR)",
> Sympa::Constants::USER;
> Modified: trunk/src/bin/mod2html.pl.in (10313 => 10314)
> --- trunk/src/bin/mod2html.pl.in 2014-02-28 16:19:49 UTC (rev 10313)
> +++ trunk/src/bin/mod2html.pl.in 2014-02-28 16:23:04 UTC (rev 10314)
> @@ -46,8 +46,8 @@
> } # to check availabity of Sympa database
>
> # Set the UserID & GroupID for the process
> -$( = $) = (getgrnam(Sympa::Constants::GROUP))[2];
> -$< = $> = (getpwnam(Sympa::Constants::USER))[2];
> +$GID = $EGID = (getgrnam(Sympa::Constants::GROUP))[2];
> +$UID = $EUID = (getpwnam(Sympa::Constants::USER))[2];
>
> # Sets the UMASK
> umask(oct($Conf{'umask'}));
> Modified: trunk/src/bin/sympa_wizard.pl.in (10313 => 10314)
> --- trunk/src/bin/sympa_wizard.pl.in 2014-02-28 16:19:49 UTC (rev 10313)
> +++ trunk/src/bin/sympa_wizard.pl.in 2014-02-28 16:23:04 UTC (rev 10314)
> @@ -90,7 +90,7 @@
>
> BEGIN {
> eval { require Sympa::Site; };
> - $modfail = 1 if $@;
> + $modfail = 1 if $EVAL_ERROR;
> }
>
> # Detect console encoding.
> @@ -98,7 +98,7 @@
> no warnings;
>
> eval { require Encode::Locale; };
> - unless ($@
> + unless ($EVAL_ERROR
> or Encode::resolve_alias($Encode::Locale::ENCODING_CONSOLE_IN) eq
> 'ascii'
> or Encode::resolve_alias($Encode::Locale::ENCODING_CONSOLE_OUT) eq
> @@ -116,7 +116,7 @@
> *Sympa::Language::gettext = sub {shift};
>
> eval { require Text::Wrap; };
> - if ($@) {
> + if ($EVAL_ERROR) {
> *Sympa::Tools::wrap_text = sub {"$_[1]$_[0]\n"};
> } else {
> $Text::Wrap::columns = 78;
> @@ -186,7 +186,7 @@
>
> unless (open NEWF, '>', $conf) {
> die sprintf Sympa::Language::gettext('Unable to open %s: %s') .
> "\n",
> - $conf, "$!";
> + $conf, $ERRNO;
> }
>
> # print NEWF
> @@ -376,7 +376,7 @@
> unless (rename $sympa_conf, $sympa_conf . '.' . $date) {
> warn sprintf
> Sympa::Language::gettext('Unable to rename %s: %s'),
> - $sympa_conf, "$!";
> + $sympa_conf, $ERRNO;
> }
>
> ## Write new config file
> @@ -385,7 +385,7 @@
> umask $umask;
> die sprintf
> Sympa::Language::gettext('Unable to open %s: %s'),
> - $sympa_conf, "$!";
> + $sympa_conf, $ERRNO;
> }
> umask $umask;
> chown [getpwnam(Sympa::Constants::USER)]->[2],
> @@ -489,7 +489,7 @@
> printf('%-26s %-24s ', $mod, $cpan_modules->{$mod}{package_name});
>
> eval "require $mod";
> - if ($@) {
> + if ($EVAL_ERROR) {
> ### not installed
> print Sympa::Language::gettext('not found on this system.') .
> "\n";
> install_module($mod, {'default' => $default}, $cpan_modules);
> Modified: trunk/src/bin/tpl2tt2.pl.in (10313 => 10314)
> --- trunk/src/bin/tpl2tt2.pl.in 2014-02-28 16:19:49 UTC (rev 10313)
> +++ trunk/src/bin/tpl2tt2.pl.in 2014-02-28 16:23:04 UTC (rev 10314)
> @@ -35,7 +35,7 @@
>
> my %options;
>
> -$| = 1;
> +$OUTPUT_AUTOFLUSH = 1;
>
> ## Check UID
> #unless (getlogin() eq Sympa::Constants::USER) {
> @@ -139,7 +139,7 @@
> ## List .tpl files
> foreach my $d (@directories) {
> unless (opendir DIR, $d) {
> - printf STDERR "Error: Cannot read %s directory : %s\n", $d, $!;
> + printf STDERR "Error: Cannot read %s directory : %s\n", $d, $ERRNO;
> next;
> }
>
> @@ -209,7 +209,7 @@
> unless (-d $dest_path) {
> print "Creating $dest_path directory\n";
> unless (my_mkdir($dest_path)) {
> - print STDERR "Error : Cannot create $dest_path directory :
> $!\n";
> + print STDERR "Error : Cannot create $dest_path directory :
> $ERRNO\n";
> next;
> }
> unless (
> @@ -234,7 +234,7 @@
> ## Rename old files to .converted
> unless (rename $tpl, "$tpl.converted") {
> printf STDERR "Error : failed to rename %s to %s.converted : %s\n",
> - $tpl, $tpl, $!;
> + $tpl, $tpl, $ERRNO;
> next;
> }
> }
> @@ -247,12 +247,12 @@
>
> ## Convert tpl file
> unless (open TPL, $in_file) {
> - print STDERR "Cannot open $in_file : $!\n";
> + print STDERR "Cannot open $in_file : $ERRNO\n";
> return undef;
> }
> if ($out_file) {
> unless (open TT2, ">$out_file") {
> - print STDERR "Cannot create $out_file : $!\n";
> + print STDERR "Cannot create $out_file : $ERRNO\n";
> return undef;
> }
> }
> @@ -297,14 +297,14 @@
> unless (-d $root_path) {
> unless (mkdir($root_path, 0777)) {
> printf STDERR "Error : Cannot create directory %s : %s\n",
> - $root_path, $!;
> + $root_path, $ERRNO;
> return undef;
> }
> }
>
> unless (mkdir($path, 0777)) {
> printf STDERR "Error : Cannot create directory %s : %s\n",
> $path,
> - $!;
> + $ERRNO;
> return undef;
> }
> } else {
> Modified: trunk/src/cgi/sympa_soap_server.fcgi.in (10313 => 10314)
> --- trunk/src/cgi/sympa_soap_server.fcgi.in 2014-02-28 16:19:49 UTC (rev
> 10313)
> +++ trunk/src/cgi/sympa_soap_server.fcgi.in 2014-02-28 16:23:04 UTC (rev
> 10314)
> @@ -3,6 +3,7 @@
> # vim:ft=perl:et:sw=4
> # $Id$
>
> +use English qw(-no_match_vars);
> use SOAP::Lite;
>
> # Use this line for more debug facility
> @@ -51,8 +52,8 @@
> ## We set the real UID with the effective UID value
> ## It is usefull to allow execution of scripts like alias_manager
> ## that otherwise might loose the benefit of SetUID
> -$< = $>; ## UID
> -$( = $); ## GID
> +$UID = $EUID; ## UID
> +$GID = $); ## GID
>
> unless (Sympa::DatabaseManager::check_db_connect()) {
> Sympa::Log::Syslog::do_log('err', 'SOAP server requires a RDBMS to
> run');
> Modified: trunk/src/cgi/wwsympa.fcgi.in (10313 => 10314)
> --- trunk/src/cgi/wwsympa.fcgi.in 2014-02-28 16:19:49 UTC (rev 10313)
> +++ trunk/src/cgi/wwsympa.fcgi.in 2014-02-28 16:23:04 UTC (rev 10314)
> @@ -46,6 +46,7 @@
> use strict;
>
> #use warnings; #temporarily disabled
> +use English; # FIXME: drop $MATCH usage
> use Getopt::Long;
> use Archive::Zip qw(:ERROR_CODES);
> use Time::Local;
> @@ -1040,7 +1041,7 @@
>
> my $birthday = time;
>
> -Sympa::Log::Syslog::do_log(info => "WWSympa started, process $$");
> +Sympa::Log::Syslog::do_log(info => "WWSympa started, process $PID");
>
> # Now internal encoding is same as input/output.
> #XXX## Set output encoding
> @@ -1079,7 +1080,7 @@
> Sympa::Site->send_notify_to_listmaster(undef, undef, 1, undef);
>
> ## Check effective ID
> - unless ($> eq (getpwnam(Sympa::Constants::USER))[2]) {
> + unless ($EUID eq (getpwnam(Sympa::Constants::USER))[2]) {
> $maintenance_mode = 1;
> Sympa::Report::reject_report_web('intern_quiet',
> 'incorrect_server_config',
> {}, '', '');
> @@ -1087,15 +1088,15 @@
> 'err',
> 'Config error: wwsympa should run with UID %s (instead of %s).
> *** Switching to maintenance mode. ***',
> (getpwnam(Sympa::Constants::USER))[2],
> - $>
> + $EUID
> );
> }
>
> ## We set the real UID with the effective UID value
> ## It is useful to allow execution of scripts like alias_manager
> ## that otherwise might loose the benefit of SetUID
> - $< = $>; ## UID
> - $( = $); ## GID
> + $UID = $EUID; ## UID
> + $GID = $); ## GID
>
> unless (Sympa::DatabaseManager::check_db_connect()) {
> Sympa::Report::reject_report_web('system_quiet', 'no_database',
> {}, '', '');
> @@ -1105,7 +1106,7 @@
> ## If in maintenance mode, check if the data structure is now uptodate
> if ($maintenance_mode
> && (Sympa::DatabaseManager::data_structure_uptodate()
> - && ($> eq (getpwnam(Sympa::Constants::USER))[2]))
> + && ($EUID eq (getpwnam(Sympa::Constants::USER))[2]))
> ) {
> $maintenance_mode = undef;
> Sympa::Log::Syslog::do_log('notice',
> @@ -2423,10 +2424,10 @@
> ) {
> ## Dump parameters in a tmp file for later analysis
> my $dump_file =
> - $robot->tmpdir . '/sympa_dump.' . time . '.' . $$;
> + $robot->tmpdir . '/sympa_dump.' . time . '.' . $PID;
> unless (open DUMP, ">$dump_file") {
> wwslog('err', 'get_parameters: failed to create %s :
> %s',
> - $dump_file, $!);
> + $dump_file, $ERRNO);
> }
> Sympa::Tools::dump_var(\%in, 0, \*DUMP);
> close DUMP;
> @@ -2692,10 +2693,10 @@
> ) {
> ## Dump parameters in a tmp file for later analysis
> my $dump_file =
> - $robot->tmpdir . '/sympa_dump.' . time . '.' . $$;
> + $robot->tmpdir . '/sympa_dump.' . time . '.' . $PID;
> unless (open DUMP, ">$dump_file") {
> wwslog('err', 'get_parameters: failed to create %s :
> %s',
> - $dump_file, $!);
> + $dump_file, $ERRNO);
> }
> Sympa::Tools::dump_var(\%in, 0, \*DUMP);
> close DUMP;
> @@ -3316,7 +3317,7 @@
> $param->{'loop_count'} = $loop_count;
> $param->{'start_time'} = gettext_strftime "%d %b %Y at %H:%M:%S",
> localtime($start_time);
> - $param->{'process_id'} = $$;
> + $param->{'process_id'} = $PID;
>
> ## listmaster has owner and editor privileges for the list
> if ($robot->is_listmaster($param->{'user'}{'email'})) {
> @@ -5274,7 +5275,7 @@
> $param->{'action'}, $list, $param->{'user'}{'email'},
> $robot_id);
> wwslog('err', 'do_info: failed to open file %s: %s',
> - $file_path, $!);
> + $file_path, $ERRNO);
> web_db_log(
> { 'parameters' => $file_path,
> 'status' => 'error',
> @@ -5299,7 +5300,7 @@
> $param->{'action'}, $list, $param->{'user'}{'email'},
> $robot_id);
> wwslog('err', 'do_info: failed to open file %s: %s',
> - $file_path, $!);
> + $file_path, $ERRNO);
> web_db_log(
> { 'parameters' => $file_path,
> 'status' => 'error',
> @@ -7465,7 +7466,7 @@
> wwslog(
> 'err',
> "can't create parent directory for %s : %s",
> - $param->{'template_path_out'}, $!
> + $param->{'template_path_out'}, $ERRNO
> );
> web_db_log(
> { 'parameters' => $param->{'template_name_out'},
> @@ -7489,7 +7490,7 @@
> wwslog(
> 'err',
> "can't open file %s : %s",
> - $param->{'template_path_out'}, $!
> + $param->{'template_path_out'}, $ERRNO
> );
> web_db_log(
> { 'parameters' => $param->{'template_name_out'},
> @@ -7553,7 +7554,7 @@
> wwslog(
> 'err',
> "can't create parent directory for %s : %s",
> - $param->{'template_path'}, $!
> + $param->{'template_path'}, $ERRNO
> );
> web_db_log(
> { 'parameters' => $param->{'template_name'},
> @@ -7577,7 +7578,7 @@
> wwslog(
> 'err',
> "can't open file %s : %s",
> - $param->{'template_path'}, $!
> + $param->{'template_path'}, $ERRNO
> );
> web_db_log(
> { 'parameters' => $in{'template_name'},
> @@ -7636,7 +7637,7 @@
> wwslog(
> 'err',
> "can't create parent directory for %s : %s",
> - $param->{'template_path'}, $!
> + $param->{'template_path'}, $ERRNO
> );
> web_db_log(
> { 'parameters' => $param->{'template_name'},
> @@ -7654,7 +7655,7 @@
> Sympa::Report::reject_report_web('intern', 'cannot_open_file',
> {'path' => $default_file},
> $param->{'action'}, '', $param->{'user'}{'email'},
> $robot_id);
> - wwslog('err', "can't open file %s : %s", $default_file, $!);
> + wwslog('err', "can't open file %s : %s", $default_file,
> $ERRNO);
> return undef;
> }
>
> @@ -7665,7 +7666,7 @@
> '', $param->{'user'}{'email'},
> $robot_id
> );
> - wwslog('err', "can't open file %s : %s", $new_template_path,
> $!);
> + wwslog('err', "can't open file %s : %s", $new_template_path,
> $ERRNO);
> return undef;
> }
>
> @@ -7693,7 +7694,7 @@
> wwslog(
> 'err',
> "can't open file MODIFY %s : %s",
> - $param->{'template_path'}, $!
> + $param->{'template_path'}, $ERRNO
> );
> web_db_log(
> { 'parameters' => $param->{'template_path'},
> @@ -7743,7 +7744,7 @@
> wwslog(
> 'err',
> "can't open file %s : %s",
> - $param->{'template_path'}, $!
> + $param->{'template_path'}, $ERRNO
> );
> web_db_log(
> { 'parameters' => $param->{'template_path'},
> @@ -7993,7 +7994,7 @@
> );
> wwslog('err',
> 'skinsedit : failed to create directory %s : %s',
> - $dir, $!);
> + $dir, $ERRNO);
> return undef;
> }
> chmod 0775, $dir;
> @@ -8689,7 +8690,7 @@
> wwslog(
> 'err',
> "do_d_install_shared : Failed to rename
> $shareddir$slash_path$new_fname to .old : %s",
> - $!
> + $ERRNO
> );
> web_db_log(
> { 'status' => 'error',
> @@ -8717,7 +8718,7 @@
> wwslog(
> 'err',
> "do_d_install_shared : Failed to rename
> shareddir$slash_path.desc.$new_fname to .old : %s",
> - $!
> + $ERRNO
> );
> web_db_log(
> { 'status' => 'error',
> @@ -8743,7 +8744,7 @@
> $robot_id
> );
> wwslog('err',
> - "do_d_install_shared : Failed to rename $file to
> $shareddir$slash_path$new_fname : $!"
> + "do_d_install_shared : Failed to rename $file to
> $shareddir$slash_path$new_fname : $ERRNO"
> );
> web_db_log(
> { 'status' => 'error',
> @@ -8770,7 +8771,7 @@
> $robot_id
> );
> wwslog('err',
> - "do_d_install_shared : Failed to rename $file to
> $shareddir$slash_path$new_fname : $!"
> + "do_d_install_shared : Failed to rename $file to
> $shareddir$slash_path$new_fname : $ERRNO"
> );
> web_db_log(
> { 'status' => 'error',
> @@ -9489,7 +9490,7 @@
> $robot_id
> );
> wwslog('err', 'do_editfile: failed to open file %s: %s',
> - $param->{'filepath'}, $!);
> + $param->{'filepath'}, $ERRNO);
> web_db_log(
> { 'parameters' => $in{'file'},
> 'status' => 'error',
> @@ -9678,7 +9679,7 @@
> $robot_id);
> wwslog('err',
> 'do_savefile: failed to create directory %s: %s',
> - $dir, $!);
> + $dir, $ERRNO);
> web_db_log(
> { 'parameters' => $in{'file'},
> 'status' => 'error',
> @@ -9698,7 +9699,7 @@
> $robot_id
> );
> wwslog('err', 'do_savefile: failed to save file %s: %s',
> - $param->{'filepath'}, $!);
> + $param->{'filepath'}, $ERRNO);
> web_db_log(
> { 'parameters' => $in{'file'},
> 'status' => 'error',
> @@ -10279,7 +10280,7 @@
> return undef;
> }
> my $msg_string;
> - local $/;
> + local $RS;
> $msg_string = <$fh>;
> close $fh;
>
> @@ -14586,7 +14587,7 @@
> {'dir' => $doc},
> $param->{'action'}, $list, $param->{'user'}{'email'},
> $robot_id);
> - wwslog('err', "d_read : cannot open $doc : $!");
> + wwslog('err', "d_read : cannot open $doc : $ERRNO");
> web_db_log(
> { 'parameters' => $in{'path'},
> 'status' => 'error',
> @@ -15242,7 +15243,7 @@
> ## listing of all the shared documents of the directory
> unless (opendir DIR, "$path_dir") {
> wwslog('err',
> - "directory_browsing($dir) : cannot open the directory : $!");
> + "directory_browsing($dir) : cannot open the directory :
> $ERRNO");
> return undef;
> }
>
> @@ -15897,7 +15898,7 @@
> # fill the description file
> unless (open DESC, ">$desc_file") {
> wwslog('info',
> - "do_d_describe : cannot open $desc_file : $!");
> + "do_d_describe : cannot open $desc_file : $ERRNO");
> Sympa::Report::reject_report_web(
> 'intern', 'cannot_open_file',
> {'file' => $desc_file}, $param->{'action'},
> @@ -15940,7 +15941,7 @@
> $robot_id
> );
> wwslog('info',
> - "d_describe : Cannot create description file
> $desc_file : $!"
> + "d_describe : Cannot create description file
> $desc_file : $ERRNO"
> );
> web_db_log(
> { 'parameters' => $in{'path'},
> @@ -16123,7 +16124,7 @@
> $list
> );
> wwslog('err',
> - "do_d_savefile : Cannot open for replace $shareddir/$path
> : $!"
> + "do_d_savefile : Cannot open for replace $shareddir/$path
> : $ERRNO"
> );
> web_db_log(
> { 'parameters' => $in{'path'},
> @@ -16212,7 +16213,7 @@
> $robot_id
> );
> wwslog('err',
> - "do_d_savefile : Failed to rename $path to
> $dir.$file.moderate : $!"
> + "do_d_savefile : Failed to rename $path to
> $dir.$file.moderate : $ERRNO"
> );
> web_db_log(
> { 'parameters' => $in{'path'},
> @@ -16237,7 +16238,7 @@
> $robot_id
> );
> wwslog('err',
> - "do_d_savefile : Failed to rename $dir.desc.$file to
> $dir.desc..$file.moderate : $!"
> + "do_d_savefile : Failed to rename $dir.desc.$file to
> $dir.desc..$file.moderate : $ERRNO"
> );
> web_db_log(
> { 'parameters' => $in{'path'},
> @@ -16431,14 +16432,14 @@
> Sympa::Report::reject_report_web(
> 'user',
> 'cannot_overwrite',
> - { 'reason' => $!,
> + { 'reason' => $ERRNO,
> 'path' => $visible_path
> },
> $param->{'action'},
> $list
> );
> wwslog('err',
> - "d_overwrite : Cannot open for replace $shareddir/$path : $!");
> + "d_overwrite : Cannot open for replace $shareddir/$path :
> $ERRNO");
> web_db_log(
> { 'parameters' => $in{'path'},
> 'status' => 'error',
> @@ -16529,7 +16530,7 @@
> $robot_id
> );
> wwslog('err',
> - "do_d_overwrite : Failed to rename $path to
> $dir.$file.moderate : $!"
> + "do_d_overwrite : Failed to rename $path to
> $dir.$file.moderate : $ERRNO"
> );
> web_db_log(
> { 'parameters' => $in{'path'},
> @@ -16555,7 +16556,7 @@
> $robot_id
> );
> wwslog('err',
> - "do_d_overwrite : Failed to rename $dir.desc.$file to
> $dir.desc..$file.moderate : $!"
> + "do_d_overwrite : Failed to rename $dir.desc.$file to
> $dir.desc..$file.moderate : $ERRNO"
> );
> web_db_log(
> { 'parameters' => $in{'path'},
> @@ -17051,7 +17052,7 @@
> );
> wwslog('err',
> "do_d_upload : Failed to rename %s to .old : %s",
> - $longgoodname, $!);
> + $longgoodname, $ERRNO);
> web_db_log(
> { 'robot' => $robot_id,
> 'list' => $list->name,
> @@ -17086,7 +17087,7 @@
> );
> wwslog('err',
> "do_d_upload : Failed to rename %s to .old : %s",
> - $longgooddesc, $!);
> + $longgooddesc, $ERRNO);
> web_db_log(
> { 'robot' => $robot_id,
> 'list' => $list->name,
> @@ -17117,7 +17118,7 @@
> $robot_id
> );
> wwslog('err', "do_d_upload : Failed to rename %s to %s :
> %s",
> - $longtmpname, $longgoodname, $!);
> + $longtmpname, $longgoodname, $ERRNO);
> web_db_log(
> { 'robot' => $robot_id,
> 'list' => $list->name,
> @@ -17148,7 +17149,7 @@
> $robot_id
> );
> wwslog('err', "do_d_upload : Failed to rename %s to %s :
> %s",
> - $longtmpdesc, $longgooddesc, $!);
> + $longtmpdesc, $longgooddesc, $ERRNO);
> web_db_log(
> { 'robot' => $robot_id,
> 'list' => $list->name,
> @@ -17180,7 +17181,7 @@
> $robot_id
> );
> wwslog('err', "do_d_upload : Failed to rename %s to %s :
> %s",
> - $longtmpname, $longmodname, $!);
> + $longtmpname, $longmodname, $ERRNO);
> web_db_log(
> { 'robot' => $robot_id,
> 'list' => $list->name,
> @@ -17210,7 +17211,7 @@
> $robot_id
> );
> wwslog('err', "do_d_upload : Failed to rename %s to %s :
> %s",
> - $longtmpdesc, $longmoddesc, $!);
> + $longtmpdesc, $longmoddesc, $ERRNO);
> web_db_log(
> { 'robot' => $robot_id,
> 'list' => $list->name,
> @@ -17454,7 +17455,7 @@
> $robot_id
> );
> wwslog('err', "do_d_upload : Failed to rename %s to %s :
> %s",
> - $longtmpname, $longnewname, $!);
> + $longtmpname, $longnewname, $ERRNO);
> web_db_log(
> { 'robot' => $robot_id,
> 'list' => $list->name,
> @@ -17487,7 +17488,7 @@
> $robot_id
> );
> wwslog('err', "do_d_upload : Failed to rename %s to %s :
> %s",
> - $longtmpdesc, $longnewdesc, $!);
> + $longtmpdesc, $longnewdesc, $ERRNO);
> web_db_log(
> { 'robot' => $robot_id,
> 'list' => $list->name,
> @@ -17520,7 +17521,7 @@
> $robot_id
> );
> wwslog('err',
> - "do_d_upload : Failed to rename $longtmpname to
> $shareddir/$path/.$in{'new_name'}.moderate : $!"
> + "do_d_upload : Failed to rename $longtmpname to
> $shareddir/$path/.$in{'new_name'}.moderate : $ERRNO"
> );
> web_db_log(
> { 'robot' => $robot_id,
> @@ -17553,7 +17554,7 @@
> $robot_id
> );
> wwslog('err',
> - "do_d_upload : Failed to rename $longtmpdesc to
> $shareddir/$path/.desc..$in{'new_name'}.moderate: $!"
> + "do_d_upload : Failed to rename $longtmpdesc to
> $shareddir/$path/.desc..$in{'new_name'}.moderate: $ERRNO"
> );
> web_db_log(
> { 'robot' => $robot_id,
> @@ -17777,7 +17778,7 @@
> Sympa::Report::reject_report_web('intern', 'cannot_upload',
> {'path' => "$path/$fname"},
> $param->{'action'}, $list, $param->{'user'}{'email'},
> $robot_id);
> - wwslog('err', 'Cannot open file %s/%s : %s', $path, $fname, $!);
> + wwslog('err', 'Cannot open file %s/%s : %s', $path, $fname,
> $ERRNO);
> return undef;
> }
> while (<$fh>) {
> @@ -18090,7 +18091,7 @@
>
> # directory for the uploaded file
> my $date = time;
> - my $zip_dir_name = $listname . $date . $$;
> + my $zip_dir_name = $listname . $date . $PID;
> my $zip_abs_dir = Sympa::Site->tmpdir . '/' . $zip_dir_name;
>
> unless (mkdir("$zip_abs_dir", 0777)) {
> @@ -18098,7 +18099,7 @@
> {'dir' => $zip_abs_dir},
> $param->{'action'}, $list, $param->{'user'}{'email'},
> $robot_id);
> wwslog('err',
> - "do_d_unzip($path/$fname) : Unable to create $zip_abs_dir :
> $!");
> + "do_d_unzip($path/$fname) : Unable to create $zip_abs_dir :
> $ERRNO");
> web_db_log(
> { 'robot' => $robot_id,
> 'list' => $list->name,
> @@ -18122,7 +18123,7 @@
> {'dir' => "$zip_abs_dir" . "/zip"},
> $param->{'action'}, $list, $param->{'user'}{'email'},
> $robot_id);
> wwslog('err',
> - "do_d_unzip($path/$fname) : Unable to create $zip_abs_dir/zip
> : $!"
> + "do_d_unzip($path/$fname) : Unable to create $zip_abs_dir/zip
> : $ERRNO"
> );
> web_db_log(
> { 'robot' => $robot_id,
> @@ -18148,7 +18149,7 @@
> {'path' => "$path/$fname"},
> $param->{'action'}, $list, $param->{'user'}{'email'},
> $robot_id);
> wwslog('err',
> - "do_d_unzip($path/$fname) : Cannot open file
> $zip_abs_dir/$fname : $!"
> + "do_d_unzip($path/$fname) : Cannot open file
> $zip_abs_dir/$fname : $ERRNO"
> );
> web_db_log(
> { 'robot' => $robot_id,
> @@ -18621,7 +18622,7 @@
> {'name' => "$dname"},
> $param->{'action'}, $list);
> wwslog('err',
> - "d_copy_rec_dir : Unable to create directory
> $dest_dir/$dname : $!"
> + "d_copy_rec_dir : Unable to create directory
> $dest_dir/$dname : $ERRNO"
> );
> web_db_log(
> { 'robot' => $robot_id,
> @@ -19124,7 +19125,7 @@
> $robot_id
> );
> wwslog('err',
> - "d_copy_file : Cannot create file $dest_dir/$fname : $!");
> + "d_copy_file : Cannot create file $dest_dir/$fname :
> $ERRNO");
> web_db_log(
> { 'robot' => $robot_id,
> 'list' => $list->name,
> @@ -19456,7 +19457,7 @@
> $robot_id
> );
> wwslog('err',
> - "do_d_delete : Failed to erase $doc/.desc : $!");
> + "do_d_delete : Failed to erase $doc/.desc : $ERRNO");
> web_db_log(
> { 'robot' => $robot_id,
> 'list' => $list->name,
> @@ -19764,7 +19765,7 @@
> $robot_id
> );
> wwslog('err', "do_d_rename : Failed to rename %s to %s : %s",
> - $doc, "$shareddir/$current_directory/$in{'new_name'}", $!);
> + $doc, "$shareddir/$current_directory/$in{'new_name'}",
> $ERRNO);
> web_db_log(
> { 'robot' => $robot_id,
> 'list' => $list->name,
> @@ -19798,7 +19799,7 @@
> $robot_id
> );
> wwslog('err', "do_d_rename : Failed to rename %s to %s : %s",
> - $doc, "$shareddir/$current_directory/$in{'new_name'}", $!);
> + $doc, "$shareddir/$current_directory/$in{'new_name'}",
> $ERRNO);
> web_db_log(
> { 'robot' => $robot_id,
> 'list' => $list->name,
> @@ -19838,7 +19839,7 @@
> $param->{'user'}{'email'},
> $robot_id
> );
> - wwslog('err', "do_d_rename : Failed to rename $desc_file :
> $!");
> + wwslog('err', "do_d_rename : Failed to rename $desc_file :
> $ERRNO");
> web_db_log(
> { 'robot' => $robot_id,
> 'list' => $list->name,
> @@ -20123,7 +20124,7 @@
> $param->{'action'}, $list, $param->{'user'}{'email'},
> $robot_id);
> wwslog('err',
> - "do_d_create_dir : Unable to create $document : $!");
> + "do_d_create_dir : Unable to create $document : $ERRNO");
> web_db_log(
> { 'robot' => $robot_id,
> 'list' => $list->name,
> @@ -20154,7 +20155,7 @@
> $robot_id
> );
> wwslog('err',
> - "do_d_create_dir : Unable to create $document : $!");
> + "do_d_create_dir : Unable to create $document : $ERRNO");
> web_db_log(
> { 'robot' => $robot_id,
> 'list' => $list->name,
> @@ -20215,7 +20216,7 @@
> $robot_id
> );
> wwslog('err',
> - "do_d_create_dir : Failed to rename $path/$name_doc to
> $path/.$name_doc.moderate : $!"
> + "do_d_create_dir : Failed to rename $path/$name_doc to
> $path/.$name_doc.moderate : $ERRNO"
> );
> web_db_log(
> { 'robot' => $robot_id,
> @@ -20247,7 +20248,7 @@
> $robot_id
> );
> wwslog('err',
> - "do_d_create_dir : Failed to rename $desc_file to
> $path/.desc..$name_doc.moderate : $!"
> + "do_d_create_dir : Failed to rename $desc_file to
> $path/.desc..$name_doc.moderate : $ERRNO"
> );
> web_db_log(
> { 'robot' => $robot_id,
> @@ -20719,7 +20720,7 @@
> }
>
> unless (open DESC, ">$desc_file") {
> - wwslog('info', "d_change_access : cannot open $desc_file :
> $!");
> + wwslog('info', "d_change_access : cannot open $desc_file :
> $ERRNO");
> Sympa::Report::reject_report_web('intern', 'cannot_open_file',
> {'file' => $desc_file},
> $param->{'action'}, $list, $param->{'user'}{'email'},
> @@ -20767,7 +20768,7 @@
> $param->{'action'}, $list, $param->{'user'}{'email'},
> $robot_id);
> wwslog('info',
> - "d_change_access : Cannot create description file
> $desc_file : $!"
> + "d_change_access : Cannot create description file
> $desc_file : $ERRNO"
> );
> web_db_log(
> { 'robot' => $robot_id,
> @@ -20973,7 +20974,7 @@
> }
>
> unless (open DESC, ">$desc_file") {
> - wwslog('info', "d_set_owner : cannot open $desc_file : $!");
> + wwslog('info', "d_set_owner : cannot open $desc_file :
> $ERRNO");
> Sympa::Report::reject_report_web('intern', 'cannot_open_file',
> {'file' => $desc_file},
> $param->{'action'}, $list, $param->{'user'}{'email'},
> @@ -21020,7 +21021,7 @@
> $param->{'action'}, $list, $param->{'user'}{'email'},
> $robot_id);
> wwslog('info',
> - "d_set_owner : Cannot create description file $desc_file :
> $!"
> + "d_set_owner : Cannot create description file $desc_file :
> $ERRNO"
> );
> web_db_log(
> { 'robot' => $robot_id,
> @@ -22770,7 +22771,7 @@
>
> foreach my $pair (split /\0/, $in{'pending_email'}) {
> if ($pair =~ /,/) {
> - push @users, $`;
> + push @users, $PREMATCH;
> }
> }
>
> @@ -23231,7 +23232,7 @@
> unless (mkdir($scenario_dir, 0777)) {
> Sympa::Log::Syslog::do_log('err',
> "do_dump_scenario: cannot_create_dir %s : %s ",
> - $scenario_dir, $!);
> + $scenario_dir, $ERRNO);
> Sympa::Report::reject_report_web(
> 'intern',
> 'cannot_create_dir',
> @@ -23830,7 +23831,7 @@
> return undef;
> }
>
> - $param->{'msg_file'} = $robot->tmpdir . '/' . $messagekey . '_' . $$;
> + $param->{'msg_file'} = $robot->tmpdir . '/' . $messagekey . '_' . $PID;
>
> unless (open OUT, '>', $param->{'msg_file'}) {
> Sympa::Log::Syslog::do_log('notice', 'Could Not open %s',
> @@ -24524,18 +24525,18 @@
> return undef unless ($file);
>
> eval { require "$file"; };
> - if ($@) {
> + if ($EVAL_ERROR) {
> Sympa::Log::Syslog::do_log('err', 'Error requiring %s : %s (%s)',
> - $custom_action, "$@", ref($@));
> + $custom_action, "$EVAL_ERROR", ref($EVAL_ERROR));
> return undef;
> }
>
> unshift @{$cap}, $list if ($list);
> my $res;
> eval "\$res = " . $custom_action . "_plugin::process(\@{\$cap});";
> - if ($@) {
> + if ($EVAL_ERROR) {
> Sympa::Log::Syslog::do_log('err', 'Error evaluating %s : %s (%s)',
> - $custom_action, "$@", ref($@));
> + $custom_action, "$EVAL_ERROR", ref($EVAL_ERROR));
> return undef;
> }
>
> @@ -24789,7 +24790,7 @@
> {'path' => $in{'path'}},
> $param->{'action'}, $list, $param->{'user'}{'email'},
> $robot_id);
> wwslog('err',
> - "d_read : cannot open $document->{'absolute_path'} : $!");
> + "d_read : cannot open $document->{'absolute_path'} : $ERRNO");
> web_db_log(
> { 'robot' => $robot_id,
> 'list' => $list->name,
> Modified: trunk/src/lib/Sympa/Admin.pm (10313 => 10314)
> --- trunk/src/lib/Sympa/Admin.pm 2014-02-28 16:19:49 UTC (rev 10313)
> +++ trunk/src/lib/Sympa/Admin.pm 2014-02-28 16:23:04 UTC (rev 10314)
> @@ -36,6 +36,7 @@
> package Sympa::Admin;
>
> use strict;
> +use English qw(-no_match_vars);
> use File::Copy;
>
> # tentative
> @@ -266,7 +267,7 @@
> unless (mkdir($list_dir, 0777)) {
> Sympa::Log::Syslog::do_log('err',
> 'create_list_old : unable to create %s : %s',
> - $list_dir, $?);
> + $list_dir, $CHILD_ERROR);
> return undef;
> }
>
> @@ -303,7 +304,7 @@
> unless (open CONFIG, '>', "$list_dir/config") {
> Sympa::Log::Syslog::do_log('err',
> 'Impossible to create %s/config : %s',
> - $list_dir, $!);
> + $list_dir, $ERRNO);
> $lock->unlock();
> return undef;
> }
> @@ -328,7 +329,7 @@
> ## info file creation.
> unless (open INFO, '>', "$list_dir/info") {
> Sympa::Log::Syslog::do_log('err', 'Impossible to create %s/info :
> %s',
> - $list_dir, $!);
> + $list_dir, $ERRNO);
> }
> if (defined $param->{'description'}) {
> Encode::from_to($param->{'description'},
> @@ -507,7 +508,7 @@
>
> unless (-r $list_dir || mkdir($list_dir, 0777)) {
> Sympa::Log::Syslog::do_log('err', 'unable to create %s : %s',
> - $list_dir, $?);
> + $list_dir, $CHILD_ERROR);
> return undef;
> }
>
> @@ -535,7 +536,7 @@
> unless (open CONFIG, '>', "$list_dir/config") {
> Sympa::Log::Syslog::do_log('err',
> 'Impossible to create %s/config : %s',
> - $list_dir, $!);
> + $list_dir, $ERRNO);
> $lock->unlock();
> return undef;
> }
> @@ -554,7 +555,7 @@
>
> unless (open INFO, '>', "$list_dir/info") {
> Sympa::Log::Syslog::do_log('err', 'Impossible to create %s/info :
> %s',
> - $list_dir, $!);
> + $list_dir, $ERRNO);
> }
> if (defined $param->{'description'}) {
> print INFO $param->{'description'};
> @@ -580,7 +581,7 @@
> unless (open FILE, '>', "$list_dir/$file") {
> Sympa::Log::Syslog::do_log('err',
> 'Impossible to create %s/%s : %s',
> - $list_dir, $file, $!);
> + $list_dir, $file, $ERRNO);
> }
> print FILE $file_content;
> close FILE;
> @@ -701,7 +702,7 @@
> unless (open CONFIG, '>', $list->dir . '/config') {
> Sympa::Log::Syslog::do_log('err',
> 'Impossible to create %s/config : %s',
> - $list->dir, $!);
> + $list->dir, $ERRNO);
> $lock->unlock();
> return undef;
> }
> @@ -899,7 +900,7 @@
> unless (move($list->dir, $new_dir)) {
> Sympa::Log::Syslog::do_log('err',
> 'Unable to rename %s to %s : %s',
> - $list->dir, $new_dir, $!);
> + $list->dir, $new_dir, $ERRNO);
> return 'internal';
> }
>
> @@ -1038,7 +1039,7 @@
> unless (opendir(DIR, Sympa::Site->$spool)) {
> Sympa::Log::Syslog::do_log('err',
> "Unable to open '%s' spool : %s",
> - Sympa::Site->$spool, $!);
> + Sympa::Site->$spool, $ERRNO);
> }
>
> foreach my $file (sort readdir(DIR)) {
> @@ -1076,7 +1077,7 @@
> 'err',
> "Unable to rename %s to %s : %s",
> Sympa::Site->$spool . "/$file",
> - Sympa::Site->$spool . "/$newfile", $!
> + Sympa::Site->$spool . "/$newfile", $ERRNO
> );
> next;
> }
> @@ -1101,7 +1102,7 @@
> "Unable to rename %s to %s : %s",
> Sympa::Site->queuedigest . "/$old_listname",
> Sympa::Site->queuedigest . "/$param{'new_listname'}",
> - $!
> + $ERRNO
> );
> next;
> }
> @@ -1119,7 +1120,7 @@
> Sympa::Site->queuedigest . "/$old_listname\@$robot",
> Sympa::Site->queuedigest
> . "/$param{'new_listname'}\@$param{'new_robot'}",
> - $!
> + $ERRNO
> );
> next;
> }
> @@ -1180,7 +1181,7 @@
> 'err',
> 'Admin::clone_list_as_empty : failed to create directory %s :
> %s',
> $new_dir,
> - $!
> + $ERRNO
> );
> return undef;
> }
> @@ -1197,7 +1198,7 @@
> 'err',
> 'Admin::clone_list_as_empty : failed to
> copy_directory %s : %s',
> $new_dir . '/' . $subdir,
> - $!
> + $ERRNO
> );
> return undef;
> }
> @@ -1215,7 +1216,7 @@
> Sympa::Log::Syslog::do_log(
> 'err',
> 'Admin::clone_list_as_empty : failed to copy %s : %s',
> - $new_dir . '/' . $file, $!
> + $new_dir . '/' . $file, $ERRNO
> );
> return undef;
> }
> @@ -1234,7 +1235,7 @@
> Sympa::Log::Syslog::do_log(
> 'err',
> 'Admin::clone_list_as_empty : failed to copy %s : %s',
> - $new_dir . '/' . $file, $!
> + $new_dir . '/' . $file, $ERRNO
> );
> return undef;
> }
> @@ -1403,7 +1404,7 @@
> push @addresses, "$list\@" . $domain;
>
> eval { require Net::SMTP; };
> - if ($@) {
> + if ($EVAL_ERROR) {
> Sympa::Log::Syslog::do_log('err',
> 'Unable to use Net library, Net::SMTP required, install it
> (CPAN) first'
> );
> @@ -1444,14 +1445,14 @@
> if Sympa::Site->sendmail_aliases =~ /^none$/i;
>
> my $alias_manager = Sympa::Site->alias_manager;
> - my $output_file = Sympa::Site->tmpdir . '/aliasmanager.stdout.'
> . $$;
> - my $error_output_file = Sympa::Site->tmpdir . '/aliasmanager.stderr.'
> . $$;
> + my $output_file = Sympa::Site->tmpdir . '/aliasmanager.stdout.'
> . $PID;
> + my $error_output_file = Sympa::Site->tmpdir . '/aliasmanager.stderr.'
> . $PID;
> Sympa::Log::Syslog::do_log('debug3', '%s add alias %s@%s for list %s',
> $alias_manager, $list->name, $list->host, $list);
>
> unless (-x $alias_manager) {
> Sympa::Log::Syslog::do_log('err', 'Failed to install aliases: %s',
> - $!);
> + $ERRNO);
> return undef;
> }
> ##FIXME: 'host' parameter is passed to alias_manager: no 'domain'
> @@ -1460,7 +1461,7 @@
> $alias_manager, $list->name, $list->host,
> $output_file, $error_output_file;
> system($cmd);
> - my $status = $? >> 8;
> + my $status = $CHILD_ERROR >> 8;
> if ($status == 0) {
> Sympa::Log::Syslog::do_log('info',
> 'Aliases installed successfully: list %s', $list);
> Modified: trunk/src/lib/Sympa/Archive.pm (10313 => 10314)
> --- trunk/src/lib/Sympa/Archive.pm 2014-02-28 16:19:49 UTC (rev 10313)
> +++ trunk/src/lib/Sympa/Archive.pm 2014-02-28 16:23:04 UTC (rev 10314)
> @@ -24,6 +24,7 @@
> package Sympa::Archive;
>
> use strict;
> +use English qw(-no_match_vars);
> use Carp qw(croak);
> use Cwd qw(getcwd);
> use Digest::MD5;
> @@ -244,7 +245,7 @@
> unless (open ARC, $parameters{'file_path'}) {
> Sympa::Log::Syslog::do_log(
> 'err',
> - "Failed to load message '%s' : $!",
> + "Failed to load message '%s' : $ERRNO",
> $parameters{'file_path'}
> );
> return undef;
> @@ -312,7 +313,7 @@
> Sympa::Log::Syslog::do_log(
> 'err',
> 'Unable to open directory %s: %s',
> - $answer->{'dir_to_rebuild'}, $!
> + $answer->{'dir_to_rebuild'}, $ERRNO
> );
> Sympa::Tools::del_dir($answer->{'cleaned_dir'});
> return undef;
> Modified: trunk/src/lib/Sympa/BounceMessage.pm (10313 => 10314)
> --- trunk/src/lib/Sympa/BounceMessage.pm 2014-02-28 16:19:49 UTC (rev
> 10313)
> +++ trunk/src/lib/Sympa/BounceMessage.pm 2014-02-28 16:23:04 UTC (rev
> 10314)
> @@ -25,6 +25,7 @@
>
> use strict;
> use warnings;
> +use English qw(-no_match_vars);
>
> use Sympa::Message;
> use Sympa::Log;
> @@ -1011,7 +1012,7 @@
> 'err',
> 'Could not create %s: %s bounced dir, check
> bounce_path in wwsympa.conf',
> $bounce_dir,
> - $!
> + $ERRNO
> );
> exit;
> }
> @@ -1222,7 +1223,7 @@
> ## RFC1891 compliance check
> sub rfc1891 {
> my ($self, $result, $from) = @_;
> - local $/ = "\n";
> + local $RS = "\n";
>
> Sympa::Log::Syslog::do_log('debug2',
> 'RFC 1891 compliance check for bounce %s',
> @@ -1259,7 +1260,7 @@
> exit;
> } else {
> ## Multiline paragraph separator
> - local $/ = '';
> + local $RS = '';
>
> while (<BODY>) {
>
> @@ -1283,7 +1284,7 @@
> $nbrcpt++;
> }
> }
> - local $/ = "\n";
> + local $RS = "\n";
> close BODY;
> }
> }
> @@ -1356,7 +1357,7 @@
> # a temporary file is used when introducing database spool. It should
> be
> # rewrited! It should be rewrited! It should be rewrited! Yes, it
> should
> # be rewrited!
> - my $tmpfile = Sympa::Site->tmpdir . '/bounce.' . $$;
> + my $tmpfile = Sympa::Site->tmpdir . '/bounce.' . $PID;
> my $fh;
> unless (open $fh, '>', $tmpfile) {
> Sympa::Log::Syslog::do_log('err', 'Could not create %s', $tmpfile);
> @@ -1384,7 +1385,7 @@
>
> ## Le champ separateur de paragraphe est un ensemble
> ## de lignes vides
> - local $/ = '';
> + local $RS = '';
>
> ## Parcour du bounce, paragraphe par paragraphe
> foreach (<BOUNCE>) {
> @@ -1392,7 +1393,7 @@
> undef $entete;
> ## Parcour du paragraphe
> my @paragraphe = split /\n/, $_;
> - local $/ = "\n";
> + local $RS = "\n";
> my ($champ_courant, %champ);
> foreach (@paragraphe) {
>
> @@ -1409,7 +1410,7 @@
> $$from = $1;
> }
> }
> - local $/ = '';
> + local $RS = '';
>
> $champ{from} =~ s/^.*<(.+)[\>]$/$1/;
> $champ{from} =~ y/[A-Z]/[a-z]/;
> @@ -1440,7 +1441,7 @@
> my $adr;
> ## Parcour du paragraphe
> my @paragraphe = split /\n/, $_;
> - local $/ = "\n";
> + local $RS = "\n";
> foreach (@paragraphe) {
> if (/^(\S[^\(]*)/) {
> $adr = $1;
> @@ -1457,12 +1458,12 @@
> $info{$adr}{expanded} =~ s/^[\"\<](.+)[\"\>]$/$1/;
> }
> }
> - local $/ = '';
> + local $RS = '';
> } elsif (/^\s+-+\sTranscript of session follows\s-+/m) {
> my $adr;
> ## Parcour du paragraphe
> my @paragraphe = split /\n/, $_;
> - local $/ = "\n";
> + local $RS = "\n";
> foreach (@paragraphe) {
> if (/^(\d{3}\s)?(\S+|\".*\")\.{3}\s(.+)$/) {
> $adr = $2;
> @@ -1492,21 +1493,21 @@
> }
> }
> }
> - local $/ = '';
> + local $RS = '';
>
> ## Rapport Compuserve
> } elsif (/^Receiver not found:/m) {
>
> ## Parcour du paragraphe
> my @paragraphe = split /\n/, $_;
> - local $/ = "\n";
> + local $RS = "\n";
> foreach (@paragraphe) {
>
> $info{$2}{error} = $1 if /^(.*): (\S+)/;
> $type = 3;
>
> }
> - local $/ = '';
> + local $RS = '';
>
> } elsif (/^\s*-+ Special condition follows -+/m) {
>
> @@ -1514,7 +1515,7 @@
>
> ## Parcour du paragraphe
> my @paragraphe = split /\n/, $_;
> - local $/ = "\n";
> + local $RS = "\n";
> foreach (@paragraphe) {
>
> if (/^(Unknown QuickMail recipient\(s\)):/) {
> @@ -1530,7 +1531,7 @@
>
> }
> }
> - local $/ = '';
> + local $RS = '';
>
> } elsif (/^Your message adressed to .* couldn\'t be delivered/m) {
>
> @@ -1538,7 +1539,7 @@
>
> ## Parcour du paragraphe
> my @paragraphe = split /\n/, $_;
> - local $/ = "\n";
> + local $RS = "\n";
> foreach (@paragraphe) {
>
> if (/^Your message adressed to (.*) couldn\'t be
> delivered, for the following reason :/
> @@ -1555,7 +1556,7 @@
>
> }
> }
> - local $/ = '';
> + local $RS = '';
>
> ## Rapport X400
> } elsif (
> @@ -1602,7 +1603,7 @@
> $info{$1}{error} = $2;
> $type = 8;
> }
> - local $/ = '';
> + local $RS = '';
> ## Sendmail
> } elsif (
> /^Your message was not delivered to the following
> recipients:/m) {
> @@ -1663,7 +1664,7 @@
> my $adr;
> ## Parcour du paragraphe
> my @paragraphe = split /\n/, $_;
> - local $/ = "\n";
> + local $RS = "\n";
> foreach (@paragraphe) {
> if (/^Rejected-For: (\S+),/) {
> $adr = $1;
> @@ -1673,14 +1674,14 @@
> $info{$adr}{error} = $1;
> }
> }
> - local $/ = '';
> + local $RS = '';
> } elsif (/^\s*-+Message not delivered to the following:/) {
> $type_18 = 1;
> } elsif ($type_18) {
> undef $type_18;
> ## Parcour du paragraphe
> my @paragraphe = split /\n/, $_;
> - local $/ = "\n";
> + local $RS = "\n";
> foreach (@paragraphe) {
>
> if (/^\s*(\S+)\s+(.*)$/) {
> @@ -1690,11 +1691,11 @@
>
> }
> }
> - local $/ = '';
> + local $RS = '';
> } elsif (/unable to deliver following mail to recipient\(s\):/m) {
> ## Parcour du paragraphe
> my @paragraphe = split /\n/, $_;
> - local $/ = "\n";
> + local $RS = "\n";
> foreach (@paragraphe) {
>
> if (/^\d+ <(\S+)>\.{3} (.+)$/) {
> @@ -1702,7 +1703,7 @@
> $type = 19;
> }
> }
> - local $/ = '';
> + local $RS = '';
> ## Rapport de Yahoo dans paragraphe suivant
> } elsif (/^Unable to deliver message to the following
> address\(es\)/m)
> {
> @@ -1723,14 +1724,14 @@
>
> ## Parcour du paragraphe
> my @paragraphe = split /\n/, $_;
> - local $/ = "\n";
> + local $RS = "\n";
> foreach (@paragraphe) {
> if (/<(\S+)>\.{3} (.*)$/) {
> $info{$1}{error} = $2;
> $type = 21;
> }
> }
> - local $/ = '';
> + local $RS = '';
> } elsif (
> /^Your message has encountered delivery problems\s+to local
> user \S+\.\s+\(Originally addressed to (\S+)\)/m
> or
> @@ -1793,7 +1794,7 @@
>
> ## Parcour du paragraphe
> my @paragraphe = split /\n/, $_;
> - local $/ = "\n";
> + local $RS = "\n";
> foreach (@paragraphe) {
>
> if (/<(\S+)>\s+(.*)$/) {
> @@ -1802,7 +1803,7 @@
> $type = 26;
> }
> }
> - local $/ = '';
> + local $RS = '';
>
> ## Rapport de AltaVista Mail dans paragraphe suivant
> } elsif (/unable to deliver mail to the following
> recipient\(s\):/m) {
> @@ -1857,7 +1858,7 @@
>
> ## Parcour du paragraphe
> my @paragraphe = split /\n/, $_;
> - local $/ = "\n";
> + local $RS = "\n";
> foreach (@paragraphe) {
>
> if (/<(\S+)>\s+(.*)$/) {
> @@ -1866,7 +1867,7 @@
> $type = 30;
> }
> }
> - local $/ = '';
> + local $RS = '';
>
> } elsif (/^The following recipients haven\'t received this
> message:/m)
> {
> @@ -1879,7 +1880,7 @@
>
> ## Parcour du paragraphe
> my @paragraphe = split /\n/, $_;
> - local $/ = "\n";
> + local $RS = "\n";
> foreach (@paragraphe) {
>
> if (/(\S+)$/) {
> @@ -1888,7 +1889,7 @@
> $type = 31;
> }
> }
> - local $/ = '';
> + local $RS = '';
>
> } elsif (/^The following destination addresses were unknown/m) {
>
> @@ -1900,7 +1901,7 @@
>
> ## Parcour du paragraphe
> my @paragraphe = split /\n/, $_;
> - local $/ = "\n";
> + local $RS = "\n";
> foreach (@paragraphe) {
>
> if (/<(\S+)>/) {
> @@ -1909,13 +1910,13 @@
> $type = 32;
> }
> }
> - local $/ = '';
> + local $RS = '';
>
> } elsif (/^-+Transcript of session follows\s-+$/m) {
>
> ## Parcour du paragraphe
> my @paragraphe = split /\n/, $_;
> - local $/ = "\n";
> + local $RS = "\n";
> foreach (@paragraphe) {
>
> if (/^(\S+)$/) {
> @@ -1930,7 +1931,7 @@
>
> }
> }
> - local $/ = '';
> + local $RS = '';
>
> ## Rapport Bigfoot
> } elsif (/^The message you tried to send to <(\S+)>/m) {
> @@ -1964,7 +1965,7 @@
>
> ## Parcour du paragraphe
> my @paragraphe = split /\n/, $_;
> - local $/ = "\n";
> + local $RS = "\n";
> foreach (@paragraphe) {
>
> if (/(\S+)/) {
> @@ -1973,7 +1974,7 @@
> $type = 37;
> }
> }
> - local $/ = '';
> + local $RS = '';
>
> } elsif (
> /^This Message was undeliverable due to the following
> reason:/m) {
> @@ -1986,7 +1987,7 @@
>
> ## Parcour du paragraphe
> my @paragraphe = split /\n/, $_;
> - local $/ = "\n";
> + local $RS = "\n";
> foreach (@paragraphe) {
>
> if (/\s+Recipient:\s+<(\S+)>/) {
> @@ -2001,7 +2002,7 @@
>
> }
> }
> - local $/ = '';
> + local $RS = '';
>
> } elsif (/Your message could not be delivered to:/m) {
>
> @@ -2059,7 +2060,7 @@
>
> ## Parcour du paragraphe
> my @paragraphe = split /\n/, $_;
> - local $/ = "\n";
> + local $RS = "\n";
> foreach (@paragraphe) {
>
> if (/\s+Recipient address:\s+(\S+)/) {
> @@ -2075,7 +2076,7 @@
>
> }
> }
> - local $/ = '';
> + local $RS = '';
>
> ## Rapport MDaemon
> } elsif (/^(\S+) - (no such user here)\.$/m) {
> @@ -2104,7 +2105,7 @@
> $info{$addr}{error} = $error;
> }
> }
> - local $/ = '';
> + local $RS = '';
> } elsif (
> /^The message that you sent was undeliverable to the
> following:/)
> {
> @@ -2117,7 +2118,7 @@
>
> ## Parcour du paragraphe
> my @paragraphe = split /\n/, $_;
> - local $/ = "\n";
> + local $RS = "\n";
> foreach (@paragraphe) {
>
> if (/^\s+(\S*) \((.+)\)/) {
> @@ -2127,7 +2128,7 @@
> }
> }
>
> - local $/ = '';
> + local $RS = '';
>
> ## Wanadoo
> } elsif (/^(\S+); Action: Failed; Status: \d.\d.\d \((.*)\)/m) {
> Modified: trunk/src/lib/Sympa/Bulk.pm (10313 => 10314)
> --- trunk/src/lib/Sympa/Bulk.pm 2014-02-28 16:19:49 UTC (rev 10313)
> +++ trunk/src/lib/Sympa/Bulk.pm 2014-02-28 16:23:04 UTC (rev 10314)
> @@ -25,6 +25,7 @@
>
> use strict;
> use warnings;
> +use English qw(-no_match_vars);
>
> #use Carp; # currently not used
> use Encode;
> @@ -345,7 +346,7 @@
> and $message->{'messagekey'} eq $last_stored_message_key) {
> $message_already_on_spool = 1;
> } else {
> - my $lock = $$ . '@' . hostname();
> + my $lock = $PID . '@' . hostname();
> if ($message->{'messagekey'}) {
>
> # move message to spool bulk and keep it locked
> Modified: trunk/src/lib/Sympa/ClassicSpool.pm (10313 => 10314)
> --- trunk/src/lib/Sympa/ClassicSpool.pm 2014-02-28 16:19:49 UTC (rev
> 10313)
> +++ trunk/src/lib/Sympa/ClassicSpool.pm 2014-02-28 16:23:04 UTC (rev
> 10314)
> @@ -33,6 +33,7 @@
>
> use strict;
> use warnings;
> +use English qw(-no_match_vars);
> use Carp qw(croak);
> use Exporter;
> use File::Path qw(make_path remove_tree);
> @@ -76,7 +77,7 @@
> $queue = 'queue' if ($spoolname eq 'msg');
> my $dir;
> eval { $dir = Sympa::Site->$queue; }; # check if parameter is
> defined.
> - if ($@) {
> + if ($EVAL_ERROR) {
> Sympa::Log::Syslog::do_log('err', 'internal error unknown spool
> %s',
> $spoolname);
> return undef;
> @@ -170,9 +171,9 @@
> next;
> }
> my $cmp = eval $perlselector;
> - if ($@) {
> + if ($EVAL_ERROR) {
> Sympa::Log::Syslog::do_log('err',
> - 'Failed to evaluate selector: %s', $@);
> + 'Failed to evaluate selector: %s', $EVAL_ERROR);
> return undef;
> }
> next unless $cmp;
> @@ -182,9 +183,9 @@
> # Sorting
> if ($perlcomparator) {
> my @sorted = eval sprintf 'sort { %s } @messages', $perlcomparator;
> - if ($@) {
> + if ($EVAL_ERROR) {
> Sympa::Log::Syslog::do_log('err', 'Could not sort messages:
> %s',
> - $@);
> + $EVAL_ERROR);
> } else {
> @messages = @sorted;
> }
> @@ -350,9 +351,9 @@
> next unless $item;
>
> $cmp = eval $perlselector;
> - if ($@) {
> + if ($EVAL_ERROR) {
> Sympa::Log::Syslog::do_log('err',
> - 'Failed to evaluate selector: %s', $@);
> + 'Failed to evaluate selector: %s', $EVAL_ERROR);
> return undef;
> }
> next unless $cmp;
> @@ -363,9 +364,9 @@
> }
> my ($a, $b) = ($data, $item);
> $cmp = eval $perlcomparator;
> - if ($@) {
> + if ($EVAL_ERROR) {
> Sympa::Log::Syslog::do_log('err',
> - 'Could not compare messages: %s', $@);
> + 'Could not compare messages: %s', $EVAL_ERROR);
> return $data;
> }
> if ($cmp > 0) {
> @@ -462,11 +463,11 @@
> Sympa::Log::Syslog::do_log(
> 'err',
> 'Unable to open file %s: %s',
> - $self->{'dir'} . '/' . $key, $!
> + $self->{'dir'} . '/' . $key, $ERRNO
> );
> return undef;
> }
> - local $/;
> + local $RS;
> my $messageasstring = <$fh>;
> close $fh;
> return $messageasstring;
> @@ -599,7 +600,7 @@
> 'err',
> 'Could not move file %s to spool bad %s: %s',
> $self->{'dir'} . '/' . $key,
> - $self->{'dir'} . '/bad', $!
> + $self->{'dir'} . '/bad', $ERRNO
> );
> return undef;
> }
> @@ -740,7 +741,7 @@
> Sympa::Log::Syslog::do_log(
> 'err',
> 'Unable to remove file %s: %s',
> - $self->{'dir'} . '/' . $key, $!
> + $self->{'dir'} . '/' . $key, $ERRNO
> );
> return undef;
> }
> @@ -787,7 +788,7 @@
> } else {
> Sympa::Log::Syslog::do_log('notice',
> 'unable to delete old file %s: %s',
> - "$self->{'dir'}/$f", $!);
> + "$self->{'dir'}/$f", $ERRNO);
> }
> } else {
> last;
> @@ -803,7 +804,7 @@
> } else {
> Sympa::Log::Syslog::do_log('notice',
> 'unable to delete old file %s: %s',
> - "$self->{'dir'}/$d", $!);
> + "$self->{'dir'}/$d", $ERRNO);
> }
> } else {
> last;
> Modified: trunk/src/lib/Sympa/Conf.pm (10313 => 10314)
> --- trunk/src/lib/Sympa/Conf.pm 2014-02-28 16:19:49 UTC (rev 10313)
> +++ trunk/src/lib/Sympa/Conf.pm 2014-02-28 16:23:04 UTC (rev 10314)
> @@ -24,6 +24,7 @@
> package Sympa::Conf;
>
> use strict;
> +use English qw(-no_match_vars);
>
> use Exporter;
>
> @@ -271,7 +272,7 @@
> 'notice',
> 'Could not remove file %s: %s. You should remove it
> manually to ensure the configuration used is valid.',
> $binary_file,
> - $!
> + $ERRNO
> );
> }
> }
> @@ -549,7 +550,7 @@
> unless (mkdir($dir, 0775)) {
> Sympa::Log::Syslog::do_log('err',
> 'Unable to create directory %s: %s',
> - $dir, $!);
> + $dir, $ERRNO);
> $config_err++;
> }
>
> @@ -685,7 +686,7 @@
> 'err',
> 'Unable to create %s/index.html as an empty file
> to protect directory: %s',
> $dir,
> - $!
> + $ERRNO
> );
> }
> close FF;
> @@ -739,7 +740,7 @@
> ## Create directory if required
> unless (-d $dir) {
> unless (Sympa::Tools::mkdir_all($dir, 0755)) {
> - my $msg = "Failed to create directory $dir: $!";
> + my $msg = "Failed to create directory $dir: $ERRNO";
> Sympa::Log::Syslog::do_log('err', '%s', $msg);
> $robot->send_notify_to_listmaster('cannot_mkdir', $msg);
> return undef;
> @@ -768,7 +769,7 @@
> rename $dir . '/' . $css, $dir . '/' . $css . '.' . time;
>
> unless (open CSS, '>', "$dir/$css") {
> - my $msg = "Could not open (write) file $dir/$css: $!";
> + my $msg = "Could not open (write) file $dir/$css:
> $ERRNO";
> $robot->send_notify_to_listmaster('cannot_open_file',
> $msg);
> Sympa::Log::Syslog::do_log('err', '%s', $msg);
> @@ -965,7 +966,7 @@
> ## Open the configuration file or return and read the lines.
> unless (open(IN, $config_file)) {
> Sympa::Log::Syslog::do_log('notice', 'Unable to open %s: %s',
> - $config_file, $!);
> + $config_file, $ERRNO);
> return undef;
> }
>
> @@ -1024,7 +1025,7 @@
> }
>
> eval "require AuthCAS";
> - if ($@) {
> + if ($EVAL_ERROR) {
> Sympa::Log::Syslog::do_log('err',
> 'Failed to load AuthCAS perl module');
> return undef;
> @@ -1142,7 +1143,7 @@
> unless (open CONFIG, $config_file) {
> Sympa::Log::Syslog::do_log('err',
> 'Unable to read configuration file %s: %s',
> - $config_file, $!);
> + $config_file, $ERRNO);
> return {};
> }
> while (<CONFIG>) {
> @@ -1189,7 +1190,7 @@
> ## Open the configuration file or return and read the lines.
> unless (open(IN, $config_file)) {
> Sympa::Log::Syslog::do_log('err', 'Unable to open %s: %s',
> - $config_file, $!);
> + $config_file, $ERRNO);
> return undef;
> }
> while (<IN>) {
> @@ -1392,7 +1393,7 @@
> my (@paragraphs);
>
> ## Just in case...
> - local $/ = "\n";
> + local $RS = "\n";
>
> ## Set defaults to 1
> foreach my $pname (keys %structure) {
> @@ -1639,7 +1640,7 @@
> ## Open the configuration file or return and read the lines.
> unless (open IN, '<', $config_file) {
> Sympa::Log::Syslog::do_log('err', 'Unable to open %s: %s',
> - $config_file, $!);
> + $config_file, $ERRNO);
> return undef;
> }
> while (<IN>) {
> @@ -2020,7 +2021,7 @@
> my $number_of_missing_modules = 0;
> if ($param->{'config_hash'}{'lock_method'} eq 'nfs') {
> eval "require File::NFSLock";
> - if ($@) {
> + if ($EVAL_ERROR) {
> Sympa::Log::Syslog::do_log('notice',
> 'Failed to load File::NFSLock perl module ; setting
> "lock_method" to "flock"'
> );
> @@ -2032,7 +2033,7 @@
> ## Some parameters require CPAN modules
> if ($param->{'config_hash'}{'dkim_feature'} eq 'on') {
> eval "require Mail::DKIM";
> - if ($@) {
> + if ($EVAL_ERROR) {
> Sympa::Log::Syslog::do_log('notice',
> 'Failed to load Mail::DKIM perl module ; setting
> "dkim_feature" to "off"'
> );
> @@ -2339,11 +2340,11 @@
> eval {
> Storable::store($param->{'conf_to_save'}, $param->{'target_file'});
> };
> - if ($@) {
> + if ($EVAL_ERROR) {
> Sympa::Log::Syslog::do_log(
> 'err',
> 'Failed to save the binary config %s. error: %s',
> - $param->{'target_file'}, $@
> + $param->{'target_file'}, $EVAL_ERROR
> );
> unless ($lock->unlock()) {
> return undef;
> @@ -2357,11 +2358,11 @@
> $param->{'target_file'}
> );
> };
> - if ($@) {
> + if ($EVAL_ERROR) {
> Sympa::Log::Syslog::do_log(
> 'err',
> 'Failed to change owner of the binary file %s. error: %s',
> - $param->{'target_file'}, $@
> + $param->{'target_file'}, $EVAL_ERROR
> );
> unless ($lock->unlock()) {
> return undef;
> @@ -2396,10 +2397,10 @@
> }
>
> eval { $result = Storable::retrieve($config_bin); };
> - if ($@ or !$result) {
> + if ($EVAL_ERROR or !$result) {
> Sympa::Log::Syslog::do_log('err',
> 'Failed to load the binary config %s. error: %s',
> - $config_bin, $@ || 'possible format error');
> + $config_bin, $EVAL_ERROR || 'possible format error');
> unless ($lock->unlock()) {
> return undef;
> }
> Modified: trunk/src/lib/Sympa/DBManipulatorSQLite.pm (10313 => 10314)
> --- trunk/src/lib/Sympa/DBManipulatorSQLite.pm 2014-02-28 16:19:49
> UTC (rev 10313)
> +++ trunk/src/lib/Sympa/DBManipulatorSQLite.pm 2014-02-28 16:23:04
> UTC (rev 10314)
> @@ -24,6 +24,7 @@
> package Sympa::DBManipulatorSQLite;
>
> use strict;
> +use English qw(-no_match_vars);
> use Data::Dumper;
>
> use version;
> @@ -680,11 +681,11 @@
> $rc = $self->{'dbh'}->rollback;
> }
> };
> - if ($@ or !$rc) {
> + if ($EVAL_ERROR or !$rc) {
> Sympa::Log::Syslog::do_log(
> 'err',
> 'Could not unlock database: %s',
> - $@ || sprintf('(%s) %s',
> + $EVAL_ERROR || sprintf('(%s) %s',
> $self->{'dbh'}->err, $self->{'dbh'}->errstr)
> );
> return undef;
> @@ -722,11 +723,11 @@
> $rc = $self->{'dbh'}->rollback;
> }
> };
> - if ($@ or !$rc) {
> + if ($EVAL_ERROR or !$rc) {
> Sympa::Log::Syslog::do_log(
> 'err',
> 'Could not unlock database: %s',
> - $@ || sprintf('(%s) %s',
> + $EVAL_ERROR || sprintf('(%s) %s',
> $self->{'dbh'}->err, $self->{'dbh'}->errstr)
> );
> return undef;
> @@ -794,7 +795,7 @@
> my $statement;
> my $table_saved = sprintf '%s_%s_%d', $table,
> POSIX::strftime("%Y%m%d%H%M%S", gmtime $^T),
> - $$;
> + $PID;
> my $report;
>
> ## create temporary table with new structure
> Modified: trunk/src/lib/Sympa/DatabaseDescription.pm (10313 => 10314)
> --- trunk/src/lib/Sympa/DatabaseDescription.pm 2014-02-28 16:19:49
> UTC (rev 10313)
> +++ trunk/src/lib/Sympa/DatabaseDescription.pm 2014-02-28 16:23:04
> UTC (rev 10314)
> @@ -255,7 +255,7 @@
> },
> 'messagelock_spool' => {
> 'struct' => 'varchar(90)',
> - 'doc' => 'a unique string for each process :
> $$@hostname',
> + 'doc' => 'a unique string for each process :
> PID@hostname',
> 'order' => 8,
> },
> 'lockdate_spool' => {
> Modified: trunk/src/lib/Sympa/DatabaseManager.pm (10313 => 10314)
> --- trunk/src/lib/Sympa/DatabaseManager.pm 2014-02-28 16:19:49 UTC (rev
> 10313)
> +++ trunk/src/lib/Sympa/DatabaseManager.pm 2014-02-28 16:23:04 UTC (rev
> 10314)
> @@ -24,6 +24,7 @@
> package Sympa::DatabaseManager;
>
> use strict;
> +use English qw(-no_match_vars);
>
> use Carp;
> use Exporter;
> @@ -665,7 +666,7 @@
> if (-f $version_file) {
> unless (open VFILE, $version_file) {
> Sympa::Log::Syslog::do_log('err', "Unable to open %s : %s",
> - $version_file, $!);
> + $version_file, $ERRNO);
> return undef;
> }
> while (<VFILE>) {
> Modified: trunk/src/lib/Sympa/Family.pm (10313 => 10314)
> --- trunk/src/lib/Sympa/Family.pm 2014-02-28 16:19:49 UTC (rev 10313)
> +++ trunk/src/lib/Sympa/Family.pm 2014-02-28 16:23:04 UTC (rev 10314)
> @@ -36,6 +36,7 @@
> package Sympa::Family;
>
> use strict;
> +use English qw(-no_match_vars);
>
> use XML::LibXML;
> use File::Copy;
> @@ -120,7 +121,7 @@
>
> unless (opendir FAMILIES, $dir) {
> Sympa::Log::Syslog::do_log('err', "error : can't open dir %s:
> %s",
> - $dir, $!);
> + $dir, $ERRNO);
> next;
> }
>
> @@ -379,7 +380,7 @@
> unless (open(FIC, '>', $self->dir . '/_new_list.xml')) {
> Sympa::Log::Syslog::do_log('err',
> 'impossible to create the temp file %s/_new_list.xml : %s',
> - $self->dir, $!);
> + $self->dir, $ERRNO);
> }
> while (<$data>) {
> print FIC ($_);
> @@ -432,7 +433,7 @@
> push @{$return->{'string_info'}},
> sprintf(
> 'Impossible to create file %s/config_changes : %s, the list is
> set in status error_config',
> - $list->dir, $!);
> + $list->dir, $ERRNO);
> }
> close FILE;
>
> @@ -583,7 +584,7 @@
> unless (open(FIC, '>', $self->dir . '/_mod_list.xml')) {
> Sympa::Log::Syslog::do_log('err',
> 'impossible to create the temp file %s/_mod_list.xml : %s',
> - $self->dir, $!);
> + $self->dir, $ERRNO);
> }
> while (<$fh>) {
> print FIC ($_);
> @@ -668,7 +669,7 @@
> unless (open INFO, '>', $list->dir . '/info') {
> push @{$return->{'string_info'}},
> sprintf('Impossible to create new %s/info file : %s',
> - $list->dir, $!);
> + $list->dir, $ERRNO);
> }
> print INFO $hash_list->{'config'}{'description'};
> close INFO;
> @@ -752,7 +753,7 @@
> push @{$return->{'string_info'}},
> sprintf(
> 'Impossible to create file %s/config_changes : %s, the list is
> set in status error_config.',
> - $list->dir, $!);
> + $list->dir, $ERRNO);
> }
> close FILE;
>
> @@ -1020,8 +1021,8 @@
> $progress->max_update_rate(1);
> my $next_update = 0;
> my $aliasmanager_output_file =
> - Sympa::Site->tmpdir . '/aliasmanager.stdout.' . $$;
> - my $output_file = Sympa::Site->tmpdir . '/instantiate_family.stdout.'
> . $$;
> + Sympa::Site->tmpdir . '/aliasmanager.stdout.' . $PID;
> + my $output_file = Sympa::Site->tmpdir . '/instantiate_family.stdout.'
> . $PID;
> my $output = '';
>
> ## EACH FAMILY LIST
> @@ -1125,7 +1126,7 @@
> 'err',
> 'Sympa::Family::instantiate : impossible to create
> file %s/config_changes : %s',
> $list->dir,
> - $!
> + $ERRNO
> );
> push(@{$self->{'generated_lists'}{'file_error'}},
> $list->name);
> @@ -2411,7 +2412,7 @@
> unless (open INFO, '>', $list->dir . '/info') {
> Sympa::Log::Syslog::do_log('err',
> 'Impossible to open %s/info : %s',
> - $list->dir, $!);
> + $list->dir, $ERRNO);
> }
> print INFO $hash_list->{'config'}{'description'};
> close INFO;
> @@ -2489,7 +2490,7 @@
> unless (open FILE, '>', $list->dir . '/config_changes') {
> Sympa::Log::Syslog::do_log('err',
> 'impossible to open file %s/config_changes : %s',
> - $list->dir, $!);
> + $list->dir, $ERRNO);
> push(@{$self->{'generated_lists'}{'file_error'}}, $list->name);
> $list->set_status_error_config('error_copy_file', $self->name);
> }
> @@ -2949,7 +2950,7 @@
> unless (File::Copy::copy("$dir/$file", "$list_dir/instance.xml")) {
> Sympa::Log::Syslog::do_log('err',
> 'impossible to copy %s/%s into %s/instance.xml : %s',
> - $dir, $file, $list_dir, $!);
> + $dir, $file, $list_dir, $ERRNO);
> return undef;
> }
> }
> @@ -3019,14 +3020,14 @@
> unless (open(FILE, $file)) {
> Sympa::Log::Syslog::do_log('err',
> 'File %s exists, but unable to open it: %s',
> - $file, $!);
> + $file, $ERRNO);
> return undef;
> }
>
> my $error = 0;
>
> ## Just in case...
> - local $/ = "\n";
> + local $RS = "\n";
>
> while (<FILE>) {
> next if /^\s*(\#.*|\s*)$/;
> Modified: trunk/src/lib/Sympa/KeySpool.pm (10313 => 10314)
> --- trunk/src/lib/Sympa/KeySpool.pm 2014-02-28 16:19:49 UTC (rev 10313)
> +++ trunk/src/lib/Sympa/KeySpool.pm 2014-02-28 16:23:04 UTC (rev 10314)
> @@ -25,6 +25,7 @@
>
> use strict;
> use warnings;
> +use English qw(-no_match_vars);
>
> use Sympa::ClassicSpool;
> use Sympa::Log;
> @@ -111,13 +112,13 @@
> )
> ) {
> Sympa::Log::Syslog::do_log('err', 'Could not rename file %s/%s:
> %s',
> - $self->{'dir'}, $key, $!);
> + $self->{'dir'}, $key, $ERRNO);
> return undef;
> }
> unless (unlink($self->{'dir'} . '/' . $key)) {
> Sympa::Log::Syslog::do_log('err',
> 'Could not unlink message %s/%s: %s',
> - $self->{'dir'}, $key, $!);
> + $self->{'dir'}, $key, $ERRNO);
> }
> return 1;
> }
> Modified: trunk/src/lib/Sympa/LDAP.pm (10313 => 10314)
> --- trunk/src/lib/Sympa/LDAP.pm 2014-02-28 16:19:49 UTC (rev 10313)
> +++ trunk/src/lib/Sympa/LDAP.pm 2014-02-28 16:23:04 UTC (rev 10314)
> @@ -24,6 +24,7 @@
> package Sympa::LDAP;
>
> use strict;
> +use English qw(-no_match_vars);
> use Exporter;
>
> use Sympa::Log;
> @@ -64,7 +65,7 @@
> ## Open the configuration file or return and read the lines.
> unless (open(IN, $config)) {
> Sympa::Log::Syslog::do_log('err', 'Unable to open %s: %s',
> - $config, $!);
> + $config, $ERRNO);
> return undef;
> }
>
> Modified: trunk/src/lib/Sympa/List.pm (10313 => 10314)
> --- trunk/src/lib/Sympa/List.pm 2014-02-28 16:19:49 UTC (rev 10313)
> +++ trunk/src/lib/Sympa/List.pm 2014-02-28 16:23:04 UTC (rev 10314)
> @@ -25,6 +25,7 @@
>
> use strict;
> use warnings;
> +use English; # FIXME: drop $PREMATCH usage
> use Carp qw(croak);
>
> #use Encode; # load in Log
> @@ -798,9 +799,9 @@
> $count{$today} = 1;
> }
>
> - unless (open(MSG_COUNT, ">$file.$$")) {
> + unless (open(MSG_COUNT, ">$file.$PID")) {
> Sympa::Log::Syslog::do_log('err', "Unable to create '%s.%s' : %s",
> - $file, $$, $!);
> + $file, $PID, $ERRNO);
> return undef;
> }
> foreach my $key (sort { $a <=> $b } keys %count) {
> @@ -808,9 +809,9 @@
> }
> close MSG_COUNT;
>
> - unless (rename("$file.$$", $file)) {
> + unless (rename("$file.$PID", $file)) {
> Sympa::Log::Syslog::do_log('err', "Unable to write '%s' : %s",
> - $file, $!);
> + $file, $ERRNO);
> return undef;
> }
>
> @@ -1326,7 +1327,7 @@
> unless (open(FILE, $self->dir . '/config_changes')) {
> Sympa::Log::Syslog::do_log('err',
> 'File %s/config_changes exists, but unable to open it: %s',
> - $self->dir, $!);
> + $self->dir, $ERRNO);
> return undef;
> }
>
> @@ -1365,7 +1366,7 @@
> unless (open(FILE, '>', $self->dir . '/config_changes')) {
> Sympa::Log::Syslog::do_log('err',
> 'unable to create file %s/config_changes : %s',
> - $self->dir, $!);
> + $self->dir, $ERRNO);
> return undef;
> }
>
> @@ -1591,7 +1592,7 @@
> # truncate multiple "Re:" and equivalents.
> my $re_regexp = Sympa::Tools::get_regexp('re');
> if ($subject_field =~ /^\s*($re_regexp\s*)($re_regexp\s*)*/) {
> - ($before_tag, $after_tag) = ($1, $'); #'
> + ($before_tag, $after_tag) = ($1, $POSTMATCH); #'
> } else {
> ($before_tag, $after_tag) = ('', $subject_field);
> }
> @@ -4131,7 +4132,7 @@
> }
>
> unless (defined $tree) {
> - Sympa::Log::Syslog::do_log('err', "Failed to parse XML data: %s",
> $@);
> + Sympa::Log::Syslog::do_log('err', "Failed to parse XML data: %s",
> $EVAL_ERROR);
> return undef;
> }
>
> @@ -4493,7 +4494,7 @@
> Sympa::Log::Syslog::do_log(
> 'err',
> 'Could not open %s : %s',
> - $self->dir . '/info', $!
> + $self->dir . '/info', $ERRNO
> );
> return undef;
> }
> @@ -4734,7 +4735,7 @@
> unless (rename $path, $new_path) {
> Sympa::Log::Syslog::do_log('err',
> 'Failed to rename %s to %s : %s',
> - $path, $new_path, $!);
> + $path, $new_path, $ERRNO);
> last;
> }
> }
> @@ -5485,7 +5486,7 @@
> ) {
> Sympa::Log::Syslog::do_log('err',
> 'Could not store message %s in archive spool: %s',
> - $message, $!);
> + $message, $ERRNO);
> return undef;
> }
> }
> @@ -5708,7 +5709,7 @@
>
> unless (open TASK, $file) {
> Sympa::Log::Syslog::do_log('err', 'Unable to open file "%s": %s',
> - $file, $!);
> + $file, $ERRNO);
> return undef;
> }
>
> @@ -5812,7 +5813,7 @@
> open(L, $file) || return undef;
>
> ## Process the lines
> - local $/;
> + local $RS;
> my $data = <L>;
>
> my @users;
> @@ -7313,7 +7314,7 @@
> }
>
> ## Just in case...
> - local $/ = "\n";
> + local $RS = "\n";
>
> ## Split in paragraphs
> my $i = 0;
> @@ -9010,7 +9011,7 @@
> 'failed to get lists with user %s as %s from
> database: %s',
> $which_user,
> $which_role,
> - $@
> + $EVAL_ERROR
> );
> $sth = pop @sth_stack;
> return undef;
> @@ -9432,7 +9433,7 @@
> # listing of all the shared documents of the directory
> unless (opendir DIR, "$dir") {
> Sympa::Log::Syslog::do_log('err',
> - "sort_dir_to_get_mod : cannot open $dir : $!");
> + "sort_dir_to_get_mod : cannot open $dir : $ERRNO");
> return undef;
> }
>
> @@ -9682,7 +9683,7 @@
> if ($format eq 'pem') {
> unless (open(CERT, $certs)) {
> Sympa::Log::Syslog::do_log('err', 'Unable to open %s: %s',
> - $certs, $!);
> + $certs, $ERRNO);
> return undef;
> }
>
> @@ -9708,7 +9709,7 @@
> Sympa::Site->openssl . " x509 -in $certs -outform DER|");
> Sympa::Log::Syslog::do_log('err',
> 'Unable to open get %s in DER format: %s',
> - $certs, $!);
> + $certs, $ERRNO);
> return undef;
> }
>
> @@ -9737,7 +9738,7 @@
> my (@paragraphs);
>
> ## Just in case...
> - local $/ = "\n";
> + local $RS = "\n";
>
> ## ## Set defaults to 1
> ## foreach my $pname (keys %$pinfo) {
> @@ -10354,7 +10355,7 @@
> my $body = $part->bodyhandle->as_string();
> my $converted;
> eval { $converted = $charset->encode($body); };
> - if ($@) {
> + if ($EVAL_ERROR) {
> $converted = $body;
> $converted =~ s/[^\x01-\x7F]/?/g;
> }
> @@ -11026,7 +11027,7 @@
>
> unless (opendir(DIR, Sympa::Site->queuetask)) {
> Sympa::Log::Syslog::do_log('err', "error : can't open dir %s: %s",
> - Sympa::Site->queuetask, $!);
> + Sympa::Site->queuetask, $ERRNO);
> return undef;
> }
> my @tasks = grep !/^\.\.?$/, readdir DIR;
> @@ -11038,7 +11039,7 @@
> unless (unlink(Sympa::Site->queuetask . "/$task_file")) {
> Sympa::Log::Syslog::do_log('err',
> 'Unable to remove task file %s : %s',
> - $task_file, $!);
> + $task_file, $ERRNO);
> return undef;
> }
> Sympa::Log::Syslog::do_log('notice', 'Removing task file %s',
> @@ -11213,11 +11214,11 @@
> }
>
> system(sprintf '%s del %s %s', $alias_manager, $self->name,
> $self->host);
> - my $status = $? >> 8;
> + my $status = $CHILD_ERROR >> 8;
> unless ($status == 0) {
> Sympa::Log::Syslog::do_log('err',
> 'Failed to remove aliases ; status %d : %s',
> - $status, $!);
> + $status, $ERRNO);
> return undef;
> }
>
> @@ -11302,7 +11303,7 @@
>
> unless (mkdir($dir, 0777)) {
> Sympa::Log::Syslog::do_log('err', 'unable to create %s : %s',
> - $dir, $!);
> + $dir, $ERRNO);
> return undef;
> }
>
> @@ -12358,10 +12359,10 @@
> return undef unless $l;
>
> eval { $config = Storable::thaw($l->{'config'}) };
> - if ($@ or !defined $config) {
> + if ($EVAL_ERROR or !defined $config) {
> Sympa::Log::Syslog::do_log('err',
> 'Unable to deserialize binary config of %s: %s',
> - $self, $@ || 'possible format error');
> + $self, $EVAL_ERROR || 'possible format error');
> return undef;
> }
>
> @@ -12388,10 +12389,10 @@
> ## Load a binary version of the data structure
> ## unless config is more recent than config.bin
> eval { $config = Storable::retrieve($self->dir . '/config.bin') };
> - if ($@ or !defined $config) {
> + if ($EVAL_ERROR or !defined $config) {
> Sympa::Log::Syslog::do_log(
> - 'err', 'Unable to deserialize config.bin of %s: $@',
> - $self, $@ || 'possible format error'
> + 'err', 'Unable to deserialize config.bin of %s:
> $EVAL_ERROR',
> + $self, $EVAL_ERROR || 'possible format error'
> );
> $lock->unlock();
> return undef;
> @@ -12435,11 +12436,11 @@
> }
>
> eval { Storable::store($self->config, $self->dir . '/config.bin')
> };
> - if ($@) {
> + if ($EVAL_ERROR) {
> Sympa::Log::Syslog::do_log(
> 'err',
> 'Failed to save the binary config %s. error: %s',
> - $self->dir . '/config.bin', $@
> + $self->dir . '/config.bin', $EVAL_ERROR
> );
> $lock->unlock;
> return undef;
> @@ -12481,9 +12482,9 @@
> ## $self->latest_instantiation->{'email'};
>
> eval { $config = Storable::nfreeze($self->config); };
> - if ($@) {
> + if ($EVAL_ERROR) {
> Sympa::Log::Syslog::do_log('err',
> - 'Failed to save the config to database. error: %s', $@);
> + 'Failed to save the config to database. error: %s',
> $EVAL_ERROR);
> return undef;
> }
>
> Modified: trunk/src/lib/Sympa/Lock.pm (10313 => 10314)
> --- trunk/src/lib/Sympa/Lock.pm 2014-02-28 16:19:49 UTC (rev 10313)
> +++ trunk/src/lib/Sympa/Lock.pm 2014-02-28 16:23:04 UTC (rev 10314)
> @@ -25,6 +25,7 @@
>
> use strict;
> use warnings;
> +use English qw(-no_match_vars);
> use Carp qw(croak);
> use Fcntl qw(LOCK_SH LOCK_EX LOCK_NB LOCK_UN);
> use FileHandle;
> @@ -48,7 +49,7 @@
> unless (-f $lock_filename) {
> unless (open $fh, ">>$lock_filename") {
> Sympa::Log::Syslog::do_log('err', 'Cannot open %s: %s',
> - $lock_filename, $!);
> + $lock_filename, $ERRNO);
> return undef;
> }
> close $fh;
> @@ -306,7 +307,7 @@
> my $fh;
> unless (open $fh, $open_mode, $lock_file) {
> Sympa::Log::Syslog::do_log('err', 'Cannot open %s: %s',
> - $lock_file, $!);
> + $lock_file, $ERRNO);
> return undef;
> }
>
> @@ -327,13 +328,13 @@
> $lock_file);
> unless (unlink $lock_file) {
> Sympa::Log::Syslog::do_log('err', 'Cannot remove %s: %s',
> - $lock_file, $!);
> + $lock_file, $ERRNO);
> return undef;
> }
>
> unless (open $fh, '>', $lock_file) {
> Sympa::Log::Syslog::do_log('err', 'Cannot open %s: %s',
> - $lock_file, $!);
> + $lock_file, $ERRNO);
> return undef;
> }
> }
> @@ -358,11 +359,11 @@
>
> ## Keep track of the locking PID
> if ($mode eq 'write') {
> - print $fh "$$\n";
> + print $fh "$PID\n";
> }
> } else {
> Sympa::Log::Syslog::do_log('err', 'Failed locking %s: %s',
> - $lock_file, $!);
> + $lock_file, $ERRNO);
> return undef;
> }
>
> @@ -377,7 +378,7 @@
>
> unless (flock($fh, LOCK_UN)) {
> Sympa::Log::Syslog::do_log('err', 'Failed UNlocking %s: %s',
> - $lock_file, $!);
> + $lock_file, $ERRNO);
> return undef;
> }
> close $fh;
> @@ -420,7 +421,7 @@
> $FH = FileHandle->new();
> unless (open $FH, $open_mode, $lock_file) {
> Sympa::Log::Syslog::do_log('err', 'Cannot open %s: %s',
> - $lock_file, $!);
> + $lock_file, $ERRNO);
> return undef;
> }
>
> @@ -429,7 +430,7 @@
> return ($FH, $nfs_lock);
> } else {
> Sympa::Log::Syslog::do_log('err', 'Failed locking %s: %s',
> - $lock_file, $!);
> + $lock_file, $ERRNO);
> return undef;
> }
>
> @@ -445,7 +446,7 @@
>
> unless (defined $nfs_lock and $nfs_lock->unlock()) {
> Sympa::Log::Syslog::do_log('err', 'Failed UNlocking %s: %s',
> - $lock_file, $!);
> + $lock_file, $ERRNO);
> return undef;
> }
> close $fh;
> Modified: trunk/src/lib/Sympa/Log.pm (10313 => 10314)
> --- trunk/src/lib/Sympa/Log.pm 2014-02-28 16:19:49 UTC (rev 10313)
> +++ trunk/src/lib/Sympa/Log.pm 2014-02-28 16:23:04 UTC (rev 10314)
> @@ -24,6 +24,7 @@
> package Sympa::Log;
>
> use strict;
> +use English qw(-no_match_vars);
>
> #use Carp; # currently not used
> #use Encode; # not used
> @@ -71,15 +72,15 @@
> ##
> sub fatal_err {
> my $m = shift;
> - my $errno = $!;
> + my $errno = $ERRNO;
>
> eval {
> syslog('err', $m, @_);
> syslog('err', "Exiting.");
> };
> - if ($@ && ($warning_date < time - $warning_timeout)) {
> + if ($EVAL_ERROR && ($warning_date < time - $warning_timeout)) {
> $warning_date = time + $warning_timeout;
> - unless (Sympa::Site->send_notify_to_listmaster('logs_failed',
> [$@])) {
> + unless (Sympa::Site->send_notify_to_listmaster('logs_failed',
> [$EVAL_ERROR])) {
> print STDERR "No logs available, can't send warning message";
> }
> }
> @@ -113,7 +114,7 @@
> my $message = shift;
> my @param = ();
>
> - my $errno = $!;
> + my $errno = $ERRNO;
>
> ## Do not display variables which are references.
> my @n = ($message =~ /(%[^%])/g);
> @@ -206,9 +207,9 @@
> }
> };
>
> - if ($@ && ($warning_date < time - $warning_timeout)) {
> + if ($EVAL_ERROR && ($warning_date < time - $warning_timeout)) {
> $warning_date = time + $warning_timeout;
> - Sympa::Site->send_notify_to_listmaster('logs_failed', [$@]);
> + Sympa::Site->send_notify_to_listmaster('logs_failed',
> [$EVAL_ERROR]);
> }
> }
>
> @@ -234,10 +235,10 @@
> # close log may be usefull : if parent processus did open log child
> # process inherit the openlog with parameters from parent process
> closelog;
> - eval { openlog("$log_service\[$$\]", 'ndelay,nofatal', $log_facility)
> };
> - if ($@ && ($warning_date < time - $warning_timeout)) {
> + eval { openlog("$log_service\[$PID\]", 'ndelay,nofatal',
> $log_facility) };
> + if ($EVAL_ERROR && ($warning_date < time - $warning_timeout)) {
> $warning_date = time + $warning_timeout;
> - unless (Sympa::Site->send_notify_to_listmaster('logs_failed',
> [$@])) {
> + unless (Sympa::Site->send_notify_to_listmaster('logs_failed',
> [$EVAL_ERROR])) {
> print STDERR "No logs available, can't send warning message";
> }
> }
> Modified: trunk/src/lib/Sympa/Mail.pm (10313 => 10314)
> --- trunk/src/lib/Sympa/Mail.pm 2014-02-28 16:19:49 UTC (rev 10313)
> +++ trunk/src/lib/Sympa/Mail.pm 2014-02-28 16:23:04 UTC (rev 10314)
> @@ -25,6 +25,7 @@
>
> use strict;
> use warnings;
> +use English qw(-no_match_vars);
> require Exporter;
> use Carp qw(carp croak);
> use POSIX;
> @@ -51,7 +52,7 @@
> my $fh = 'fh0000000000'; ## File handle for the stream.
>
> my $max_arg = eval { POSIX::_SC_ARG_MAX; };
> -if ($@) {
> +if ($EVAL_ERROR) {
> $max_arg = 4096;
> printf STDERR gettext(
> "Your system does not conform to the POSIX P1003.1 standard,
> or\nyour Perl system does not define the _SC_ARG_MAX constant in its
> POSIX\nlibrary. You must modify the smtp.pm module in order to set a
> value\nfor variable %s.\n"
> @@ -905,7 +906,7 @@
> *OUT = ++$fh;
>
> if (!pipe(IN, OUT)) {
> - croak sprintf('Unable to create a channel in smtpto: %s', "$!");
> + croak sprintf('Unable to create a channel in smtpto: %s', $ERRNO);
> ## No return
> }
> $pid = Sympa::Tools::safefork();
> @@ -1030,7 +1031,7 @@
> $msg = $message;
> } else {
> eval { $msg = $parser->parse_data($message); };
> - if ($@) {
> + if ($EVAL_ERROR) {
> Sympa::Log::Syslog::do_log('err',
> "Sympa::Mail::reformat_message: Failed to parse MIME
> data");
> return undef;
> @@ -1067,7 +1068,7 @@
> my $data = shift @{$attachments};
> if (ref($data) ne 'MIME::Entity') {
> eval { $data = $parser->parse_data($data); };
> - if ($@) {
> + if ($EVAL_ERROR) {
> Sympa::Log::Syslog::do_log('notice',
> "Failed to parse MIME data");
> $data = $parser->parse_data('');
> @@ -1128,7 +1129,7 @@
>
> unless (defined $io) {
> Sympa::Log::Syslog::do_log('err',
> - "Sympa::Mail::reformat_message: Failed to save message :
> $!");
> + "Sympa::Mail::reformat_message: Failed to save message :
> $ERRNO");
> return undef;
> }
>
> Modified: trunk/src/lib/Sympa/Marc/Search.pm (10313 => 10314)
> --- trunk/src/lib/Sympa/Marc/Search.pm 2014-02-28 16:19:49 UTC (rev
> 10313)
> +++ trunk/src/lib/Sympa/Marc/Search.pm 2014-02-28 16:23:04 UTC (rev
> 10314)
> @@ -6,6 +6,7 @@
>
> use strict;
>
> +use English qw(-no_match_vars);
> use File::Find;
> use HTML::Entities qw(decode_entities encode_entities);
> use Encode qw(decode_utf8 encode_utf8 is_utf8);
> @@ -284,7 +285,7 @@
> my ($subj, $from, $date, $id, $body_ref);
> unless (open FH, '<:encoding(utf8)', $file) {
>
> - # $self->error("Couldn't open file
> $file, $!");
> + # $self->error("Couldn't open file
> $file, $ERRNO");
> }
>
> # Need this loop because newer versions of MHonArc put a version
> @@ -360,7 +361,7 @@
> }
> unless (close FH) {
>
> - # $self->error("Couldn't close file $file, $!");
> + # $self->error("Couldn't close file $file, $ERRNO");
> }
>
> # Decode entities
> @@ -426,7 +427,7 @@
> }
> $code .= "}\n";
> my $function = eval $code;
> - die "bad pattern: $@" if $@;
> + die "bad pattern: $EVAL_ERROR" if $EVAL_ERROR;
> return $function;
> }
>
> @@ -460,7 +461,7 @@
>
> # print "<PRE>$code</pre>"; # used for debugging
> my $function = eval $code;
> - die "bad pattern: $@" if $@;
> + die "bad pattern: $EVAL_ERROR" if $EVAL_ERROR;
> return $function;
> }
>
> @@ -477,7 +478,7 @@
> }
> my $code = "sub { use utf8; /" . join("$sep", @_) . $tail;
> my $function = eval $code;
> - die "bad pattern: $@" if $@;
> + die "bad pattern: $EVAL_ERROR" if $EVAL_ERROR;
> return $function;
> }
>
> @@ -488,7 +489,7 @@
> $string = '(?i)' . $string if ($self->case);
> my $code = "sub { use utf8; /" . $string . "/ }";
> my $function = eval $code;
> - die "bad pattern: $@" if $@;
> + die "bad pattern: $EVAL_ERROR" if $EVAL_ERROR;
> return $function;
> }
>
> Modified: trunk/src/lib/Sympa/Message.pm (10313 => 10314)
> --- trunk/src/lib/Sympa/Message.pm 2014-02-28 16:19:49 UTC (rev 10313)
> +++ trunk/src/lib/Sympa/Message.pm 2014-02-28 16:23:04 UTC (rev 10314)
> @@ -44,6 +44,7 @@
>
> use strict;
> use warnings;
> +use English qw(-no_match_vars);
> use Carp qw(croak);
> use HTML::Entities qw(encode_entities);
> use Mail::Address;
> @@ -188,10 +189,10 @@
> unless (open $fh, '<', $datas->{'file'}) {
> Sympa::Log::Syslog::do_log('err',
> 'Cannot open message file %s : %s',
> - $datas->{'file'}, $!);
> + $datas->{'file'}, $ERRNO);
> return undef;
> }
> - local $/;
> + local $RS;
> $messageasstring = <$fh>;
> close $fh;
> } elsif ($datas->{'messageasstring'}) {
> @@ -962,7 +963,7 @@
> my $io = $bodyh->open("w");
> unless (defined $io) {
> Sympa::Log::Syslog::do_log('err', 'Failed to save message :
> %s',
> - $!);
> + $ERRNO);
> return undef;
> }
> $io->print($filtered_body);
> @@ -1008,8 +1009,8 @@
> return undef;
> }
>
> - my $temporary_file = Sympa::Site->tmpdir . "/" . $list->get_list_id()
> . "." . $$;
> - my $temporary_pwd = Sympa::Site->tmpdir . '/pass.' . $$;
> + my $temporary_file = Sympa::Site->tmpdir . "/" . $list->get_list_id()
> . "." . $PID;
> + my $temporary_pwd = Sympa::Site->tmpdir . '/pass.' . $PID;
>
> ## dump the incoming message.
> if (!open(MSGDUMP, "> $temporary_file")) {
> @@ -1063,7 +1064,7 @@
> $self->{'decrypted_msg_as_string'} .= $_;
> }
> close NEWMSG;
> - my $status = $? >> 8;
> + my $status = $CHILD_ERROR >> 8;
> if ($status) {
> Sympa::Log::Syslog::do_log(
> 'err', 'Unable to decrypt S/MIME message: (%d) %s',
> @@ -1153,7 +1154,7 @@
> }
> }
> if (-r $usercert) {
> - my $temporary_file = Sympa::Site->tmpdir . "/" . $email . "." . $$;
> + my $temporary_file = Sympa::Site->tmpdir . "/" . $email . "." .
> $PID;
>
> ## encrypt the incoming message parse it.
> my $cmd = sprintf '%s smime -encrypt -out %s -des3 %s',
> @@ -1182,7 +1183,7 @@
> }
> ##$self->get_mime_message->bodyhandle->print(\*MSGDUMP);
> close MSGDUMP;
> - my $status = $? >> 8;
> + my $status = $CHILD_ERROR >> 8;
> if ($status) {
> Sympa::Log::Syslog::do_log(
> 'err', 'Unable to S/MIME encrypt message: (%d) %s',
> @@ -1250,8 +1251,8 @@
> Sympa::Log::Syslog::do_log('debug2', '(%s, list=%s)', $self, $list);
>
> my ($cert, $key) = Sympa::Tools::smime_find_keys($list->dir, 'sign');
> - my $temporary_file = Sympa::Site->tmpdir . '/' . $list->get_id . "." .
> $$;
> - my $temporary_pwd = Sympa::Site->tmpdir . '/pass.' . $$;
> + my $temporary_file = Sympa::Site->tmpdir . '/' . $list->get_id . "." .
> $PID;
> + my $temporary_pwd = Sympa::Site->tmpdir . '/pass.' . $PID;
>
> my ($signed_msg, $pass_option);
> $pass_option = "-passin file:$temporary_pwd" if
> (Sympa::Site->key_passwd ne '');
> @@ -1352,10 +1353,10 @@
>
> my $verify;
>
> - ## first step is the msg signing OK ; /tmp/sympa-smime.$$ is created
> + ## first step is the msg signing OK ; /tmp/sympa-smime.$PID is created
> ## to store the signer certificat for step two. I known, that's dirty.
>
> - my $temporary_file = Sympa::Site->tmpdir . "/" . 'smime-sender.' .
> $$;
> + my $temporary_file = Sympa::Site->tmpdir . "/" . 'smime-sender.' .
> $PID;
> my $trusted_ca_options = '';
> $trusted_ca_options = "-CAfile " . Sympa::Site->cafile . " " if
> Sympa::Site->cafile;
> $trusted_ca_options .= "-CApath " . Sympa::Site->capath . " " if
> Sympa::Site->capath;
> @@ -1366,7 +1367,7 @@
> unless (open MSGDUMP, "| $cmd > /dev/null") {
> Sympa::Log::Syslog::do_log('err',
> 'Unable to run command %s to check signature from %s: %s',
> - $cmd, $message->{'sender'}, $!);
> + $cmd, $message->{'sender'}, $ERRNO);
> return undef;
> }
>
> @@ -1374,7 +1375,7 @@
> print MSGDUMP "\n";
> print MSGDUMP $message->get_message_as_string;
> close MSGDUMP;
> - my $status = $? >> 8;
> + my $status = $CHILD_ERROR >> 8;
> if ($status) {
> Sympa::Log::Syslog::do_log(
> 'err', 'Unable to check S/MIME signature: (%d) %s',
> @@ -1421,8 +1422,8 @@
> ## are also included), and look at the purpose:
> ## "S/MIME signing : Yes/No"
> ## "S/MIME encryption : Yes/No"
> - my $certbundle = Sympa::Site->tmpdir . "/certbundle.$$";
> - my $tmpcert = Sympa::Site->tmpdir . "/cert.$$";
> + my $certbundle = Sympa::Site->tmpdir . "/certbundle.$PID";
> + my $tmpcert = Sympa::Site->tmpdir . "/cert.$PID";
> my $nparts = $message->get_mime_message->parts;
> my $extracted = 0;
> Sympa::Log::Syslog::do_log('debug3', 'smime_sign_check: parsing %d
> parts',
> @@ -1446,7 +1447,7 @@
>
> unless (open(BUNDLE, $certbundle)) {
> Sympa::Log::Syslog::do_log('err', "Can't open cert bundle %s: %s",
> - $certbundle, $!);
> + $certbundle, $ERRNO);
> return undef;
> }
>
> @@ -1460,7 +1461,7 @@
> $cert = '';
> unless (open(CERT, ">$tmpcert")) {
> Sympa::Log::Syslog::do_log('err', "Can't create %s: %s",
> - $tmpcert, $!);
> + $tmpcert, $ERRNO);
> return undef;
> }
> print CERT $workcert;
> @@ -1528,7 +1529,7 @@
> unless (open(CERT, ">$fn")) {
> Sympa::Log::Syslog::do_log('err',
> 'Unable to create certificate file %s: %s',
> - $fn, $!);
> + $fn, $ERRNO);
> return undef;
> }
> print CERT $certs{$c};
> @@ -1832,7 +1833,7 @@
> if ($header =~ /\.mime$/) {
> my $header_part;
> eval { $header_part = $parser->parse_in($header); };
> - if ($@) {
> + if ($EVAL_ERROR) {
> Sympa::Log::Syslog::do_log('err',
> 'Failed to parse MIME data %s: %s',
> $header, $parser->last_error);
> @@ -1857,7 +1858,7 @@
> if ($footer =~ /\.mime$/) {
> my $footer_part;
> eval { $footer_part = $parser->parse_in($footer); };
> - if ($@) {
> + if ($EVAL_ERROR) {
> Sympa::Log::Syslog::do_log('err',
> 'Failed to parse MIME data %s: %s',
> $footer, $parser->last_error);
> @@ -1939,7 +1940,7 @@
> $io = $bodyh->open('w');
> unless (defined $io) {
> Sympa::Log::Syslog::do_log('err',
> - 'Failed to save message: %s', "$!");
> + 'Failed to save message: %s', $ERRNO);
> return undef;
> }
> $io->print($body);
> @@ -2016,7 +2017,7 @@
> $header_msg = Encode::decode_utf8($header_msg, 1);
> $footer_msg = Encode::decode_utf8($footer_msg, 1);
> };
> - return undef if $@;
> + return undef if $EVAL_ERROR;
>
> my $new_body;
> if ($eff_type eq 'text/plain') {
> @@ -2070,7 +2071,7 @@
>
> ## Only encodable footer/header are allowed.
> eval { $new_body = $cset->encode($new_body, 1); };
> - return undef if $@;
> + return undef if $EVAL_ERROR;
>
> return $new_body;
> }
> @@ -2176,7 +2177,7 @@
>
> ## Only decodable bodies are allowed.
> eval { $utf8_body = Encode::encode_utf8($in_cset->decode($body,
> 1)); };
> - if ($@) {
> + if ($EVAL_ERROR) {
> Sympa::Log::Syslog::do_log('err', 'Cannot decode by charset
> "%s"',
> $charset);
> return undef;
> @@ -2219,7 +2220,7 @@
> and $io->print($body)
> and $io->close) {
> Sympa::Log::Syslog::do_log('err', 'Can\'t write in Entity: %s',
> - $!);
> + $ERRNO);
> return undef;
> }
> $entity->sync_headers(Length => 'COMPUTE')
> Modified: trunk/src/lib/Sympa/ModDef.pm (10313 => 10314)
> --- trunk/src/lib/Sympa/ModDef.pm 2014-02-28 16:19:49 UTC (rev 10313)
> +++ trunk/src/lib/Sympa/ModDef.pm 2014-02-28 16:23:04 UTC (rev 10314)
> @@ -35,6 +35,8 @@
>
> use strict;
>
> +use English qw(-no_match_vars);
> +
> ## This defines the modules :
> ## required_version : Minimum version of package.
> ## Assume required_version = 1.0 if not specified.
> Modified: trunk/src/lib/Sympa/PlainDigest.pm (10313 => 10314)
> --- trunk/src/lib/Sympa/PlainDigest.pm 2014-02-28 16:19:49 UTC (rev
> 10313)
> +++ trunk/src/lib/Sympa/PlainDigest.pm 2014-02-28 16:23:04 UTC (rev
> 10314)
> @@ -81,6 +81,8 @@
>
> package Sympa::PlainDigest;
>
> +use English qw(-no_match_vars);
> +
> @ISA = qw(MIME::Entity);
> use Mail::Internet;
> use Mail::Address;
> @@ -244,7 +246,7 @@
> $charset->encoder('utf8');
> $thispart = $charset->encode($thispart);
> };
> - if ($@) {
> + if ($EVAL_ERROR) {
>
> # mmm, what to do if it fails?
> $outstring .= sprintf gettext(
> @@ -324,7 +326,7 @@
> $tree->delete();
> $text = Encode::encode_utf8($text);
> };
> - if ($@) {
> + if ($EVAL_ERROR) {
> $outstring .=
> gettext("\n[** Unable to process HTML message part **]\n");
> return 1;
> Modified: trunk/src/lib/Sympa/SQLSource.pm (10313 => 10314)
> --- trunk/src/lib/Sympa/SQLSource.pm 2014-02-28 16:19:49 UTC (rev 10313)
> +++ trunk/src/lib/Sympa/SQLSource.pm 2014-02-28 16:23:04 UTC (rev 10314)
> @@ -25,6 +25,7 @@
>
> use strict;
>
> +use English qw(-no_match_vars);
> use Carp;
> use Sympa::Log;
>
> @@ -60,7 +61,7 @@
> if ($param->{'db_type'} =~ /^mysql$/i) {
> unless (eval "require Sympa::DBManipulatorMySQL") {
> Sympa::Log::Syslog::do_log('err',
> - "Unable to use Sympa::DBManipulatorMySQL module: $@");
> + "Unable to use Sympa::DBManipulatorMySQL module:
> $EVAL_ERROR");
> return undef;
> }
> require Sympa::DBManipulatorMySQL;
> @@ -654,11 +655,11 @@
> alarm 0;
> return $status;
> };
> - if ($@ eq "TIMEOUT\n") {
> + if ($EVAL_ERROR eq "TIMEOUT\n") {
> Sympa::Log::Syslog::do_log('err',
> 'Fetch timeout on remote SQL database');
> return undef;
> - } elsif ($@) {
> + } elsif ($EVAL_ERROR) {
> Sympa::Log::Syslog::do_log('err',
> 'Fetch failed on remote SQL database');
> return undef;
> Modified: trunk/src/lib/Sympa/Scenario.pm (10313 => 10314)
> --- trunk/src/lib/Sympa/Scenario.pm 2014-02-28 16:19:49 UTC (rev 10313)
> +++ trunk/src/lib/Sympa/Scenario.pm 2014-02-28 16:23:04 UTC (rev 10314)
> @@ -26,6 +26,7 @@
> use strict;
> use warnings;
>
> +use English qw(-no_match_vars);
> use Carp qw(croak);
> use Cwd;
> use File::Spec;
> @@ -1362,9 +1363,9 @@
> }
> };
> }
> - if ($@) {
> + if ($EVAL_ERROR) {
> Sympa::Log::Syslog::do_log('err', 'cannot evaluate match: %s',
> - $@);
> + $EVAL_ERROR);
> return undef;
> }
> if ($r) {
> @@ -1860,16 +1861,16 @@
> Sympa::Log::Syslog::do_log('notice', 'Use module %s for custom
> condition',
> $file);
> eval { require "$file"; };
> - if ($@) {
> + if ($EVAL_ERROR) {
> Sympa::Log::Syslog::do_log('err', 'Error requiring %s : %s (%s)',
> - $condition, "$@", ref($@));
> + $condition, "$EVAL_ERROR", ref($EVAL_ERROR));
> return undef;
> }
> my $res;
> eval "\$res = CustomCondition::${condition}::verify(\@{\$args_ref});";
> - if ($@) {
> + if ($EVAL_ERROR) {
> Sympa::Log::Syslog::do_log('err', 'Error evaluating %s : %s (%s)',
> - $condition, "$@", ref($@));
> + $condition, "$EVAL_ERROR", ref($EVAL_ERROR));
> return undef;
> }
>
> Modified: trunk/src/lib/Sympa/SharedDocument.pm (10313 => 10314)
> --- trunk/src/lib/Sympa/SharedDocument.pm 2014-02-28 16:19:49 UTC (rev
> 10313)
> +++ trunk/src/lib/Sympa/SharedDocument.pm 2014-02-28 16:23:04 UTC (rev
> 10314)
> @@ -25,6 +25,8 @@
>
> use strict;
>
> +use English qw(-no_match_vars);
> +
> #use Carp; # currently not used
> #use POSIX; # no longer used
>
> @@ -239,7 +241,7 @@
> Sympa::Log::Syslog::do_log(
> 'err',
> "SharedDocument::new() : cannot open %s : %s",
> - $document->{'absolute_path'}, $!
> + $document->{'absolute_path'}, $ERRNO
> );
> return undef;
> }
> Modified: trunk/src/lib/Sympa/Spool.pm (10313 => 10314)
> --- trunk/src/lib/Sympa/Spool.pm 2014-02-28 16:19:49 UTC (rev 10313)
> +++ trunk/src/lib/Sympa/Spool.pm 2014-02-28 16:23:04 UTC (rev 10314)
> @@ -25,6 +25,8 @@
>
> use strict;
>
> +use English qw(-no_match_vars);
> +
> #use Carp; # not yet used
> #require Encode; # not used
> use Exporter;
> @@ -210,7 +212,7 @@
> }
> $sql_where =~ s/^\s*AND//;
>
> - my $lock = $$ . '@' . hostname();
> + my $lock = $PID . '@' . hostname();
> my $epoch = time; # should we use milli or nano
> seconds ?
>
> push @sth_stack, $sth;
> @@ -558,7 +560,7 @@
> $insertpart2 .= ', ?';
> push @insertparts, $metadata->{$meta};
> }
> - my $lock = $$ . '@' . hostname();
> + my $lock = $PID . '@' . hostname();
>
> push @sth_stack, $sth;
>
> Modified: trunk/src/lib/Sympa/TaskInstruction.pm (10313 => 10314)
> --- trunk/src/lib/Sympa/TaskInstruction.pm 2014-02-28 16:19:49 UTC (rev
> 10313)
> +++ trunk/src/lib/Sympa/TaskInstruction.pm 2014-02-28 16:23:04 UTC (rev
> 10314)
> @@ -25,6 +25,7 @@
>
> use strict;
>
> +use English qw(-no_match_vars);
> #use Carp; # not yet used
> #use Digest::MD5; # no longer used
> #use Exporter; # not used
> @@ -719,15 +720,15 @@
>
> system($file);
>
> - if ($? != 0) {
> + if ($CHILD_ERROR != 0) {
> my $message;
> - if ($? == -1) {
> - $message = "Failed to execute: $!";
> - } elsif ($? & 127) {
> + if ($CHILD_ERROR == -1) {
> + $message = "Failed to execute: $ERRNO";
> + } elsif ($CHILD_ERROR & 127) {
> $message = sprintf 'Child died with signal %d, %s coredump',
> - ($? & 127), ($? & 128) ? 'with' : 'without';
> + ($CHILD_ERROR & 127), ($CHILD_ERROR & 128) ? 'with' :
> 'without';
> } else {
> - $message = sprintf 'Child exited with value %d', $? >> 8;
> + $message = sprintf 'Child exited with value %d', $CHILD_ERROR
> >> 8;
> }
> $self->error(
> {'task' => $task, 'type' => 'execution', 'message' =>
> $message});
> Modified: trunk/src/lib/Sympa/Template.pm (10313 => 10314)
> --- trunk/src/lib/Sympa/Template.pm 2014-02-28 16:19:49 UTC (rev 10313)
> +++ trunk/src/lib/Sympa/Template.pm 2014-02-28 16:23:04 UTC (rev 10314)
> @@ -25,6 +25,7 @@
>
> use strict;
> use warnings;
> +use English; # FIXME: drop $MATCH usage
> use CGI::Util;
> use MIME::EncWords;
> use Template;
> @@ -56,14 +57,14 @@
>
> my $string = shift;
>
> - $string =~ s/[\s+]/sprintf('%%%02x', ord($&))/eg;
> + $string =~ s/[\s+]/sprintf('%%%02x', ord($MATCH))/eg;
>
> # Some MUAs aren't able to decode ``%40'' (escaped ``@'') in e-mail
> # address of mailto: URL, or take ``@'' in query component for a
> # delimiter to separate URL from the rest.
> my ($body, $query) = split(/\?/, $string, 2);
> if (defined $query) {
> - $query =~ s/\@/sprintf('%%%02x', ord($&))/eg;
> + $query =~ s/\@/sprintf('%%%02x', ord($MATCH))/eg;
> $string = $body . '?' . $query;
> }
>
> @@ -112,7 +113,7 @@
> ## FB_CROAK is used instead of FB_WARN to pass $string intact to
> ## succeeding processes it operation fails
> eval { $string = Encode::decode('utf8', $string,
> Encode::FB_CROAK); };
> - $@ = '';
> + $EVAL_ERROR = '';
> }
>
> return $string;
> Modified: trunk/src/lib/Sympa/TimeUtils.pm (10313 => 10314)
> --- trunk/src/lib/Sympa/TimeUtils.pm 2014-02-28 16:19:49 UTC (rev 10313)
> +++ trunk/src/lib/Sympa/TimeUtils.pm 2014-02-28 16:23:04 UTC (rev 10314)
> @@ -19,6 +19,7 @@
>
> ##---------------------------------------------------------------------------##
> package Sympa::TimeUtils;
>
> +use English qw(-no_match_vars);
>
> ##---------------------------------------------------------------------------##
> ## Date variables for date routines
> ##
> @@ -96,7 +97,7 @@
> POSIXMODCHK: {
> last POSIXMODCHK unless $POSIXstrftime;
> eval { require POSIX; };
> - last POSIXMODCHK if ($@) || !defined(POSIX::strftime);
> + last POSIXMODCHK if ($EVAL_ERROR) || !defined(POSIX::strftime);
> return POSIX::strftime($fmt, $sec,$min,$hour,$mday,$mon,$year,
> $wday,$yday,$isdst);
> }
> Modified: trunk/src/lib/Sympa/Tools.pm (10313 => 10314)
> --- trunk/src/lib/Sympa/Tools.pm 2014-02-28 16:19:49 UTC (rev 10313)
> +++ trunk/src/lib/Sympa/Tools.pm 2014-02-28 16:23:04 UTC (rev 10314)
> @@ -24,6 +24,7 @@
> package Sympa::Tools;
>
> use strict;
> +use English; # FIXME: drop $MATCH usage
> use Carp qw(croak);
> use Time::Local;
> use File::Find;
> @@ -125,14 +126,14 @@
> unless (chown($uid, $gid, $param{'file'})) {
> Sympa::Log::Syslog::do_log('err',
> "Can't give ownership of file %s to %s.%s: %s",
> - $param{'file'}, $param{'user'}, $param{'group'}, "$!");
> + $param{'file'}, $param{'user'}, $param{'group'}, $ERRNO);
> return undef;
> }
> if ($param{'mode'}) {
> unless (chmod($param{'mode'}, $param{'file'})) {
> Sympa::Log::Syslog::do_log('err',
> "Can't change rights of file %s to %o: %s",
> - $param{'file'}, $param{'mode'}, "$!");
> + $param{'file'}, $param{'mode'}, $ERRNO);
> return undef;
> }
> }
> @@ -347,7 +348,7 @@
> my ($pid) = fork;
> return $pid if (defined($pid));
>
> - $err = "$!";
> + $err = $ERRNO;
> Sympa::Log::Syslog::do_log('warn',
> 'Cannot create new process in safefork: %s', $err);
> ## FIXME:should send a mail to the listmaster
> @@ -588,14 +589,14 @@
> unless (rmdir $dir) {
> Sympa::Log::Syslog::do_log('err',
> 'Unable to delete directory %s: %s',
> - $dir, "$!");
> + $dir, $ERRNO);
> }
> } else {
> Sympa::Log::Syslog::do_log(
> 'err',
> 'Unable to open directory %s to delete the files it contains:
> %s',
> $dir,
> - "$!"
> + $ERRNO
> );
> }
> }
> @@ -887,7 +888,7 @@
> return undef;
> }
>
> - my $temporary_file = Sympa::Site->tmpdir . "/dkim." . $$;
> + my $temporary_file = Sympa::Site->tmpdir . "/dkim." . $PID;
> if (!open(MSGDUMP, "> $temporary_file")) {
> Sympa::Log::Syslog::do_log('err', 'Can\'t store message in file
> %s',
> $temporary_file);
> @@ -999,7 +1000,7 @@
> return $msg_as_string;
> }
>
> - my $temporary_keyfile = Sympa::Site->tmpdir . "/dkimkey." . $$;
> + my $temporary_keyfile = Sympa::Site->tmpdir . "/dkimkey." . $PID;
> if (!open(MSGDUMP, "> $temporary_keyfile")) {
> Sympa::Log::Syslog::do_log('err', 'Can\'t store key in file %s',
> $temporary_keyfile);
> @@ -1044,7 +1045,7 @@
> Sympa::Log::Syslog::do_log('err', 'Can\'t create
> Mail::DKIM::Signer');
> return ($msg_as_string);
> }
> - my $temporary_file = Sympa::Site->tmpdir . "/dkim." . $$;
> + my $temporary_file = Sympa::Site->tmpdir . "/dkim." . $PID;
> if (!open(MSGDUMP, "> $temporary_file")) {
> Sympa::Log::Syslog::do_log('err', 'Can\'t store message in file
> %s',
> $temporary_file);
> @@ -1361,7 +1362,7 @@
> return $cipher if defined $cipher;
>
> eval { require Crypt::CipherSaber; };
> - unless ($@) {
> + unless ($EVAL_ERROR) {
> $cipher = Crypt::CipherSaber->new(Sympa::Site->cookie);
> } else {
> $cipher = '';
> @@ -1518,7 +1519,7 @@
> ## Store body in file
> unless (open OFILE, ">$dir/$pathname.$fileExt") {
> Sympa::Log::Syslog::do_log('err', 'Unable to create %s/%s.%s:
> %s',
> - $dir, $pathname, $fileExt, "$!");
> + $dir, $pathname, $fileExt, $ERRNO);
> return undef;
> }
>
> @@ -1620,7 +1621,7 @@
> }
> close ANTIVIR;
>
> - my $status = $? >> 8;
> + my $status = $CHILD_ERROR >> 8;
>
> ## uvscan status =12 or 13 (*256) => virus
> if (($status == 13) || ($status == 12)) {
> @@ -1655,7 +1656,7 @@
> }
> close ANTIVIR;
>
> - my $status = $? >> 8;
> + my $status = $CHILD_ERROR >> 8;
>
> ## uvscan status = 1 | 2 (*256) => virus
> if ((($status == 1) or ($status == 2)) and not($virusfound)) {
> @@ -1664,7 +1665,7 @@
>
> ## F-Secure
> } elsif (Sympa::Site->antivirus_path =~ /\/fsav$/) {
> - my $dbdir = $`;
> + my $dbdir = $PREMATCH;
>
> # impossible to look for viruses with no option set
> unless (Sympa::Site->antivirus_args) {
> @@ -1685,7 +1686,7 @@
>
> close ANTIVIR;
>
> - my $status = $? >> 8;
> + my $status = $CHILD_ERROR >> 8;
>
> ## fsecure status =3 (*256) => virus
> if (($status == 3) and not($virusfound)) {
> @@ -1706,7 +1707,7 @@
>
> close ANTIVIR;
>
> - my $status = $? >> 8;
> + my $status = $CHILD_ERROR >> 8;
>
> Sympa::Log::Syslog::do_log('debug2', 'Status: ' . $status);
>
> @@ -1735,7 +1736,7 @@
> }
> close ANTIVIR;
>
> - my $status = $? >> 8;
> + my $status = $CHILD_ERROR >> 8;
>
> ## uvscan status =3 (*256) => virus
> if (($status >= 3) and not($virusfound)) {
> @@ -1762,7 +1763,7 @@
> }
> close ANTIVIR;
>
> - my $status = $? >> 8;
> + my $status = $CHILD_ERROR >> 8;
>
> ## sweep status =3 (*256) => virus
> if (($status == 3) and not($virusfound)) {
> @@ -1785,7 +1786,7 @@
> }
> close ANTIVIR;
>
> - my $status = $? >> 8;
> + my $status = $CHILD_ERROR >> 8;
>
> ## Clamscan status =1 (*256) => virus
> if (($status == 1) and not($virusfound)) {
> @@ -2064,7 +2065,7 @@
> unless (rename $orig_f, $new_f) {
> Sympa::Log::Syslog::do_log('err',
> 'Failed to rename %s to %s : %s',
> - $orig_f, $new_f, "$!");
> + $orig_f, $new_f, $ERRNO);
> next;
> }
> $count++;
> @@ -2077,7 +2078,7 @@
> sub dump_encoding {
> my $out = shift;
>
> - $out =~ s/./sprintf('%02x', ord($&)).' '/eg;
> + $out =~ s/./sprintf('%02x', ord($MATCH)).' '/eg;
> return $out;
> }
>
> @@ -2111,14 +2112,14 @@
> ## Release the lock
> unless (unlink $pidfile) {
> Sympa::Log::Syslog::do_log('err', 'Failed to remove %s:
> %s',
> - $pidfile, "$!");
> + $pidfile, $ERRNO);
> return undef;
> }
> } else {
> if (-f $pidfile) {
> unless (open(PFILE, '> ' . $pidfile)) {
> Sympa::Log::Syslog::do_log('err', 'Failed to open %s:
> %s',
> - $pidfile, "$!");
> + $pidfile, $ERRNO);
> return undef;
> }
> print PFILE join(' ', @pids) . "\n";
> @@ -2131,14 +2132,14 @@
> } else {
> unless (unlink $pidfile) {
> Sympa::Log::Syslog::do_log('err', 'Failed to remove %s: %s',
> - $pidfile, "$!");
> + $pidfile, $ERRNO);
> return undef;
> }
> my $err_file = Sympa::Site->tmpdir . '/' . $pid . '.stderr';
> if (-f $err_file) {
> unless (unlink $err_file) {
> Sympa::Log::Syslog::do_log('err', 'Failed to remove %s:
> %s',
> - $err_file, "$!");
> + $err_file, $ERRNO);
> return undef;
> }
> }
> @@ -2204,7 +2205,7 @@
> ## Print other PIDs + this one
> if ($options->{'multiple_process'}) {
> unless (open(PIDFILE, '> ' . $pidfile)) {
> - my $err = "$!";
> + my $err = $ERRNO;
> ## Unlock PID file
> $lock->unlock();
> croak sprintf('Could not open %s, exiting: %s', $pidfile,
> $err);
> @@ -2216,7 +2217,7 @@
> } else {
> ## Create and write the PID file
> unless (open(PIDFILE, '+>> ' . $pidfile)) {
> - my $err = "$!";
> + my $err = $ERRNO;
> ## Unlock PID file
> $lock->unlock();
> croak sprintf('Could not open %s, exiting: %s', $pidfile,
> $err);
> @@ -2234,13 +2235,13 @@
> }
>
> unless (open(PIDFILE, '> ' . $pidfile)) {
> - my $err = "$!";
> + my $err = $ERRNO;
> ## Unlock PID file
> $lock->unlock();
> croak sprintf('Could not open %s, exiting: %s', $pidfile,
> $err);
> }
> unless (truncate(PIDFILE, 0)) {
> - my $err = "$!";
> + my $err = $ERRNO;
> ## Unlock PID file
> $lock->unlock();
> croak
> @@ -2326,7 +2327,7 @@
> } else {
> $domain = $robot;
> }
> - my $id = sprintf '<sympa.%d.%d.%d@%s>', time, $$, int(rand(999)),
> $domain;
> + my $id = sprintf '<sympa.%d.%d.%d@%s>', time, $PID, int(rand(999)),
> $domain;
>
> return $id;
> }
> @@ -2447,7 +2448,7 @@
> my $ext = ($oper eq 'sign' ? 'sign' : 'enc');
>
> unless (opendir(D, $dir)) {
> - Sympa::Log::Syslog::do_log('err', "unable to opendir $dir: $!");
> + Sympa::Log::Syslog::do_log('err', "unable to opendir $dir:
> $ERRNO");
> return undef;
> }
>
> @@ -2528,7 +2529,7 @@
> @cert = ($arg->{'text'});
> } elsif ($arg->{file}) {
> unless (open(PSC, "$arg->{file}")) {
> - Sympa::Log::Syslog::do_log('err', "smime_parse_cert: open %s:
> $!",
> + Sympa::Log::Syslog::do_log('err', "smime_parse_cert: open %s:
> $ERRNO",
> $arg->{file});
> return undef;
> }
> @@ -2541,24 +2542,24 @@
> }
>
> ## Extract information from cert
> - my ($tmpfile) = Sympa::Site->tmpdir . "/parse_cert.$$";
> + my ($tmpfile) = Sympa::Site->tmpdir . "/parse_cert.$PID";
> my $cmd = sprintf '%s x509 -email -subject -purpose -noout',
> Sympa::Site->openssl;
> unless (open(PSC, "| $cmd > $tmpfile")) {
> - Sympa::Log::Syslog::do_log('err', 'open |openssl: %s', $!);
> + Sympa::Log::Syslog::do_log('err', 'open |openssl: %s', $ERRNO);
> return undef;
> }
> print PSC join('', @cert);
>
> unless (close(PSC)) {
> Sympa::Log::Syslog::do_log('err',
> - "smime_parse_cert: close openssl: $!, $@");
> + "smime_parse_cert: close openssl: $ERRNO, $EVAL_ERROR");
> return undef;
> }
>
> unless (open(PSC, "$tmpfile")) {
> Sympa::Log::Syslog::do_log('err',
> - "smime_parse_cert: open $tmpfile: $!");
> + "smime_parse_cert: open $tmpfile: $ERRNO");
> return undef;
> }
>
> @@ -2608,15 +2609,15 @@
> my $cmd = sprintf '%s pkcs7 -print_certs -inform der',
> Sympa::Site->openssl;
> unless (open(MSGDUMP, "| $cmd > $outfile")) {
> Sympa::Log::Syslog::do_log('err',
> - 'unable to run openssl pkcs7: %s', $!);
> + 'unable to run openssl pkcs7: %s', $ERRNO);
> return 0;
> }
> print MSGDUMP $mime->bodyhandle->as_string();
> close(MSGDUMP);
> - if ($?) {
> + if ($CHILD_ERROR) {
> Sympa::Log::Syslog::do_log('err',
> "openssl pkcs7 returned an error: ",
> - $? / 256);
> + $CHILD_ERROR / 256);
> return 0;
> }
> return 1;
> @@ -2977,7 +2978,7 @@
> ## Change X-Sympa-To
> unless (open FILE, $file) {
> Sympa::Log::Syslog::do_log('err', "Unable to open '%s' : %s",
> - $file, $!);
> + $file, $ERRNO);
> next;
> }
> my @content = <FILE>;
> @@ -2985,7 +2986,7 @@
>
> unless (open FILE, ">$file") {
> Sympa::Log::Syslog::do_log('err', "Unable to open '%s' : %s",
> - "$file", $!);
> + "$file", $ERRNO);
> next;
> }
> foreach (@content) {
> @@ -3157,7 +3158,7 @@
> ## Read access to prevent "Bad file number" error on Solaris
> unless (open FH, $open_mode . $lock_file) {
> Sympa::Log::Syslog::do_log('err', 'Cannot open %s: %s',
> - $lock_file, $!);
> + $lock_file, $ERRNO);
> return undef;
> }
>
> @@ -3172,13 +3173,13 @@
> $lock_file);
> unless (unlink $lock_file) {
> Sympa::Log::Syslog::do_log('err', 'Cannot remove %s: %s',
> - $lock_file, $!);
> + $lock_file, $ERRNO);
> return undef;
> }
>
> unless (open FH, ">$lock_file") {
> Sympa::Log::Syslog::do_log('err', 'Cannot open %s: %s',
> - $lock_file, $!);
> + $lock_file, $ERRNO);
> return undef;
> }
> }
> @@ -3203,11 +3204,11 @@
>
> ## Keep track of the locking PID
> if ($mode eq 'write') {
> - print FH "$$\n";
> + print FH "$PID\n";
> }
> } else {
> Sympa::Log::Syslog::do_log('err', 'Failed locking %s: %s',
> - $lock_file, $!);
> + $lock_file, $ERRNO);
> return undef;
> }
>
> @@ -3221,7 +3222,7 @@
>
> unless (flock($fh, LOCK_UN)) {
> Sympa::Log::Syslog::do_log('err', 'Failed UNlocking %s: %s',
> - $lock_file, $!);
> + $lock_file, $ERRNO);
> return undef;
> }
> close $fh;
> @@ -3486,7 +3487,7 @@
> 'notice',
> 'Could not rename %s to %s: %s',
> $queue . '/' . $file,
> - $queue . '/bad/' . $file, $!
> + $queue . '/bad/' . $file, $ERRNO
> );
> return undef;
> }
> @@ -3548,7 +3549,7 @@
>
> unless (opendir(DIR, $dir)) {
> Sympa::Log::Syslog::do_log('err', "Unable to open '%s' spool : %s",
> - $dir, $!);
> + $dir, $ERRNO);
> return undef;
> }
>
> @@ -3567,7 +3568,7 @@
> unless (Sympa::Tools::remove_dir("$dir/$f")) {
> Sympa::Log::Syslog::do_log('err',
> 'Cannot remove old directory %s : %s',
> - "$dir/$f", $!);
> + "$dir/$f", $ERRNO);
> next;
> }
> Sympa::Log::Syslog::do_log('notice',
> @@ -3582,7 +3583,7 @@
> # hostname (20) and pid(10) are truncated in order to store lockname in
> # database varchar(30)
> sub get_lockname () {
> - return substr(substr(hostname(), 0, 20) . $$, 0, 30);
> + return substr(substr(hostname(), 0, 20) . $PID, 0, 30);
> }
>
> ## compare 2 scalars, string/numeric independent
> @@ -3592,13 +3593,13 @@
> $stra =~ s/\s+$//;
> $strb =~ s/^\s+//;
> $strb =~ s/\s+$//;
> - $! = 0;
> + $ERRNO = 0;
> my ($numa, $unparsed) = strtod($stra);
> my $numb;
> $numb = strtod($strb)
> - unless ($! || $unparsed != 0);
> + unless ($ERRNO || $unparsed != 0);
>
> - if (($stra eq '') || ($strb eq '') || ($unparsed != 0) || $!) {
> + if (($stra eq '') || ($strb eq '') || ($unparsed != 0) || $ERRNO) {
> return $stra lt $strb;
> } else {
> return $stra < $strb;
> @@ -3614,7 +3615,7 @@
>
> unless (open(PFILE, $pidfile)) {
> Sympa::Log::Syslog::do_log('err', "unable to open PID file %s:%s",
> - $pidfile, $!);
> + $pidfile, $ERRNO);
> return undef;
> }
> my $l = <PFILE>;
> @@ -3717,7 +3718,7 @@
> Sympa::Log::Syslog::do_log('debug3', '');
> my @children;
> for my $p (@{new Proc::ProcessTable->table}) {
> - if ($p->ppid == $$) {
> + if ($p->ppid == $PID) {
> push @children, $p->pid;
> }
> }
> Modified: trunk/src/lib/Sympa/Upgrade.pm (10313 => 10314)
> --- trunk/src/lib/Sympa/Upgrade.pm 2014-02-28 16:19:49 UTC (rev 10313)
> +++ trunk/src/lib/Sympa/Upgrade.pm 2014-02-28 16:23:04 UTC (rev 10314)
> @@ -25,6 +25,7 @@
>
> use strict;
>
> +use English qw(-no_match_vars);
> use Carp qw(croak);
> use File::Copy::Recursive;
> use POSIX qw(strftime);
> @@ -48,7 +49,7 @@
> if (-f $version_file) {
> unless (open VFILE, $version_file) {
> Sympa::Log::Syslog::do_log('err', "Unable to open %s : %s",
> - $version_file, $!);
> + $version_file, $ERRNO);
> return undef;
> }
> while (<VFILE>) {
> @@ -76,7 +77,7 @@
> "Unable to write %s ; sympa.pl needs write access on %s
> directory : %s",
> $version_file,
> Sympa::Site->etc,
> - $!
> + $ERRNO
> );
> return undef;
> }
> @@ -196,7 +197,7 @@
>
> foreach my $d (@directories) {
> unless (opendir DIR, $d) {
> - printf STDERR "Error: Cannot read %s directory : %s", $d,
> $!;
> + printf STDERR "Error: Cannot read %s directory : %s", $d,
> $ERRNO;
> next;
> }
>
> @@ -211,7 +212,7 @@
> unless (rename $tpl, "$tpl.oldtemplate") {
> printf STDERR
> "Error : failed to rename %s to %s.oldtemplate : %s\n",
> - $tpl, $tpl, $!;
> + $tpl, $tpl, $ERRNO;
> next;
> }
>
> @@ -295,7 +296,7 @@
> my $root_dir = Sympa::Site->arc_path;
> unless (opendir ARCDIR, $root_dir) {
> Sympa::Log::Syslog::do_log('err',
> - "Unable to open $root_dir : $!");
> + "Unable to open $root_dir : $ERRNO");
> return undef;
> }
>
> @@ -333,7 +334,7 @@
> unless (rename $old_path, $new_path) {
> Sympa::Log::Syslog::do_log('err',
> "Failed to rename %s to %s : %s",
> - $old_path, $new_path, $!);
> + $old_path, $new_path, $ERRNO);
> next;
> }
> Sympa::Log::Syslog::do_log('notice', "Renamed %s to
> %s",
> @@ -444,7 +445,7 @@
> my $root_dir = Sympa::Site->bounce_path;
> unless (opendir BOUNCEDIR, $root_dir) {
> Sympa::Log::Syslog::do_log('err',
> - "Unable to open $root_dir : $!");
> + "Unable to open $root_dir : $ERRNO");
> return undef;
> }
>
> @@ -474,7 +475,7 @@
> unless (rename $old_path, $new_path) {
> Sympa::Log::Syslog::do_log('err',
> "Failed to rename %s to %s : %s",
> - $old_path, $new_path, $!);
> + $old_path, $new_path, $ERRNO);
> next;
> }
> Sympa::Log::Syslog::do_log('notice', "Renamed %s to %s",
> @@ -798,7 +799,7 @@
>
> } else {
> Sympa::Log::Syslog::do_log('err',
> - "Failed to open directory Sympa::Site->queuebounce : $!");
> + "Failed to open directory Sympa::Site->queuebounce :
> $ERRNO");
> }
>
> }
> @@ -842,7 +843,7 @@
> unless (rename $orig_f, $new_f) {
> Sympa::Log::Syslog::do_log('err',
> "Failed to rename %s to %s : %s",
> - $orig_f, $new_f, $!);
> + $orig_f, $new_f, $ERRNO);
> next;
> }
> $count++;
> @@ -958,7 +959,7 @@
>
> my $spool = Sympa::Spool->new($spools_def{$spoolparameter});
> if (!opendir(DIR, $spooldir)) {
> - croak sprintf("Can't open dir %s: %s", $spooldir, "$!");
> + croak sprintf("Can't open dir %s: %s", $spooldir, $ERRNO);
> ## No return.
> }
> my @qfile = sort Sympa::Tools::by_date grep (!/^\./,
> readdir(DIR));
> @@ -1090,7 +1091,7 @@
> unless (open FILE, $spooldir . '/' . $filename) {
> Sympa::Log::Syslog::do_log('err',
> 'Cannot open message file %s : %s',
> - $filename, $!);
> + $filename, $ERRNO);
> return undef;
> }
> my $messageasstring;
> @@ -1128,7 +1129,7 @@
> 'err',
> 'Could not create list html view directory %s:
> %s',
> $list_html_view_dir,
> - $!
> + $ERRNO
> );
> exit 1;
> }
> @@ -1139,7 +1140,7 @@
> ) {
> Sympa::Log::Syslog::do_log('err',
> 'Could not rename %s to %s: %s',
> - $html_view_dir, $new_html_view_dir, $!);
> + $html_view_dir, $new_html_view_dir, $ERRNO);
> exit 1;
> }
> }
> @@ -1165,7 +1166,7 @@
> unless (File::Copy::copy($source, $goal)) {
> Sympa::Log::Syslog::do_log('err',
> 'Could not rename %s to %s: %s',
> - $source, $goal, $!);
> + $source, $goal, $ERRNO);
> exit 1;
> }
>
> @@ -1317,7 +1318,7 @@
>
> ## Add contents to sympa.conf
> if (%migrated) {
> - open $fh, '<', $sympa_conf or die $!;
> + open $fh, '<', $sympa_conf or die $ERRNO;
> @newconf = <$fh>;
> close $fh;
> $newconf[$#newconf] .= "\n" unless $newconf[$#newconf] =~
> /\n\z/;
> @@ -1409,13 +1410,13 @@
> Sympa::Language::PopLang();
>
> if (%migrated) {
> - warn sprintf("Unable to rename %s : %s", $sympa_conf, $!)
> + warn sprintf("Unable to rename %s : %s", $sympa_conf, $ERRNO)
> unless rename $sympa_conf, "$sympa_conf.$date";
> ## Write new config files
> my $umask = umask 037;
> unless (open $fh, '>', $sympa_conf) {
> umask $umask;
> - die sprintf("Unable to open %s : %s", $sympa_conf, $!);
> + die sprintf("Unable to open %s : %s", $sympa_conf, $ERRNO);
> }
> umask $umask;
> chown [getpwnam(Sympa::Constants::USER)]->[2],
> @@ -1431,7 +1432,7 @@
>
> if (-r $wwsympa_conf) {
> ## Keep old config file
> - warn sprintf("Unable to rename %s : %s", $wwsympa_conf, $!)
> + warn sprintf("Unable to rename %s : %s", $wwsympa_conf, $ERRNO)
> unless rename $wwsympa_conf, "$wwsympa_conf.$date";
> printf
> "%s will NO LONGER be used.\nPrevious version has been
> saved as %s.\n",
> @@ -1515,12 +1516,12 @@
> if ($text =~ /[^\x20-\x7E]/) {
> my $t = $text;
> eval { Encode::decode('UTF-8', $t, Encode::FB_CROAK); };
> - if ($@) {
> + if ($EVAL_ERROR) {
> eval {
> $t = $text;
> Encode::from_to($t, $charset, "UTF-8",
> Encode::FB_CROAK);
> };
> - if ($@) {
> + if ($EVAL_ERROR) {
> Sympa::Log::Syslog::do_log('err',
> "Template %s cannot be converted from %s to UTF-8",
> $charset, $file);
> Modified: trunk/src/lib/Sympa/Wwslib.pm (10313 => 10314)
> --- trunk/src/lib/Sympa/Wwslib.pm 2014-02-28 16:19:49 UTC (rev 10313)
> +++ trunk/src/lib/Sympa/Wwslib.pm 2014-02-28 16:23:04 UTC (rev 10314)
> @@ -23,6 +23,8 @@
>
> package Sympa::Wwslib;
>
> +use English qw(-no_match_vars);
> +
> use Sympa::Log;
> use Sympa::Conf;
> use Sympa::Constants;
> @@ -333,7 +335,7 @@
>
> unless (open FILE, ">:bytes", $param->{'destination'}) {
> Sympa::Log::Syslog::do_log('debug',
> - "Cannot open file $param->{'destination'} : $!");
> + "Cannot open file $param->{'destination'} : $ERRNO");
> return undef;
> }
> while (<$fh>) {
> Modified: trunk/src/libexec/alias_manager.pl.in (10313 => 10314)
> --- trunk/src/libexec/alias_manager.pl.in 2014-02-28 16:19:49 UTC (rev
> 10313)
> +++ trunk/src/libexec/alias_manager.pl.in 2014-02-28 16:23:04 UTC (rev
> 10314)
> @@ -131,6 +131,7 @@
> use strict;
> use warnings;
> use lib '--modulesdir--';
> +use English qw(-no_match_vars);
> use Getopt::Long;
> use Pod::Usage;
> use POSIX;
> @@ -243,7 +244,7 @@
> ## Newaliases
> unless ($file) {
> unless (system($alias_wrapper) == 0) {
> - print STDERR "Failed to execute newaliases: $!\n";
> + print STDERR "Failed to execute newaliases: $ERRNO\n";
> exit(6);
> }
> }
> @@ -314,7 +315,7 @@
> ## Newaliases
> unless ($file) {
> unless (system($alias_wrapper) == 0) {
> - print STDERR "Failed to execute newaliases: $!\n";
> + print STDERR "Failed to execute newaliases: $ERRNO\n";
> exit(6);
> }
> }
> Modified: trunk/src/libexec/ldap_alias_manager.pl.in (10313 => 10314)
> --- trunk/src/libexec/ldap_alias_manager.pl.in 2014-02-28 16:19:49
> UTC (rev 10313)
> +++ trunk/src/libexec/ldap_alias_manager.pl.in 2014-02-28 16:23:04
> UTC (rev 10314)
> @@ -46,6 +46,7 @@
> ## Load Sympa.conf
> use strict;
> use lib '--modulesdir--';
> +use English qw(-no_match_vars);
> use Net::LDAP;
> use Net::LDAPS;
> use POSIX;
> @@ -363,7 +364,7 @@
> )
> ) {
> print STDERR
> - "Can't connect to LDAP server using SSL or unable to
> verify Server certificate for $ldap_host: $@\n";
> + "Can't connect to LDAP server using SSL or unable to
> verify Server certificate for $ldap_host: $EVAL_ERROR\n";
> return 0;
> }
> } else {
> @@ -376,13 +377,13 @@
> )
> ) {
> print STDERR
> - "Can't connect to LDAP server using SSL for
> $ldap_host: $@\n";
> + "Can't connect to LDAP server using SSL for
> $ldap_host: $EVAL_ERROR\n";
> return 0;
> }
> }
> } else {
> unless ($ldap_connection = Net::LDAP->new($ldap_host, version =>
> 3)) {
> - print STDERR "Can't connect to LDAP server $ldap_host: $@\n";
> + print STDERR "Can't connect to LDAP server $ldap_host:
> $EVAL_ERROR\n";
> return 0;
> }
> }
> Modified: trunk/src/libexec/mysql_alias_manager.pl.in (10313 => 10314)
> --- trunk/src/libexec/mysql_alias_manager.pl.in 2014-02-28 16:19:49
> UTC (rev 10313)
> +++ trunk/src/libexec/mysql_alias_manager.pl.in 2014-02-28 16:23:04
> UTC (rev 10314)
> @@ -34,6 +34,7 @@
> ## Load Sympa.conf
> use strict;
> use lib '--modulesdir--';
> +use English qw(-no_match_vars);
> use DBI;
> use POSIX;
>
> Modified: trunk/src/sbin/archived.pl.in (10313 => 10314)
> --- trunk/src/sbin/archived.pl.in 2014-02-28 16:19:49 UTC (rev 10313)
> +++ trunk/src/sbin/archived.pl.in 2014-02-28 16:23:04 UTC (rev 10314)
> @@ -136,6 +136,7 @@
> use lib '--modulesdir--';
> use strict;
> use warnings;
> +use English qw(-no_match_vars);
> use Getopt::Long;
> use Digest::MD5;
> use Pod::Usage;
> @@ -201,9 +202,9 @@
> $options->{'stderr_to_tty'} = 1 if ($main::options{'foreground'});
>
> ## Create and write the PID file
> -Sympa::Tools::write_pid('archived', $$, $options);
> +Sympa::Tools::write_pid('archived', $PID, $options);
> unless ($options->{'stderr_to_tty'}) {
> - Sympa::Tools::direct_stderr_to_file(('pid' => $$));
> + Sympa::Tools::direct_stderr_to_file(('pid' => $PID));
> }
>
> # setting log_level using conf unless it is set by calling option
> @@ -223,16 +224,16 @@
> 'archived');
>
> ## Set the User ID & Group ID for the process
> -$( = $) = (getgrnam(Sympa::Constants::GROUP))[2];
> -$< = $> = (getpwnam(Sympa::Constants::USER))[2];
> +$GID = $EGID = (getgrnam(Sympa::Constants::GROUP))[2];
> +$UID = $EUID = (getpwnam(Sympa::Constants::USER))[2];
>
> ## Required on FreeBSD to change ALL IDs(effective UID + real UID + saved
> UID)
> POSIX::setuid((getpwnam(Sympa::Constants::USER))[2]);
> POSIX::setgid((getgrnam(Sympa::Constants::GROUP))[2]);
>
> ## Check if the UID has correctly been set (useful on OS X)
> -unless (($( == (getgrnam(Sympa::Constants::GROUP))[2])
> - && ($< == (getpwnam(Sympa::Constants::USER))[2])) {
> +unless (($GID == (getgrnam(Sympa::Constants::GROUP))[2])
> + && ($UID == (getpwnam(Sympa::Constants::USER))[2])) {
> Sympa::Log::Syslog::fatal_err(
> "Failed to change process user ID and group ID. Note that on some
> OS Perl scripts can't change their real UID. In such circumstances Sympa
> should be run via sudo."
> );
> @@ -399,7 +400,7 @@
> unless (-d "$arcpath/deleted") {
> unless (mkdir("$arcpath/deleted", 0777)) {
> Sympa::Log::Syslog::do_log('info',
> - "remove_arc: unable to create $arcpath/deleted :
> $!");
> + "remove_arc: unable to create $arcpath/deleted :
> $ERRNO");
> last;
> }
> }
> @@ -462,7 +463,7 @@
>
> Sympa::Log::Syslog::do_log('notice',
> 'archived exited normally due to signal');
> -Sympa::Tools::remove_pid('archived', $$);
> +Sympa::Tools::remove_pid('archived', $PID);
>
> exit(0);
>
> @@ -721,7 +722,7 @@
> opendir HTML, "$arcpath/$adrlist/$yyyy-$mm";
>
> ## Skip arctxt/ . and ..
> - foreach my $html_file (grep !/^arctxt$|^index$|\.+$/,
> readdir(HTML)) {
> + foreach my $html_file (grep
> !/^arctxt$OUTPUT_AUTOFLUSH^index$OUTPUT_AUTOFLUSH\.+$/, readdir(HTML)) {
> unlink $arcpath . '/' . $adrlist . '/' . $yyyy . '-' . $mm .
> '/'
> . $html_file;
> }
> @@ -798,7 +799,7 @@
> opendir HTML, $arcdir;
> ## Skip arctxt/ . and ..
> foreach
> - my $html_file (grep !/^arctxt$|^index$|\.+$/,
> readdir(HTML)) {
> + my $html_file (grep
> !/^arctxt$OUTPUT_AUTOFLUSH^index$OUTPUT_AUTOFLUSH\.+$/, readdir(HTML)) {
> unlink $arcdir . '/' . $html_file;
> }
> closedir HTML;
> @@ -1184,7 +1185,7 @@
> ## $ENV{'M2H_MODIFYBODYADDRESSES'} à positionner si le corps du message
> ## est parse
> $ENV{'M2H_ADDRESSMODIFYCODE'} =
> -
> "s|^([^\@]+)\@([^\@]+)\$|\($tag\%hidden_head\%$tag\)\$1\($tag\%hidden_at\%$tag\)\$2\($tag\%hidden_end\%$tag\)|g";
> +
> "s|^([^\@]+)\@([^\@]+)\$OUTPUT_AUTOFLUSH\($tag\%hidden_head\%$tag\)\$1\($tag\%hidden_at\%$tag\)\$2\($tag\%hidden_end\%$tag\)|g";
> $ENV{'M2H_MODIFYBODYADDRESSES'} = 1;
> }
>
> Modified: trunk/src/sbin/bounced.pl.in (10313 => 10314)
> --- trunk/src/sbin/bounced.pl.in 2014-02-28 16:19:49 UTC (rev 10313)
> +++ trunk/src/sbin/bounced.pl.in 2014-02-28 16:23:04 UTC (rev 10314)
> @@ -140,6 +140,7 @@
> use lib '--modulesdir--';
> use strict;
> use warnings;
> +use English qw(-no_match_vars);
> use FileHandle;
> use Getopt::Long;
> use Pod::Usage;
> @@ -216,9 +217,9 @@
> $options->{'stderr_to_tty'} = 1 if ($main::options{'foreground'});
>
> ## Create and write the PID file
> -Sympa::Tools::write_pid('bounced', $$, $options);
> +Sympa::Tools::write_pid('bounced', $PID, $options);
> unless ($options->{'stderr_to_tty'}) {
> - Sympa::Tools::direct_stderr_to_file(('pid' => $$));
> + Sympa::Tools::direct_stderr_to_file(('pid' => $PID));
> }
>
> if ($main::options{'log_level'}) {
> @@ -239,16 +240,16 @@
> 'bounced');
>
> ## Set the User ID & Group ID for the process
> -$( = $) = (getgrnam(Sympa::Constants::GROUP))[2];
> -$< = $> = (getpwnam(Sympa::Constants::USER))[2];
> +$GID = $EGID = (getgrnam(Sympa::Constants::GROUP))[2];
> +$UID = $EUID = (getpwnam(Sympa::Constants::USER))[2];
>
> ## Required on FreeBSD to change ALL IDs(effective UID + real UID + saved
> UID)
> POSIX::setuid((getpwnam(Sympa::Constants::USER))[2]);
> POSIX::setgid((getgrnam(Sympa::Constants::GROUP))[2]);
>
> ## Check if the UID has correctly been set (useful on OS X)
> -unless (($( == (getgrnam(Sympa::Constants::GROUP))[2])
> - && ($< == (getpwnam(Sympa::Constants::USER))[2])) {
> +unless (($GID == (getgrnam(Sympa::Constants::GROUP))[2])
> + && ($UID == (getpwnam(Sympa::Constants::USER))[2])) {
> Sympa::Log::Syslog::fatal_err(
> "Failed to change process user ID and group ID. Note that on some
> OS Perl scripts can't change their real UID. In such circumstances Sympa
> should be run via SUDO."
> );
> @@ -314,7 +315,7 @@
> Sympa::Site->send_notify_to_listmaster(undef, undef, undef, 1);
>
> Sympa::Log::Syslog::do_log('notice', 'bounced exited normally due to
> signal');
> -Sympa::Tools::remove_pid('bounced', $$);
> +Sympa::Tools::remove_pid('bounced', $PID);
>
> exit(0);
>
> Modified: trunk/src/sbin/bulk.pl.in (10313 => 10314)
> --- trunk/src/sbin/bulk.pl.in 2014-02-28 16:19:49 UTC (rev 10313)
> +++ trunk/src/sbin/bulk.pl.in 2014-02-28 16:23:04 UTC (rev 10314)
> @@ -92,6 +92,7 @@
> use lib '--modulesdir--';
> use strict;
> use warnings;
> +use English qw(-no_match_vars);
> use Getopt::Long;
> use Pod::Usage;
>
> @@ -192,21 +193,21 @@
> $options->{'multiple_process'} = 0;
>
> # Save the PID number
> -Sympa::Tools::write_pid('bulk', $$, $options);
> +Sympa::Tools::write_pid('bulk', $PID, $options);
> unless ($options->{'stderr_to_tty'}) {
> - Sympa::Tools::direct_stderr_to_file(('pid' => $$));
> + Sympa::Tools::direct_stderr_to_file(('pid' => $PID));
> }
> ## Set the User ID & Group ID for the process
> -$( = $) = (getgrnam(Sympa::Constants::GROUP))[2];
> -$< = $> = (getpwnam(Sympa::Constants::USER))[2];
> +$GID = $EGID = (getgrnam(Sympa::Constants::GROUP))[2];
> +$UID = $EUID = (getpwnam(Sympa::Constants::USER))[2];
>
> ## Required on FreeBSD to change ALL IDs(effective UID + real UID + saved
> UID)
> POSIX::setuid((getpwnam(Sympa::Constants::USER))[2]);
> POSIX::setgid((getgrnam(Sympa::Constants::GROUP))[2]);
>
> ## Check if the UID has correctly been set (useful on OS X)
> -unless (($( == (getgrnam(Sympa::Constants::GROUP))[2])
> - && ($< == (getpwnam(Sympa::Constants::USER))[2])) {
> +unless (($GID == (getgrnam(Sympa::Constants::GROUP))[2])
> + && ($UID == (getpwnam(Sympa::Constants::USER))[2])) {
> Sympa::Log::Syslog::fatal_err(
> "Failed to change process user ID and group ID. Note that on some
> OS Perl scripts can't change their real UID. In such circumstances Sympa
> should be run via sudo."
> );
> @@ -299,10 +300,10 @@
> }
> my $pids_in_pfile = Sympa::Tools::get_pids_in_pid_file('bulk');
> unless (defined($pids_in_pfile)) {
> - Sympa::Tools::write_pid('bulk', $$, $options);
> + Sympa::Tools::write_pid('bulk', $PID, $options);
> close STDERR;
> - Sympa::Tools::direct_stderr_to_file(('pid' => $$));
> - $pids_in_pfile = [$$];
> + Sympa::Tools::direct_stderr_to_file(('pid' => $PID));
> + $pids_in_pfile = [$PID];
> }
> ## Start new processes if there remain at least
> ## 'bulk_fork_threshold' packets to send in the
> bulkpacket_table
> @@ -343,14 +344,14 @@
> } else {
> ## We're in a child bulk process
> close STDERR;
> - Sympa::Tools::direct_stderr_to_file(('pid' =>
> $$));
> + Sympa::Tools::direct_stderr_to_file(('pid' =>
> $PID));
> $date_of_last_activity = time();
> $main::daemon_usage =
> 'DAEMON_SLAVE'; # automatic lists
> creation
>
> Sympa::Log::Syslog::do_openlog(Sympa::Site->syslog,
> Sympa::Site->log_socket_type, 'bulk');
> Sympa::Log::Syslog::do_log('info',
> - "Bulk slave daemon started with PID %s",
> $$);
> + "Bulk slave daemon started with PID %s",
> $PID);
> last;
> }
> }
> @@ -366,7 +367,7 @@
> && !(my $r_packets =
> Sympa::Bulk::there_is_too_much_remaining_packets())) {
> Sympa::Log::Syslog::do_log('info',
> "Process %s didn't send any message since %s seconds,
> exiting.",
> - $$, Sympa::Site->bulk_lazytime);
> + $PID, Sympa::Site->bulk_lazytime);
> last;
> }
>
> @@ -598,7 +599,7 @@
> Sympa::Site->send_notify_to_listmaster(undef, undef, undef, 1);
>
> Sympa::Log::Syslog::do_log('notice', 'bulk.pl exited normally due to
> signal');
> -Sympa::Tools::remove_pid('bulk', $$, $options);
> +Sympa::Tools::remove_pid('bulk', $PID, $options);
>
> exit(0);
>
> @@ -635,7 +636,7 @@
>
> close MSGDUMP;
>
> - my $status = $? / 256;
> + my $status = $CHILD_ERROR / 256;
> unless ($status == 0) {
> Sympa::Log::Syslog::do_log('debug', 'S/MIME signature NOT OK (%s)',
> $where);
> Modified: trunk/src/sbin/sympa.pl.in (10313 => 10314)
> --- trunk/src/sbin/sympa.pl.in 2014-02-28 16:19:49 UTC (rev 10313)
> +++ trunk/src/sbin/sympa.pl.in 2014-02-28 16:23:04 UTC (rev 10314)
> @@ -333,6 +333,7 @@
> use lib '--modulesdir--';
> use strict;
> use warnings;
> +use English qw(-no_match_vars);
> use Carp qw(croak);
> use File::Copy;
> use File::Path;
> @@ -515,7 +516,7 @@
>
> ## Change working directory.
> if (!chdir(Sympa::Site->home)) {
> - printf STDERR "Can't chdir to %s: %s\n", Sympa::Site->home, $!;
> + printf STDERR "Can't chdir to %s: %s\n", Sympa::Site->home, $ERRNO;
> exit 1;
> }
>
> @@ -607,7 +608,7 @@
> unless (eval "require OAuthProvider") {
> Sympa::Log::Syslog::fatal_err(
> 'VOOT feature is on, but Sympa was Unable to load
> OAuthProvider module: %s',
> - $@
> + $EVAL_ERROR
> );
> return undef;
> }
> @@ -615,7 +616,7 @@
> unless (eval "require OAuthConsumer") {
> Sympa::Log::Syslog::fatal_err(
> 'VOOT feature is on, but Sympa was Unable to load
> OAuthConsumer module: %s',
> - $@
> + $EVAL_ERROR
> );
> return undef;
> }
> @@ -623,7 +624,7 @@
> unless (eval "require VOOTProvider") {
> Sympa::Log::Syslog::fatal_err(
> 'VOOT feature is on, but Sympa was Unable to load
> VOOTProvider module: %s',
> - $@
> + $EVAL_ERROR
> );
> return undef;
> }
> @@ -631,7 +632,7 @@
> unless (eval "require VOOTConsumer") {
> Sympa::Log::Syslog::fatal_err(
> 'VOOT feature is on, but Sympa was Unable to load module:
> %s',
> - $@
> + $EVAL_ERROR
> );
> return undef;
> }
> @@ -673,7 +674,7 @@
> Sympa::Log::Syslog::do_openlog(Sympa::Site->syslog,
> Sympa::Site->log_socket_type,
> 'sympa');
>
> - Sympa::Log::Syslog::do_log('debug', 'Running server %d', $$);
> + Sympa::Log::Syslog::do_log('debug', 'Running server %d', $PID);
> unless ($main::options{'batch'}) {
>
> ## Create and write the PID file
> @@ -681,15 +682,15 @@
> ## dedicated file
> my $options;
> $options->{'stderr_to_tty'} = 1 if
> ($main::options{'foreground'});
> - Sympa::Tools::write_pid('sympa', $$, $options);
> + Sympa::Tools::write_pid('sympa', $PID, $options);
> unless ($options->{'stderr_to_tty'}) {
> - Sympa::Tools::direct_stderr_to_file(('pid' => $$));
> + Sympa::Tools::direct_stderr_to_file(('pid' => $PID));
> }
> }
>
> # Set the User ID & Group ID for the process
> - $( = $) = (getgrnam(Sympa::Constants::GROUP))[2];
> - $< = $> = (getpwnam(Sympa::Constants::USER))[2];
> + $GID = $EGID = (getgrnam(Sympa::Constants::GROUP))[2];
> + $UID = $EUID = (getpwnam(Sympa::Constants::USER))[2];
>
> ## Required on FreeBSD to change ALL IDs
> ## (effective UID + real UID + saved UID)
> @@ -697,8 +698,8 @@
> POSIX::setgid((getgrnam(Sympa::Constants::GROUP))[2]);
>
> ## Check if the UID has correctly been set (useful on OS X)
> - unless (($( == (getgrnam(Sympa::Constants::GROUP))[2])
> - && ($< == (getpwnam(Sympa::Constants::USER))[2])) {
> + unless (($GID == (getgrnam(Sympa::Constants::GROUP))[2])
> + && ($UID == (getpwnam(Sympa::Constants::USER))[2])) {
> Sympa::Log::Syslog::fatal_err(
> "Failed to change process user ID and group ID. Note that
> on some OS Perl scripts can't change their real UID. In such circumstances
> Sympa should be run via sudo."
> );
> @@ -756,7 +757,7 @@
> } elsif ($main::options{'make_alias_file'}) {
> my $all_lists = Sympa::List::get_lists();
>
> - my $aliases_file = Sympa::Site->tmpdir . '/sympa_aliases' . $$;
> + my $aliases_file = Sympa::Site->tmpdir . '/sympa_aliases' . $PID;
> unless (open TMP, '>', $aliases_file) {
> printf STDERR "Unable to create %s, exiting\n", $aliases_file;
> exit;
> @@ -1148,7 +1149,7 @@
> }
>
> unless (open INFILE, $main::options{'input_file'}) {
> - print STDERR "\n Impossible to open input file : $! \n";
> + print STDERR "\n Impossible to open input file : $ERRNO \n";
> exit 1;
> }
>
> @@ -1573,7 +1574,7 @@
> } #end of block while ($signal ne 'term'){
>
> Sympa::Log::Syslog::do_log('notice', 'Sympa exited normally due to
> signal');
> -Sympa::Tools::remove_pid('sympa', $$);
> +Sympa::Tools::remove_pid('sympa', $PID);
>
> exit(0);
>
> @@ -2547,9 +2548,9 @@
> 'apply_dkim_signature' => $apply_dkim_signature
> );
> };
> - if ($@) {
> + if ($EVAL_ERROR) {
> Sympa::Log::Syslog::do_log('err',
> - 'FATAL: Failed to distribute message: %s', $@);
> + 'FATAL: Failed to distribute message: %s', $EVAL_ERROR);
> }
> ## Keep track of known message IDs...if any
> $msgid_table{$list->get_id}{$messageid} = time if $messageid;
> Modified: trunk/src/sbin/task_manager.pl.in (10313 => 10314)
> --- trunk/src/sbin/task_manager.pl.in 2014-02-28 16:19:49 UTC (rev 10313)
> +++ trunk/src/sbin/task_manager.pl.in 2014-02-28 16:23:04 UTC (rev 10314)
> @@ -87,6 +87,7 @@
> use lib '--modulesdir--';
> use strict "vars";
> use warnings;
> +use English qw(-no_match_vars);
> use Getopt::Long;
> use Pod::Usage;
>
> @@ -179,22 +180,22 @@
> ## If process is running in foreground, don't write STDERR to a dedicated
> file
> my $options;
> $options->{'stderr_to_tty'} = 1 if ($main::options{'foreground'});
> -Sympa::Tools::write_pid('task_manager', $$, $options);
> +Sympa::Tools::write_pid('task_manager', $PID, $options);
> unless ($options->{'stderr_to_tty'}) {
> - Sympa::Tools::direct_stderr_to_file(('pid' => $$));
> + Sympa::Tools::direct_stderr_to_file(('pid' => $PID));
> }
>
> ## Set the UserID & GroupID for the process
> -$( = $) = (getgrnam(Sympa::Constants::GROUP))[2];
> -$< = $> = (getpwnam(Sympa::Constants::USER))[2];
> +$GID = $EGID = (getgrnam(Sympa::Constants::GROUP))[2];
> +$UID = $EUID = (getpwnam(Sympa::Constants::USER))[2];
>
> ## Required on FreeBSD to change ALL IDs(effective UID + real UID + saved
> UID)
> POSIX::setuid((getpwnam(Sympa::Constants::USER))[2]);
> POSIX::setgid((getgrnam(Sympa::Constants::GROUP))[2]);
>
> ## Check if the UID has correctly been set (usefull on OS X)
> -unless (($( == (getgrnam(Sympa::Constants::GROUP))[2])
> - && ($< == (getpwnam(Sympa::Constants::USER))[2])) {
> +unless (($GID == (getgrnam(Sympa::Constants::GROUP))[2])
> + && ($UID == (getpwnam(Sympa::Constants::USER))[2])) {
> Sympa::Log::Syslog::fatal_err(
> "Failed to change process user ID and group ID. Note that on some
> OS Perl scripts can't change their real UID. In such circumstances Sympa
> should be run via sudo."
> );
> @@ -269,6 +270,6 @@
>
> Sympa::Log::Syslog::do_log('notice',
> 'task_manager exited normally due to signal');
> -Sympa::Tools::remove_pid('task_manager', $$);
> +Sympa::Tools::remove_pid('task_manager', $PID);
>
> exit(0);


--
株式会社 コンバージョン セキュリティ&OSSソリューション部 池田荘児
〒231-0004 神奈川県横浜市中区元浜町3-21-2 ヘリオス関内ビル7F
e-mail address@concealed TEL 045-640-3550
http://www.conversion.co.jp/



Archive powered by MHonArc 2.6.19+.

Top of Page