File Coverage

blib/lib/WebService/Mattermost/Helper/Alias.pm
Criterion Covered Total %
statement 18 18 100.0
branch n/a
condition n/a
subroutine 7 7 100.0
pod 1 3 33.3
total 26 28 92.8


line stmt bran cond sub pod time code
1             package WebService::Mattermost::Helper::Alias;
2:

3: # ABSTRACT: Alias helper for shortening package names. 4:
5: use strict;
6: use warnings;
7:
8: use Readonly;
9:
10: require Exporter;
11:
12: use vars qw(@ISA @EXPORT_OK);
13:
14: @ISA = 'Exporter';
15: @EXPORT_OK = qw(util v4 view);
16:
17: Readonly::Scalar my $util_base => 'WebService::Mattermost::Util::';
18: Readonly::Scalar my $v4_base => 'WebService::Mattermost::V4::API::Resource::';
19: Readonly::Scalar my $view_base => 'WebService::Mattermost::V4::API::Object::';
20:
21: ################################################################################
22:
23: sub util {
24: my $name = shift;
25:
26: return sprintf('%s%s', $util_base, $name);
27: }
28:
29: sub v4 {
30: my $name = shift;
31:
32: return sprintf('%s%s', $v4_base, $name);
33: }
34:
35: sub view {
36: my $name = shift;
37:
38: return sprintf('%s%s', $view_base, $name);
39: }
40:
41: ################################################################################
42:
43: 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
91: