TomDLux has asked for the wisdom of the Perl Monks concerning the following question:

Looking for help with MooseX::Getopt::GLD.

My understanding is that this allows you to specify documentation strins in the attribute declaration, so that -help or -man generates output. Equivalent to POD::Usage, but localized to the declaration it applies to, rather than spread out. Maybe I'm making stuff up, I hope not.

Unfortunately, MooseX::Getopt::GLD POD just references Getopt::Long::Descriptive, doesn't say how to use it. G::L::Descriptive uses a hash to associate the Getopt::Long spec string with the associated dcumentation, so I don't see how to stick that into a Moose declaration.

Any informative suggestions?

--
TTTATCGGTCGTTATATAGATGTTTGCA

  • Comment on How to specify MooseX::Getopt::GLD components?

Replies are listed 'Best First'.
Re: How to specify MooseX::Getopt::GLD components?
by Anonymous Monk on Dec 03, 2009 at 07:59 UTC
    That module is only 30 lines of actual code and it is broken.

    There is a FIXME note in the source

    $opt->{doc} || ' ', # FIXME new GLD shouldn't need this hack
    which lead me to try
    #!/usr/bin/perl -- BEGIN { package My::App; BEGIN { $INC{'My/App.pm'} = __FILE__; } use Moose; with 'MooseX::Getopt::GLD'; has 'out' => (is => 'rw', isa => 'Str', required => 1, doc => "yo" +, ); has 'in' => (is => 'rw', isa => 'Str', required => 1, doc => "yo +ho", ); } #!/usr/bin/perl -- use My::App; my $app = My::App->new_with_options();
    but that doesn't work (Found unknown argument(s) passed to 'in' attribute constructor in 'Moose::Meta::Attribute': doc)

    Related bug #47865: Help and usage don't seem to work with Getopt::Long::Descriptive

Re: How to specify MooseX::Getopt::GLD components?
by stvn (Monsignor) on Dec 03, 2009 at 19:38 UTC

    Have you tried updating Getopt::Long::Descriptive? I seem to remember that being required for a recent bugfix. Beyond that I can't help much since I never really use that feature (although I probably should). You might also want to send a mail to the moose mailing list as many people are there that are not here.

    -stvn
Re: How to specify MooseX::Getopt::GLD components?
by TomDLux (Vicar) on Dec 04, 2009 at 21:53 UTC

    Answer 1 - I'm stupid,and looked everywhere except the place where it refers to the documentation component and the --help, --usage, and --? command line flags.

    Answer 2 - Morgan Stanley has a bug in an internal system ( MSDW::Version ), which SHOULD have notified me that it wasn't finding Params-Validate. Adding that fixed it.

    --
    TTTATCGGTCGTTATATAGATGTTTGCA