mirror of
https://git.proxmox.com/git/pve-common
synced 2025-07-25 16:37:02 +00:00
overload cmp operator for PVE::Exception
So that we can use ($err eq "timeout") like expressions.
This commit is contained in:
parent
8ba7c72bd1
commit
710d2994af
@ -15,6 +15,11 @@ use HTTP::Status qw(:constants);
|
|||||||
@ISA = qw(Exporter);
|
@ISA = qw(Exporter);
|
||||||
|
|
||||||
use overload '""' => sub {local $@; shift->stringify};
|
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);
|
@EXPORT_OK = qw(raise raise_param_exc);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user