The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

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.0

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::Array, Class::Scalar, Class::Number, Class::Boolean, Class::Assoc, Class::File, Class::DateTime, Class::Exception, Class::Finfo, Class::NullChain

AUTHOR

Jacques Deguest <jack@deguest.jp>

COPYRIGHT & LICENSE

Copyright (c) 2021 DEGUEST Pte. Ltd.

You can use, copy, modify and redistribute this package and associated files under the same terms as Perl itself.