overload cmp operator for PVE::Exception

So that we can use ($err eq "timeout") like expressions.
This commit is contained in:
Dietmar Maurer 2011-10-13 11:14:30 +02:00
parent 8ba7c72bd1
commit 710d2994af

View File

@ -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);