mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-10-21 23:56:55 +02:00
Split the boolean class into an outer module
This commit is contained in:
14
perl/lib/Data/MessagePack/Boolean.pm
Executable file
14
perl/lib/Data/MessagePack/Boolean.pm
Executable file
@@ -0,0 +1,14 @@
|
||||
package Data::MessagePack::Boolean;
|
||||
use strict;
|
||||
use overload
|
||||
'bool' => sub { ${ $_[0] } },
|
||||
'0+' => sub { ${ $_[0] } },
|
||||
'""' => sub { ${ $_[0] } ? 'true' : 'false' },
|
||||
|
||||
fallback => 1,
|
||||
;
|
||||
|
||||
our $true = do { bless \(my $dummy = 1) };
|
||||
our $false = do { bless \(my $dummy = 0) };
|
||||
|
||||
1;
|
Reference in New Issue
Block a user