Test::...leTemp(3pm)
π Test::MockFile::Plugin::FileTemp β the manual page, but make it cute π
okay bestie, so this is a page from the User Contributed Perl Documentation section, manual page 3pm. Yes, the header got truncated to Test::...leTemp(3pm) because apparently man pages also have a character limit and no self-esteem. π The actual module name is Test::MockFile::Plugin::FileTemp and we're gonna talk about it. Sit down, grab a strawberry π, we're doing this.
β¨ NAME β¨
Test::MockFile::Plugin::FileTemp β a plugin that lets File::Temp calls through, no cap π
β¨ SYNOPSIS β¨
okay so here's the whole vibe in code form. Look at it. Soak it in. πΈ
use Test::MockFile 'strict', plugin => 'FileTemp';
# using FileTemp plugin, all calls from FileTemp bypass the Test::MockFile strict mode
my $dir = File::Temp->newdir();
ok opendir( my $dh, "$dir" );
ok open( my $f, '>', "$dir/myfile.txt" );
That's it. That's the whole thing. It's giving minimalist icon. β¨
β¨ DESCRIPTION β¨
So here's what's actually going on π«Ά β Test::MockFile::Plugin::FileTemp gives Test::MockFile a plugin whose entire job is to authorize any calls coming out of the File::Temp package. Like, it's the bouncer at the club and File::Temp is on the list. Periodt. π
The trick is in that 'strict' in the SYNOPSIS β under strict mode, Test::MockFile normally wants to mock everything and would be very upset if something wandered off and touched the real filesystem. But with plugin => 'FileTemp' loaded, anything File::Temp does gets waved through instead of getting strict-mode'd into oblivion. It's giving β¨diplomatic immunityβ¨.
β¨ METHODS β¨
π register( $self )
A public method. Its whole purpose in life is to register the plugin. That's it, that's the job. $self goes in, registration happens, and the plugin is officially official. No notes. π
π SEE ALSO π
Test::MockFileβ the main character this plugin is attached to πTest::MockFile::Pluginsβ the whole plugin squad, iykyk π¦Test::MockModuleβ also in the Perl testing cinematic universe β
πΈ tiny reminder bestie: the facts above are the facts, the vibes are mine. Don't @ me if File::Temp does something spicy in your specific test suite. π
and that's the page, fr fr π this one's from perl v5.40.1, dated 2026-03-27, hanging out in the User Contributed Perl Documentation section. go write some tests, you ate. π β¨π
π¦ where this page comes from
- ubuntu stonking: libtest-mockfile-perl 0.039-1 Β· 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