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

Object::Dumb - A dumb object that responds to any method and just returns 0

VERSION

This document describes version 0.02 of Object::Dumb (from Perl distribution Object-Dumb), released on 2016-06-16.

SYNOPSIS

 use Object::Dumb;

 my $obj = Object::Dumb->new;
 $obj->foo;          # -> 0
 $obj->bar(1, 2, 3); # -> 0

You can limit what methods will be available:

 my $obj = Object::Dumb->new(methods => [qw/foo bar/]);
 $obj->foo; # ok
 $obj->bar; # ok
 $obj->baz; # dies

or:

 my $obj = Object::Dumb->new(methods => qr/^(foo.*|bar.+)$/);
 $obj->foo;  # ok
 $obj->barb; # ok
 $obj->baz;  # dies

And you can also customize what value the methods will return:

 my $obj = Object::Dumb->new(returns => 1);
 print $obj->foo; # 1

DESCRIPTION

This module lets you create a "dumb" object that responds to any method and just returns 0.

You can customize by limiting what methods the object will respond to, and what value the methods will return.

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/Object-Dumb.

SOURCE

Source repository is at https://github.com/perlancar/perl-Object-Dumb.

BUGS

Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Object-Dumb

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

SEE ALSO

AUTHOR

perlancar <perlancar@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2016 by perlancar@cpan.org.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.