projects
/
pve-common.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8ba7c72
)
overload cmp operator for PVE::Exception
author
Dietmar Maurer
<dietmar@proxmox.com>
Thu, 13 Oct 2011 09:14:30 +0000
(11:14 +0200)
committer
Dietmar Maurer
<dietmar@proxmox.com>
Thu, 13 Oct 2011 09:14:30 +0000
(11:14 +0200)
So that we can use ($err eq "timeout") like expressions.
data/PVE/Exception.pm
patch
|
blob
|
blame
|
history
diff --git
a/data/PVE/Exception.pm
b/data/PVE/Exception.pm
index b30d0eda0f55b59c2a27e793c133c2564d745e78..8004d0555221080675001b076e6c2cfc93b2b560 100755
(executable)
--- 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);