Ambrosia::core::Nil - implement pattern NullObject.
version 0.010
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"; }
Ambrosia::core::Nil implement pattern NullObject.
Ambrosia::core::Nil
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.
new Constructor. Instances the object of type Ambrosia::core::Nil.
new
Not tested.
Please report bugs relevant to Ambrosia to <knm[at]cpan.org>.
Ambrosia
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.
Nikolay Kuritsyn (knm[at]cpan.org)
To install Ambrosia, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Ambrosia
CPAN shell
perl -MCPAN -e shell install Ambrosia
For more information on module installation, please visit the detailed CPAN module installation guide.