Mojolicious-Plugin-Util-Endpoint
view release on metacpan or search on metacpan
lib/Mojolicious/Plugin/Util/Endpoint/endpoints.pm view on Meta::CPAN
package Mojolicious::Plugin::Util::Endpoint::endpoints;
use Mojo::Base 'Mojolicious::Command';
use Getopt::Long qw/GetOptions :config no_auto_abbrev no_ignore_case/;
has description => "Show available endpoints.\n";
has usage => <<"EOF";
usage: $0 endpoints
perl app.pl endpoints
EOF
# Run endpoints
sub run {
my $self = shift;
# Options
local @ARGV = @_;
my $c = $self->app->build_controller;
$c->app($self->app);
# Get endpoints
my $endpoints = $c->get_endpoints;
# No endpoints
return unless $endpoints;
# Print all endpoints
foreach my $name (sort { $a cmp $b } keys %$endpoints) {
printf " %-20s %s\n", qq{"$name"}, $endpoints->{$name};
};
print "\n";
return;
};
1;
__END__
=pod
=head1 NAME
Mojolicious::Plugin::Util::Endpoint::endpoints - List Template URIs
=head1 SYNOPSIS
use Mojolicious::Plugin::Util::Endpoint::endpoints;
my $ep = Mojolicious::Plugin::Util::Endpoint::endpoints->new;
$ep->run;
=head1 DESCRIPTION
L<Mojolicious::Plugin::Util::Endpoint::endpoints> lists all
endpoints established by L<Mojolicious::Plugin::Util::Endpoint>.
It is normally started from the command line:
$ perl app.pl endpoints
=head1 ATTRIBUTES
L<Mojolicious::Plugin::Util::Endpoint::endpoints> inherits all
attributes from L<Mojolicious::Command> and implements the following
new ones.
=head2 description
my $description = $ep->description;
$ep = $ep->description('Foo!');
( run in 2.426 seconds using v1.01-cache-2.11-cpan-98e64b0badf )