NAME
Ambrosia::core::Nil - implement pattern NullObject.
VERSION
version 0.010
SYNOPSIS
use Ambrosia::core::Nil;
$obj = new Ambrosia::core::Nil(@arg);
$obj->foo(); #It's work and not invoke exeption.
$obj->()->()->foo(); #And it's work too.
@a = $obj->foo(); #return empty array
$b = $obj->foo(); #return object of Ambrosia::core::Nil
#with string concatenation $obj return empty string
$s = "foo" . $obj; #$s eq 'foo'
$i = 10 + $obj; #$i == 10
#%$obj is empty hash
#@$obj is empty array
unless ( $obj )
{
print "The object of type Ambrosia::core::Nil allthase is false.\n";
}
DESCRIPTION
Ambrosia::core::Nil
implement pattern NullObject.
Has only the constructor new.
You can call any methods, and it will not lead to an error.
They will return reference on object of type <Ambrosia::core::Nil> in scalar context and will return empty array in list context.
CONSTRUCTOR
new
new
Constructor. Instances the object of type Ambrosia::core::Nil.
THREADS
Not tested.
BUGS
Please report bugs relevant to Ambrosia
to <knm[at]cpan.org>.
COPYRIGHT AND LICENSE
Copyright (C) 2010-2012 Nickolay Kuritsyn. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
AUTHOR
Nikolay Kuritsyn (knm[at]cpan.org)