EXTUTILS::PL2BAT(3perl)

πŸ’– ExtUtils::PL2Bat β€” batch file creation to run perl scripts on Windows πŸ’–

okay bestie, so this is ExtUtils::PL2Bat from the Perl Programmers Reference Guide, and it's literally the glow-up your perl script needs to be a real Windows program. no cap.

✨ VERSION ✨

version 0.005 β€” she's smol but she's iconic πŸ’…


🌸 OVERVIEW 🌸

so the way this works: this module converts a perl script into a batch file that can be executed on Windows/DOS-like operating systems. that's the whole vibe. πŸ¦‹

why tho?? because it's intended to allow you to use a Perl script like regular programs and batch files β€” where you just enter the name of the script [probably minus the extension] plus any command-line arguments, and the script is found in your PATH and run. main character energy, fr fr. no more typing weird perl incantations, you just say the name and she goes. ✨


πŸŽ€ FUNCTIONS πŸŽ€

pl2bat(%opts)

This function takes a perl script and writes a batch file that contains the script. This is sometimes necessary. (yes, "sometimes necessary" is doing a LOT of heavy lifting in that sentence, but we respect the honesty πŸ™ˆ)

here's the opts, and yes you can tune all of them:

  • in β€” The name of the script that is to be batchified. This argument is mandatory. you cannot skip her, she's required, periodt. πŸ‘‘
  • out β€” The name of the output batch file. If not given, it will be generated using in and stripsuffix. so like, she'll figure out a name for herself if you don't hand her one πŸ’…
  • ntargs β€” Arguments to invoke perl with in generated batch file when run from Windows NT. Defaults to '-x -S %0 %*'. that's the NT-friendly path, slay. πŸͺŸ
  • otherargs β€” Arguments to invoke perl with in generated batch file except when run from Windows NT (ie. when run from DOS, Windows 3.1, or Windows 95). Defaults to '-x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9'. yes bestie, that's nine whole positional args, she did the absolute most and we love her for it 😭✨
  • stripsuffix β€” Strip a suffix string from file name before appending a ".bat" suffix. The suffix is not case-sensitive. It can be a regex or a string and a trailing "$" is always assumed). Defaults to qr/\.plx?/. cute little regex, doing cute little regex things πŸ’œ
  • usewarnings β€” With the usewarnings option, " -w" is added after the value of $Config{startperl}. If a line matching /^#!.*perl/ already exists in the script, then it is not changed and the -w option is ignored. so like, if your shebang already showed up to the party, she's not gonna touch it. rude to interrupt. 🫢
  • update β€” If the script appears to have already been processed by pl2bat, then the script is skipped and not processed unless update was specified. If update is specified, the existing preamble is replaced. so without update she's like "already been here, bye πŸ’€" and with update she's like "okay lemme redo the whole intro, no biggie" 🎬
ngl, that update behavior is the one you'll trip on if your script looks pre-batchified and just... doesn't change. she's not broken, she's just being selective. πŸ™ˆ

🌈 ACKNOWLEDGEMENTS 🌈

This code was taken from Module::Build and then modified; which had taken it from perl's pl2bat script. This module is an attempt at unifying all three implementations. three icons, one crown, the family reunion we deserved πŸ‘‘πŸ‘‘πŸ‘‘


πŸ’œ AUTHOR πŸ’œ

Leon Timmermans <leont@cpan.org> β€” absolute legend, thank you for your service, we are obsessed 🫢✨


This software is copyright (c) 2015 by Leon Timmermans.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. free as in go off, bestie πŸ¦‹


okay that's the whole page!! this was perl v5.44.0, dated 2026-10-17, straight from ExtUtils::PL2Bat(3perl) β€” go batchify something cute. bye bestie, ily πŸ’–πŸŽ€πŸŒΈ

πŸ“¦ where this page comes from
  • arch rolling: perl 5.44.0-1 Β· Artistic-1.0-Perl AND 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