Test::Mock::LWP(3pm)
π Test::Mock::LWP π
okay so bestie, welcome to Test::Mock::LWP β it's the User Contributed Perl Documentation's little gift to you, and it's literally about making mocking LWP packages easy. no cap. π¦
β¨ NAME β¨
Test::Mock::LWP β Easy mocking of LWP packages π
πΈ SYNOPSIS πΈ
Make LWP packages to make testing easier. that's the whole vibe, fr fr.
use Test::Mock::LWP;
# Setup fake response content and code
$Mock_response->mock( content => sub { 'foo' } );
$Mock_resp->mock( code => sub { 201 } );
# Validate args passed to request constructor
is_deeply $Mock_request->new_args, \@expected_args;
# Validate request headers
is_deeply [ $Mock_req->next_call ],
[ 'header', [ 'Accept', 'text/plain' ] ];
# Special User Agent Behaviour
$Mock_ua->mock( request => sub { die 'foo' } );
look at that. iconic. π
π DESCRIPTION π
So the tea is: this package exists because the author kept duplicating the same code to mock LWP et al in several different modules he'd written. like, copy-paste city. π This version is very minimalist, but it works for his needs so far β and he is very open to new suggestions and improvements. so if you got ideas, he wants them. π«Ά
π EXPORTS π
The following variables are exported by default:
$Mock_uaβ the mockLWP::UserAgentobject, which is aTest::MockObjectobject. main character energy tbh.$Mock_req,$Mock_requestβ the mockHTTP::Requestobject, which is aTest::MockObjectobject. two names, one icon. π$Mock_resp,$Mock_responseβ the mockHTTP::Responseobject, which is aTest::MockObjectobject. also serving double-name realness. π
π AUTHOR π
Luke Closs, "<test-mock-lwp at 5thplane.com>" β we stan. π
π BUGS π
Please report any bugs or feature requests through the web interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-Mock-LWP>.
he'll be notified, and then you'll automatically be notified of progress on your bug as he makes changes. mutual notif bestie behaviour. π
π§ SUPPORT π§
You can find documentation for this module with the perldoc command. it's giving self-serve:
perldoc Test::Mock::LWP
You can also look for information at:
- AnnoCPAN: Annotated CPAN documentation
- CPAN Ratings
- RT: CPAN's request tracker
- Search CPAN
π ACKNOWLEDGEMENTS π
(ngl this section is empty in the original β nothing listed here, so nothing for me to hype up. π)
π COPYRIGHT & LICENSE π
Copyright 2006 Luke Closs, all rights reserved. β¨
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
okay that's the whole page, and for the sign-off: this was perl v5.34.0, dated 2022-06-28, and it lives under the name Test::Mock::LWP(3pm). go mock some LWP, bestie β periodt. πβ¨ππ¦πΈπ π«Ά
π¦ where this page comes from
- debian bookworm: libtest-mock-lwp-perl 0.08-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libtest-mock-lwp-perl 0.08-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libtest-mock-lwp-perl 0.08-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libtest-mock-lwp-perl 0.08-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libtest-mock-lwp-perl 0.08-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