/usr/share/perl5/MooseX/App/Command.pm is in libmoosex-app-perl 1.39-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | # ============================================================================
package MooseX::App::Command;
# ============================================================================
use 5.010;
use utf8;
use strict;
use warnings;
use Moose ();
use MooseX::App::Meta::Role::Attribute::Option;
use MooseX::App::Exporter qw(option parameter command_short_description command_long_description command_usage command_strict);
use Moose::Exporter;
Moose::Exporter->setup_import_methods(
with_meta => [qw(command_short_description command_long_description command_strict command_usage option parameter extends)],
also => 'Moose',
);
sub init_meta {
my ($class,%args) = @_;
my $meta = Moose->init_meta( %args );
init_class($meta);
return $meta;
}
sub extends {
my $meta = shift;
$meta->superclasses(@_);
# Need to re-init meta class, just in case
init_class($meta);
}
sub init_class {
my $meta = shift;
Moose::Util::MetaRole::apply_metaroles(
for => $meta,
class_metaroles => {
class => [
'MooseX::App::Meta::Role::Class::Documentation',
'MooseX::App::Meta::Role::Class::Command'
],
attribute => [
'MooseX::App::Meta::Role::Attribute::Option'
],
},
);
unless ($meta->DOES('MooseX::App::Role::Common')) {
Moose::Util::MetaRole::apply_base_class_roles(
for => $meta->name,
roles => ['MooseX::App::Role::Common'],
);
}
}
1;
__END__
=pod
=head1 NAME
MooseX::App::Command - Load command class metaclasses
=head1 SYNOPSIS
package MyApp::SomeCommand;
use MooseX::App::Command; # Also loads Moose
option 'testattr' => (
isa => 'rw',
cmd_tags => [qw(Important! Nice))],
);
command_short_description 'This is a short description';
command_long_description 'This is a much longer description yadda yadda';
command_usage 'script some_command --testattr 123';
=head1 DESCRIPTION
By loading this class into your command classes you import all required
symbols, and enable all documentation features such as:
=over
=item * Parsing command documentation from Pod
=item * Setting the command documentation manually via C<command_short_description> and C<command_long_description>
=item * Overriding the automated usage header with custom usage from Pod or via C<command_usage>
=item * Adding the C<cmd_tags>, C<cmd_flag>, C<cmd_aliases> and C<cmd_type> attributes to options
=back
=head1 FUNCTIONS
=head2 command_short_description
Set the short description. If not set this information will be taken from the
Pod NAME or ABSTRACT section. Alternative this will be taken from the
DistZilla ABSTRACT tag.
=head2 command_long_description
Set the long description. If not set this information will be taken from the
Pod DESCRIPTION or OVERVIEW sections.
=head2 command_usage
Set custom usage. If not set this will be taken from the Pod SYNOPSIS or
USAGE section. If those sections are not available, the usage
information will be autogenerated.
=head2 command_strict
command_strict(0); # default
OR
command_strict(1);
If strict is enabled the program will terminate with an error message if
superfluous/unknown positional parameters are supplied. If disabled all
extra parameters will be copied to the L<extra_argv> attribute.
The app_strict function in the app classes allows one to set this option
globally.
=cut
1;
|