use OO syntax for handling subref
[gitmo/MooseX-Getopt.git] / lib / MooseX / Getopt / Strict.pm
index d5cb38a..8241b14 100644 (file)
@@ -1,40 +1,26 @@
-#!/usr/bin/perl
-
 package MooseX::Getopt::Strict;
+# ABSTRACT: only make options for attrs with the Getopt metaclass
+
 use Moose::Role;
 
-with qw/MooseX::Getopt/;
+with 'MooseX::Getopt';
 
-sub _compute_getopt_attrs {
+around '_compute_getopt_attrs' => sub {
+    my $next = shift;
     my ( $class, @args ) = @_;
+    grep {
+        $_->does("MooseX::Getopt::Meta::Attribute::Trait")
+    } $class->$next(@args);
+};
 
-    grep { $_->isa("MooseX::Getopt::Meta::Attribute") } $class->MooseX::Getopt::_compute_getopt_attrs(@args);
-}
-
-__PACKAGE__;
-
-__END__
-
-=pod
-
-=head1 NAME
-
-MooseX::Getopt::Strict - only make options for attrs with the Getopt metaclass
-
-=head1 SYNOPSIS
-
-    # see MooseX::Getopt
-
-=over 4
-
-=item meta
+no Moose::Role;
 
-Is a section devoted to making the #!#%^ stupid pod coverage test pass. Stevan, I do
-hope you're actually reading this.
+1;
 
-Love,
-Yuval
+=head1 DESCRIPTION
 
-=back
+This is an stricter version of C<MooseX::Getopt> which only processes the
+attributes if they explicitly set as C<Getopt> attributes. All other attributes
+are ignored by the command line handler.
 
 =cut