Mock::Quick::Object::Control(3pm)

Mock::Quick::Object::Control3pm

Control a mocked object after creation

Usage

    my $obj = Mock::Quick::Object->new( ... );
    my $control = Mock::Quick::Object::Control->new( $obj );
    $control->set_methods( foo => sub { 'foo' });
    $control->set_attributes( bar => 'baz' );
    # Make an attribute exist so that it can be used for get/set operations.
    $control->set_attributes( empty => undef );

Overview

Control a mocked object after creation.

Methods

$control = $CLASS->new( $obj )
$control->set_methods( name => sub { ... }, ... )

Set/Create methods

$control->set_attributes( name => $val, ... )

Set/Create attributes (simple get/set accessors)

$control->clear( $name1, $name2, ... )

Remove attributes/methods.

$control->strict( $BOOL )

Enable/Disable strict mode.

$data = $control->metrics()

Returns a hash where keys are method names, and values are the number of times the method has been called. When a method is altered or removed the key is deleted.

Releases

6 releases since Debian 8 (Jessie); the text changed 2 times.

  1. 8
  2. 9–11
  3. 12–13

Authors

Chad Granum [email protected]

From libmock-quick-perl 1.111-2 in Debian 13 (Trixie). Parsed by carta from the page's man source.