Commit | Line | Data |
f0276afb |
1 | # This was copied from MARCEL's Class::Null. However, I couldn't use it because |
2 | # I need an undef value, not an implementation of the Null Class pattern. |
3 | package DBM::Deep::Null; |
4 | |
5 | use 5.006_000; |
6 | |
7 | use strict; |
8 | use warnings FATAL => 'all'; |
9 | |
10 | =head1 NAME |
11 | |
12 | DBM::Deep::Null |
13 | |
14 | =head1 PURPOSE |
15 | |
16 | This is an internal-use-only object for L<DBM::Deep/>. It acts as a NULL object |
17 | in the same vein as MARCEL's L<Class::Null/>. I couldn't use L<Class::Null/> |
18 | because DBM::Deep needed an object that always evaluated as undef, not an |
19 | implementation of the Null Class pattern. |
20 | |
21 | =head1 OVERVIEW |
22 | |
23 | It is used to represent null sectors in DBM::Deep. |
24 | |
25 | =cut |
26 | |
27 | use overload |
28 | 'bool' => sub { undef }, |
29 | '""' => sub { undef }, |
30 | '0+' => sub { undef }, |
31 | fallback => 1, |
32 | nomethod => 'AUTOLOAD'; |
33 | |
34 | sub AUTOLOAD { return; } |
35 | |
36 | 1; |
37 | __END__ |