From 710d2994af8a8cf8c7ad2af93c93f3b76a77c395 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Thu, 13 Oct 2011 11:14:30 +0200 Subject: [PATCH] overload cmp operator for PVE::Exception So that we can use ($err eq "timeout") like expressions. --- data/PVE/Exception.pm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/data/PVE/Exception.pm b/data/PVE/Exception.pm index b30d0ed..8004d05 100755 --- a/data/PVE/Exception.pm +++ b/data/PVE/Exception.pm @@ -15,6 +15,11 @@ use HTTP::Status qw(:constants); @ISA = qw(Exporter); use overload '""' => sub {local $@; shift->stringify}; +use overload 'cmp' => sub { + my ($a, $b) = @_; + local $@; + return "$a" cmp "$b"; # compare as string +}; @EXPORT_OK = qw(raise raise_param_exc); -- 2.39.2