Test::S...:Capture(3)
π Test::Stream::Plugin::Capture β the manual page, bestie edition β¨
okay so this is the page for Test::Stream::Plugin::Capture(3) β yeah it's a User Contributed Perl Documentation page, and yeah we're gonna read it together, it's fine, it's literally fine π«Ά
πΈ NAME πΈ
Test::Stream::Plugin::Capture β the plugin that snatches up your STDERR and STDOUT for you. it's giving "I'll hold your bags while you shop" energy π
π DEPRECATED π
bestie. sit down. π
This whole distribution is deprecated in favor of Test2, Test2::Suite, and Test2::Workflow.
There's a whole conversion guide over in Test::Stream::Manual::ToTest2 if you wanna make the move β highly recommend, it's the glow-up arc π
π¦ DESCRIPTION π¦
So this plugin hands you the capture { ... } function, right? and what it does is it captures all STDERR and STDOUT output from whatever code you put inside that codeblock. every last print, all of it, collected. obsessed. β¨
Now here's the part that's lowkey the best: it will not intercept TAP output from Test::Stream itself. so you can literally run tests inside the block and it won't mess with your TAP. safe. iconic. no cap. π
π SYNOPSIS π
look at this beautiful example, I'm not crying you're crying π
is(
capture {
print STDERR "First STDERR\n";
print STDOUT "First STDOUT\n";
print STDERR "Second STDERR\n";
print STDOUT "Second STDOUT\n";
},
{
STDOUT => "First STDOUT\nSecond STDOUT\n",
STDERR => "First STDERR\nSecond STDERR\n",
},
"Captured stdout and stderr"
);
see how both handles get their own string, in order, all tidy? chef's kiss π§π³π
π EXPORTS π
$out = capture { ... }β this is the one and only export, and it's the main character. it captures all STDERR and STDOUT output inside the codeblock.$outcomes back as a hashref withSTDERRandSTDOUTas its keys. and ngl, all the output for each handle gets combined into a single string per handle β so no line-by-line nonsense, just one big string per stream. periodt. π
π₯ SOURCE π₯
The source code repository for Test::Stream lives at:
http://github.com/Test-More/Test-Stream/
go star it, go read it, go be nosy, it's your right π«Ά
π MAINTAINERS π
- Chad Granum
<exodist@cpan.org>
π AUTHORS π
- Chad Granum
<exodist@cpan.org>
β COPYRIGHT β
Copyright 2015 Chad Granum <exodist7@gmail.com>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See http://dev.perl.org/licenses/
and that's the whole page, bestie β every flag, every key, every name, nothing skipped, we ate that πβ¨
k byeeee, this was perl v5.42.0, dated 2025-07-25, page Test::S...:Capture(3) β mwah, go capture something ππ¦π
π¦ where this page comes from
- fedora 43: perl-Test-Stream 1.302027-35.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms