From: Stevan Little Date: Fri, 23 Nov 2007 21:40:41 +0000 (+0000) Subject: no-getopt stuff X-Git-Tag: 0_07~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f969917f5cb650391a698751da4a219bec2fcdec;p=gitmo%2FMooseX-Getopt.git no-getopt stuff --- diff --git a/ChangeLog b/ChangeLog index 90e32b8..bdad45f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,6 @@ Revision history for Perl extension MooseX-Getopt -0.06 +0.06 Fri. Nov. 23, 2007 * MooseX::Getopt - refactored &new_with_option some so that this will work better with other Getopt diff --git a/lib/MooseX/Getopt/Meta/Attribute.pm b/lib/MooseX/Getopt/Meta/Attribute.pm index dada97c..082d807 100644 --- a/lib/MooseX/Getopt/Meta/Attribute.pm +++ b/lib/MooseX/Getopt/Meta/Attribute.pm @@ -3,7 +3,7 @@ package MooseX::Getopt::Meta::Attribute; use Moose; use Moose::Util::TypeConstraints; -our $VERSION = '0.03'; +our $VERSION = '0.04'; our $AUTHORITY = 'cpan:STEVAN'; extends 'Moose::Meta::Attribute'; # << Moose extending Moose :) @@ -16,9 +16,7 @@ has 'cmd_flag' => ( # This subtype is to support scalar -> arrayref coercion # without polluting the built-in types -subtype '_MooseX_Getopt_CmdAliases' - => as 'ArrayRef' - => where { 1 }; +subtype '_MooseX_Getopt_CmdAliases' => as 'ArrayRef'; coerce '_MooseX_Getopt_CmdAliases' => from 'Str' diff --git a/lib/MooseX/Getopt/Meta/NoGetopt.pm b/lib/MooseX/Getopt/Meta/NoGetopt.pm index c7c1d99..d0d859d 100644 --- a/lib/MooseX/Getopt/Meta/NoGetopt.pm +++ b/lib/MooseX/Getopt/Meta/NoGetopt.pm @@ -14,4 +14,66 @@ no Moose; package Moose::Meta::Attribute::Custom::NoGetopt; sub register_implementation { 'MooseX::Getopt::Meta::NoGetopt' } -1; \ No newline at end of file +1; + +__END__ + +=pod + +=head1 NAME + +MooseX::NoGetopt::Meta::Attribute - Optional meta attribute for custom option names + +=head1 SYNOPSIS + + package App; + use Moose; + + with 'MooseX::Getopt'; + + has 'data' => ( + metaclass => 'NoGetOpt', # do not attempt to capture this param + is => 'ro', + isa => 'Str', + default => 'file.dat', + ); + +=head1 DESCRIPTION + +This is a custom attribute metaclass which can be used to specify +that a specific attribute should B be processed by +C. All you need to do is specify the C +metaclass. + + has 'foo' => (metaclass => 'NoGetopt', ... ); + +=head1 METHODS + +=over 4 + +=item B + +=back + +=head1 BUGS + +All complex software has bugs lurking in it, and this module is no +exception. If you find a bug please either email me, or add the bug +to cpan-RT. + +=head1 AUTHOR + +Stevan Little Estevan@iinteractive.comE + +Chris Prather C<< >> + +=head1 COPYRIGHT AND LICENSE + +Copyright 2007 by Infinity Interactive, Inc. + +L + +This library is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut diff --git a/lib/MooseX/Getopt/Strict.pm b/lib/MooseX/Getopt/Strict.pm index d5cb38a..990f6a8 100644 --- a/lib/MooseX/Getopt/Strict.pm +++ b/lib/MooseX/Getopt/Strict.pm @@ -1,14 +1,14 @@ -#!/usr/bin/perl package MooseX::Getopt::Strict; use Moose::Role; -with qw/MooseX::Getopt/; +with 'MooseX::Getopt'; sub _compute_getopt_attrs { my ( $class, @args ) = @_; - - grep { $_->isa("MooseX::Getopt::Meta::Attribute") } $class->MooseX::Getopt::_compute_getopt_attrs(@args); + grep { + $_->isa("MooseX::Getopt::Meta::Attribute") + } $class->MooseX::Getopt::_compute_getopt_attrs(@args); } __PACKAGE__;