| 1 | package WebService::Mattermost::Helper::Alias; | ||
| 2 | |||
| 3 | # ABSTRACT: Alias helper for shortening package names. | ||
| 4 | |||
| 5 | 15 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 15 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 15 | ▶ | use Readonly; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | |||
| 10 | 15 | require Exporter; | |
| 11 | |||
| 12 | 15 | ▶ | use vars qw(@ISA @EXPORT_OK); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 13 | |||
| 14 | 15 | @ISA = 'Exporter'; | |
| 15 | 15 | @EXPORT_OK = qw(util v4 view); | |
| 16 | |||
| 17 | 15 | Readonly::Scalar my $util_base => 'WebService::Mattermost::Util::'; | |
| 18 | 15 | Readonly::Scalar my $v4_base => 'WebService::Mattermost::V4::API::Resource::'; | |
| 19 | 15 | Readonly::Scalar my $view_base => 'WebService::Mattermost::V4::API::Object::'; | |
| 20 | |||
| 21 | ################################################################################ | ||
| 22 | |||
| 23 | sub util { | ||
| 24 | 25 | ▶ | my $name = shift; |
|
Subroutine
util: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 25 | |||
| 26 | 25 | return sprintf('%s%s', $util_base, $name); | |
| 27 | } | ||
| 28 | |||
| 29 | sub v4 { | ||
| 30 | 2235 | ▶ | my $name = shift; |
|
Subroutine
v4: called CC=1 SCAR=0.0
Pod
documented
| |||
| 31 | |||
| 32 | 2235 | return sprintf('%s%s', $v4_base, $name); | |
| 33 | } | ||
| 34 | |||
| 35 | sub view { | ||
| 36 | 79 | ▶ | my $name = shift; |
|
Subroutine
view: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 37 | |||
| 38 | 79 | return sprintf('%s%s', $view_base, $name); | |
| 39 | } | ||
| 40 | |||
| 41 | ################################################################################ | ||
| 42 | |||
| 43 | 15 | 1; | |
| 44 | |||
| 45 | __END__ | ||
| 46 | |||
| 47 | =pod | ||
| 48 | |||
| 49 | =encoding UTF-8 | ||
| 50 | |||
| 51 | =head1 NAME | ||
| 52 | |||
| 53 | WebService::Mattermost::Helper::Alias - Alias helper for shortening package names. | ||
| 54 | |||
| 55 | =head1 VERSION | ||
| 56 | |||
| 57 | version 0.28 | ||
| 58 | |||
| 59 | =head1 DESCRIPTION | ||
| 60 | |||
| 61 | Static helpers used in the library. | ||
| 62 | |||
| 63 | =head2 METHODS | ||
| 64 | |||
| 65 | =over 4 | ||
| 66 | |||
| 67 | =item C<v4()> | ||
| 68 | |||
| 69 | Format the name of an endpoint for the version 4 API. | ||
| 70 | |||
| 71 | use WebService::Mattermost::Helper::Alias 'v4'; | ||
| 72 | |||
| 73 | print v4 'Teams'; # prints WebService::Mattermost::API::v4::Resource::Teams | ||
| 74 | print util 'UserAgent'; # prints WebService::Mattermost::Util::UserAgent | ||
| 75 | |||
| 76 | =back | ||
| 77 | |||
| 78 | =head1 AUTHOR | ||
| 79 | |||
| 80 | Mike Jones <mike@netsplit.org.uk> | ||
| 81 | |||
| 82 | =head1 COPYRIGHT AND LICENSE | ||
| 83 | |||
| 84 | This software is Copyright (c) 2020 by Mike Jones. | ||
| 85 | |||
| 86 | This is free software, licensed under: | ||
| 87 | |||
| 88 | The MIT (X11) License | ||
| 89 | |||
| 90 | =cut | ||