MooseX...:Trait(3pm)

πŸ’– MooseX::Getopt::Meta::Attribute::Trait πŸ’–

okay bestie, welcome to the manual page for MooseX::Getopt::Meta::Attribute::Trait β€” that's the name, that's the whole vibe, and yes it is long. It ships as part of the User Contributed Perl Documentation, so you know it's community-made with love. ✨

It's the optional meta attribute trait for custom option names. Basically: you want your command line flags to be called something other than what Moose auto-picks for you? This is the girl for the job. πŸ‘‘


🌸 VERSION 🌸

version 0.78 β€” periodt.


πŸ¦‹ SYNOPSIS πŸ¦‹

  package App;
  use Moose;

  with 'MooseX::Getopt';

  has 'data' => (
      traits    => [ 'Getopt' ],
      is        => 'ro',
      isa       => 'Str',
      default   => 'file.dat',

      # tells MooseX::Getopt to use --somedata as the
      # command line flag instead of the normal
      # autogenerated one (--data)
      cmd_flag  => 'somedata',

      # tells MooseX::Getopt to also allow --moosedata,
      # -m, and -d as aliases for this same option on
      # the commandline.
      cmd_aliases => [qw/ moosedata m d /],

      # Or, you can use a plain scalar for a single alias:
      cmd_aliases => 'm',
  );

✨ DESCRIPTION ✨

So here's the tea β˜•: this is a custom attribute metaclass trait. You use it to say exactly which command line flag you want, instead of just letting MooseX::Getopt cook up the default one for you. You're the main character, you pick your own flag names. πŸ’…


πŸŽ€ METHODS πŸŽ€

cmd_flag

Changes the command-line flag to be this value, instead of the default. And what's the default, you ask? It's the same as the attribute name. Simple as that. 🌈

cmd_aliases

Adds more aliases for this command-line flag. Super useful for short options and such β€” you know, the little single-letter girlies. πŸ“

has_cmd_flag

has_cmd_aliases


🫢 SUPPORT 🫢

Got bugs? 😭 Don't suffer in silence, submit them through the RT bug tracker:

There's also a mailing list for users of this distribution, hanging out at <http://lists.perl.org/list/moose.html>. πŸ“¬

And if you wanna chat live, there's an irc channel for users of this distribution: #moose on irc.perl.org β€” <irc://irc.perl.org/#moose>. Come say hi, iykyk. πŸ’¬


πŸ‘‘ AUTHOR πŸ‘‘

Stevan Little <stevan@iinteractive.com> β€” icon, legend, the moment.


This software is copyright (c) 2007 by Infinity Interactive, Inc.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. πŸ•ŠοΈ


and that's the whole page bestie!! this was documented with perl v5.40.0 on 2025-01-11 β€” go forth and name your flags whatever your heart desires πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from