logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Mock::Quick::Object - Object mocking for Mock::Quick

Authors

       Chad Granum exodist7@gmail.com

Description

       Provides object mocking. See Mock::Quick for a better interface.

Name

       Mock::Quick::Object - Object mocking for Mock::Quick

Synopsis

           use Mock::Quick::Object;
           use Mock::Quick::Method;

           my $obj = Mock::Quick::Object->new(
               foo => 'bar',            # define attribute
               do_it => qmeth { ... },  # define method
               ...
           );

           is( $obj->foo, 'bar' );
           $obj->foo( 'baz' );
           is( $obj->foo, 'baz' );

           $obj->do_it();

           # define the new attribute automatically
           $obj->bar( 'xxx' );

           # define a new method on the fly
           $obj->baz( Mock::Quick::Method->new( sub { ... });

           # remove an attribute or method
           $obj->baz( \$Mock::Quick::Util::CLEAR );

See Also