]> git.proxmox.com Git - pve-common.git/blobdiff - data/PVE/Exception.pm
overload cmp operator for PVE::Exception
[pve-common.git] / data / PVE / Exception.pm
index b30d0eda0f55b59c2a27e793c133c2564d745e78..8004d0555221080675001b076e6c2cfc93b2b560 100755 (executable)
@@ -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);