« blib/lib/OAuthomatic/Internal/UsageGuard.pm
↑ Summary
blib/lib/OAuthomatic/UserInteraction/ViaMicroWeb.pm »
| 1 | #!/usr/local/bin/perl | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | |||
| 6 | # PODNAME: oauthomatic_predefined_servers | ||
| 7 | # ABSTRACT: list all predefined server definitions | ||
| 8 | our $VERSION = '0.01'; # VERSION | ||
| 9 | |||
| 10 | |||
| 11 | { | ||
| 12 | package RunMe; | ||
| 13 | use Moose; | ||
| 14 | with 'MooseX::Getopt'; | ||
| 15 | |||
| 16 | use OAuthomatic::ServerDef; | ||
| 17 | |||
| 18 | has 'compact' => (is=>'ro', isa=>'Bool'); | ||
| 19 | |||
| 20 | sub run { | ||
| 21 | my $self = shift; | ||
| 22 | |||
| 23 | my @predefined = oauthomatic_predefined_list(); | ||
| 24 | |||
| 25 | print "Known OAuthomatic servers:\n\n" unless $self->compact; | ||
| 26 | foreach my $srv (@predefined) { | ||
| 27 | if($self->compact) { | ||
| 28 | print $srv->site_name, "\n"; | ||
| 29 | } else { | ||
| 30 | print " ", $srv->site_name, "\n"; | ||
| 31 | print " oauth_temporary_url: ", $srv->oauth_temporary_url, "\n"; | ||
| 32 | print " oauth_authorize_page: ", $srv->oauth_authorize_page, "\n"; | ||
| 33 | print " oauth_token_url: ", $srv->oauth_token_url, "\n"; | ||
| 34 | print " site_client_creation_page: ", $srv->site_client_creation_page || "[undefined]", "\n"; | ||
| 35 | print " site_client_creation_desc: ", $srv->site_client_creation_desc || "[undefined]", "\n"; | ||
| 36 | print " site_client_creation_help: \n"; | ||
| 37 | my $help = $srv->site_client_creation_help || "[undefined]"; | ||
| 38 | $help =~ s{^}{ }gm; | ||
| 39 | print $help, "\n"; | ||
| 40 | } | ||
| 41 | } | ||
| 42 | |||
| 43 | } | ||
| 44 | |||
| 45 | }; | ||
| 46 | |||
| 47 | my $app = RunMe->new_with_options; | ||
| 48 | $app->run; | ||
| 49 | |||
| 50 | __END__ | ||
| 51 | |||
| 52 | =pod | ||
| 53 | |||
| 54 | =encoding UTF-8 | ||
| 55 | |||
| 56 | =head1 NAME | ||
| 57 | |||
| 58 | oauthomatic_predefined_servers - list all predefined server definitions | ||
| 59 | |||
| 60 | =head1 VERSION | ||
| 61 | |||
| 62 | version 0.01 | ||
| 63 | |||
| 64 | =head1 DESCRIPTION | ||
| 65 | |||
| 66 | Lists all OAuthomatic predefined servers known in current environment. | ||
| 67 | By default, shows various details, with C<--compact> option, only names. | ||
| 68 | |||
| 69 | =head1 AUTHOR | ||
| 70 | |||
| 71 | Marcin Kasperski <Marcin.Kasperski@mekk.waw.pl> | ||
| 72 | |||
| 73 | =head1 COPYRIGHT AND LICENSE | ||
| 74 | |||
| 75 | This software is copyright (c) 2015 by Marcin Kasperski. | ||
| 76 | |||
| 77 | This is free software; you can redistribute it and/or modify it under | ||
| 78 | the same terms as the Perl 5 programming language system itself. | ||
| 79 | |||
| 80 | =cut |