Getopt...::Bool(3pm)

πŸ“¦ version 2.000011, in ubuntu stonking

Getopt::Yath::Option::Bool πŸ’–

okay bestie, gather round, because this is the manual page for Getopt::Yath::Option::Bool β€” it lives in the 3pm section (User Contributed Perl Documentation), and it is so much simpler than its cousins. it's giving "option type for boolean values (no arguments)". that's the whole personality. πŸŽ€


✨ NAME ✨

Getopt::Yath::Option::Bool β€” it's the option type for boolean values (no arguments), periodt. πŸ’…


🌸 DESCRIPTION 🌸

okay so picture this: a value that is either on or off. that's it, that's the vibe. πŸ¦‹

  • --opt β€” turns it on βœ…
  • --no-opt β€” turns it off ❌

and the default? off. lowkey always off unless you hand it a default parameter. no cap. πŸ’―


⭐ SYNOPSIS ⭐

here's how you actually use it, bestie β€” look how cute:

option dry_run => (
    type => 'Bool',
    description => "Only pretend to do stuff",
    default => 0,
);

iconic. a dry_run that only pretends to do stuff. main character energy fr fr. 😭✨


🧚 METHODS 🧚

every single method from Getopt::Yath::Option is inherited, so you get all of that for free 🫢. the ones below are either overridden or just noteworthy enough that we're calling them out.

  • requires_arg: false β€” nope, no argument required. it's a bool, it doesn't need your little inputs. πŸ’…
  • allows_arg: false β€” also no argument allowed, for the record. bool options take no argument. --opt turns it on, --no-opt turns it off. that's the whole deal. πŸŽ€
  • can_set_env: true β€” ohhh yes, bool options can set environment variables. and here's the spicy part: negated env vars (!VAR) are supported and they will invert the boolean value. so !VAR is basically the "actually, no πŸ’€" button. 🌈
  • get_default_value β€” returns 0 by default, unless you gave it a custom default. simple as that. no notes. πŸ‘‘

πŸ”₯ SOURCE πŸ”₯

the source code repository for Getopt-Yath can be found at http://github.com/Test-More/Getopt-Yath/ β€” go look, it's right there. πŸ‘€


πŸ‘‘ MAINTAINERS πŸ‘‘

  • Chad Granum <exodist@cpan.org>

πŸ’œ AUTHORS πŸ’œ

  • Chad Granum <exodist@cpan.org>

(yes bestie, same name in both lists, that's not a typo, that's just how it is πŸ™ˆ)


Copyright 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/


friendly reminder: it's free software, go wild, but under the same terms as Perl itself, okay? πŸ’–

and that's the whole page, bestie β€” perl v5.40.1, dated 2026-05-10. slay, you now officially understand bool options. go forth and toggle things. πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from