Test::S...ppOption(3)

πŸ“¦
version 1.84 Β· 2 versions
, in fedora 43

πŸ’– NAME πŸ’–

okay so bestie, welcome to Test::S...ppOption(3) from the User Contributed Perl Documentation girlies ✨

Test::Smoke::App::AppOption β€” it's literally an Object that represents an Application Option. that's the whole vibe. an option, but make it an object πŸ’…


🌸 SYNOPSIS 🌸

use Test::Smoke::App::AppOption;
my $o = Test::Smoke::App::AppOption->new(
);
printf "%s\n", $o->gol_option;
print $o->show_helptext;

look at her. she's constructed, she prints her gol_option, she prints her show_helptext. iconic behavior, no notes 🫢


✨ DESCRIPTION ✨

πŸŽ€ Test::Smoke::App::AppOption->new(%arguments)

this is the constructor, the main character moment, the birth of an option object πŸ‘‘

Arguments

these are Named, so pass them as key/value pairs bestie:

  • name => $basic_option_name β€” [required] like fr fr do NOT forget this one
  • option => $option_extention (see Getopt::Long)
  • allow => $arrary_ref_with alternatives
  • default => $default_value
  • helptext => $text_to_show_with help

Returns

An instance. a whole baby object, freshly spawned πŸ’–

Exceptions

she croak()s β€” yes, dramatically, as she should β€” when:

  • name not set
  • allow is not undef or ref($allow) is Regexp, CODE or ARRAY
so like, if you hand her an allow that's some random blessed thing that isn't one of those three, she's gonna yell at you. respect the boundaries πŸ’€

πŸ¦‹ $option->allowed($value[, $allow])

this one Checks if a value is in a set of allowed values. vibe check for your input, basically.

Arguments

Positional. in order, no names, just vibes:

  • $value (the value to check)
  • $allow [optional] β€” and $allow can be any of these:
    • ArrayRef => a list of allowed() items
    • Regex => a regex to test $value against.
    • CodeRef => a coderef that is executed with $value
    • other_value => $value eq $other_value (checks for definedness)

Returns

(perl) True of False. yes "of", that's what it says, we don't fix it, we respect it 🌈


πŸ’œ $opt->gol_option

Getopt::Long compatible option string. that's it. that's the whole thing. she gives you the string, you give it to Getopt::Long, everybody eats πŸ“


πŸ’… $opt->show_helptext()

sprintf "%-30s - %s", $option_with_allowd, $self->helptext

thirty-wide left-padded option, a lil dash, then the helptext. formatted. clean. slay ✨


(c) 2002-2013, Abe Timmerman <abeltje@cpan.org> All rights reserved.

With contributions from Jarkko Hietaniemi, Merijn Brand, Campo Weijerman, Alan Burlison, Allen Smith, Alain Barbet, Dominic Dunlop, Rich Rauenzahn, David Cantrell. the whole friend group showed up for this one 🫢

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See:

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

like yeah bestie, no promises, it's giving "use at your own risk" and honestly? valid 😭


and that's the page!! brought to you by perl v5.42.0, dated 2025-07-25 β€” mwah, go write some options, you got this πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’…

πŸ“¦ where this page comes from