NAME
Class::NullChain - Null Value Chaining Object Class
SYNOPSIS
# In your code:
sub customer
{
my $self = shift( @_ );
return( $self->error( "No customer id was provided" ) ) if( !scalar( @_ ) );
return( $self->customer_info_to_object( @_ ) );
}
# And this method is called without providing an id, thus triggering an error,
# but is chained. Upon error triggered by method "error", a Class::Null
# object is returned
my $name = $object->customer->name;
VERSION
v0.1.1
DESCRIPTION
This package provides a null returned value that can be chained and ultimately return undef
.
This is designed for chained method calls and avoid the perl error called on undefined value
See Module::Generic::Null for more information.
SEE ALSO
Class::Generic, Class::Array, Class::Scalar, Class::Number, Class::Boolean, Class::Assoc, Class::File, Class::DateTime, Class::Exception, Class::Finfo, Class::NullChain, Class::DateTime
AUTHOR
Jacques Deguest <jack@deguest.jp>
COPYRIGHT & LICENSE
Copyright (c) 2022 DEGUEST Pte. Ltd.
You can use, copy, modify and redistribute this package and associated files under the same terms as Perl itself.