Mock::...ontrol(3pm)
π Mock::Quick::Object::Control(3pm) π
okay bestie, so this is the manual page for Mock::Quick::Object::Control β like, the control half of the Mock::Quick::Object situation. It lives in the User Contributed Perl Documentation corner of the internet, and yes, the title really is abbreviated with dots like Mock::...ontrol(3pm) because manpage headers are dramatic like that. π
β¨ NAME β¨
Mock::Quick::Object::Control β the whole vibe is: you control a mocked object after it's already been created. that's it, that's the job. π
π¦ DESCRIPTION π¦
Control a mocked object after creation. fr fr, that's the entire description. it's giving "short and iconic." π
πΈ SYNOPSIS πΈ
here's the tea, copied exactly so you don't break anything:
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 );
see that last bit? setting an attribute to undef is how you make it exist so it can actually be used for get/set operations. not me learning that the hard way π
π METHODS π
okay so here's every single one, no skips, no cap:
$control = $CLASS->new( $obj )β the constructor, bestie. hand it your$objand it hands you back a$control. π«Ά$control->set_methods( name => sub { ... }, ... )β Set/Create methods. you pass name-and-coderef pairs and boom, methods exist now. β$control->set_attributes( name => $val, ... )β Set/Create attributes (simple get/set accessors). the most basic accessor energy, and honestly? we love her. π$control->clear( $name1, $name2, ... )β Remove attributes/methods. yeet them by name. π§$control->strict( $BOOL )β Enable/Disable strict mode. you pass a$BOOL, so1/0vibes, and strict mode turns on or off accordingly. π₯$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. so it's like a little call counter for your mocks, and if you touch the method the count just disappears. main character behavior honestly π
π AUTHORS π
Chad Granum exodist7@gmail.com
shoutout to Chad, absolute legend π«‘
π 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.
not me putting the ALL-CAPS bits in bold because they're legally doing the most π no warranty, bestie, that part is real.
okay that's the whole page!! it's from perl v5.34.0, dated 2022-06-15, and it's filed under Mock::...ontrol(3pm) in the User Contributed Perl Documentation. go forth and control your mocks, queen πΈβ¨π¦
π¦ where this page comes from
- debian bookworm: libmock-quick-perl 1.111-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libmock-quick-perl 1.111-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libmock-quick-perl 1.111-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libmock-quick-perl 1.111-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libmock-quick-perl 1.111-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms