---
name: "Mock::Quick::Object::Control"
section: "3pm"
platform: "linux"
package: "libmock-quick-perl"
version: "1.111-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Mock::Quick::Object::Control"
---

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

Control a mocked object after creation

## NAME

Mock::Quick::Object::Control - Control a mocked object after creation

## DESCRIPTION

Control a mocked object after creation.

## SYNOPSIS

```
    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 );
```

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

## AUTHORS

Chad Granum exodist7@gmail.com

## COPYRIGHT

Copyright (C) 2011 Chad Granum

Mock-Quick is free software; Standard perl licence.

Mock-Quick is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
