[pve-devel] [PATCH common] fix #1548: replace perl use vars with our

Thomas Lamprecht t.lamprecht at proxmox.com
Thu Nov 15 09:11:00 CET 2018


On 11/14/18 1:31 PM, Tim Marx wrote:
> replace deprecated 'use vars qw($frob @mung %seen);' with the now in favor
> 'our $foo;' declaration
> see NOTE at: http://perldoc.perl.org/vars.html
> 

Getting the following error when trying to apply:

git am ~/shared/tmp/\[pve-devel\]\ \[PATCH\ common\]\ fix\ \#1548:\ replace\ perl\ use\ vars\ with\ our.eml                                                                                        [master]
Applying: fix #1548: replace perl use vars with our
error: patch failed: src/PVE/Exception.pm:6
error: src/PVE/Exception.pm: patch does not apply
error: patch failed: src/PVE/SafeSyslog.pm:5
error: src/PVE/SafeSyslog.pm: patch does not apply
Patch failed at 0001 fix #1548: replace perl use vars with our
hint: Use 'git am --show-current-patch' to see the failed patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

There are trailing whitespaces in the file but not in you removed lines,
so the context does not match. Maybe disable any "white space" cleanup
feature from your editor for patches? ^^


> Signed-off-by: Tim Marx <t.marx at proxmox.com>
> ---
>  src/PVE/AtomicFile.pm |  3 +--
>  src/PVE/Exception.pm  |  7 ++-----
>  src/PVE/SafeSyslog.pm | 11 +++--------
>  3 files changed, 6 insertions(+), 15 deletions(-)
> 
> diff --git a/src/PVE/AtomicFile.pm b/src/PVE/AtomicFile.pm
> index b1889e8..2086c7a 100644
> --- a/src/PVE/AtomicFile.pm
> +++ b/src/PVE/AtomicFile.pm
> @@ -3,9 +3,8 @@ package PVE::AtomicFile;
>  use strict;
>  use warnings;
>  use IO::AtomicFile;
> -use vars qw(@ISA);
> 
> - at ISA = qw(IO::AtomicFile);
> +our @ISA = qw(IO::AtomicFile);
> 
>  sub new {
>      my $class = shift;
> diff --git a/src/PVE/Exception.pm b/src/PVE/Exception.pm
> index fa6b73a..6168fa7 100644
> --- a/src/PVE/Exception.pm
> +++ b/src/PVE/Exception.pm
> @@ -6,12 +6,9 @@ package PVE::Exception;
> 
>  use strict;
>  use warnings;
> -use vars qw(@ISA @EXPORT_OK);
> -require Exporter;
>  use Storable qw(dclone);
>  use HTTP::Status qw(:constants);
> 
> - at ISA = qw(Exporter);
> 
>  use overload '""' => sub {local $@; shift->stringify};
>  use overload 'cmp' => sub {
> @@ -19,8 +16,8 @@ use overload 'cmp' => sub {
>      local $@;
>      return "$a" cmp "$b"; # compare as string
>  };
> -
> - at EXPORT_OK = qw(raise raise_param_exc raise_perm_exc);
> +use base 'Exporter';
> +our @EXPORT_OK = qw(raise raise_param_exc raise_perm_exc);
> 
>  sub new {
>      my ($class, $msg, %param) = @_;
> diff --git a/src/PVE/SafeSyslog.pm b/src/PVE/SafeSyslog.pm
> index 63b37f8..18d23cf 100644
> --- a/src/PVE/SafeSyslog.pm
> +++ b/src/PVE/SafeSyslog.pm
> @@ -5,16 +5,11 @@ use warnings;
>  use File::Basename;
>  use Sys::Syslog ();
>  use Encode;
> +use base 'Exporter';
> 
> -use vars qw($VERSION @ISA @EXPORT);
> +our $VERSION = '1.00';
> 
> -$VERSION = '1.00';
> -
> -require Exporter;
> -
> - at ISA = qw(Exporter);
> -
> - at EXPORT = qw(syslog initlog);
> +our @EXPORT = qw(syslog initlog);
> 
>  my $log_tag = "unknown";
> 
> --
> 2.11.0
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 





More information about the pve-devel mailing list