| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Slack::BlockKit::Block::Image 0.005; |
|
2
|
|
|
|
|
|
|
# ABSTRACT: a Block Kit image block, used to show an image |
|
3
|
|
|
|
|
|
|
|
|
4
|
4
|
|
|
4
|
|
29
|
use Moose; |
|
|
4
|
|
|
|
|
9
|
|
|
|
4
|
|
|
|
|
30
|
|
|
5
|
4
|
|
|
4
|
|
27814
|
use MooseX::StrictConstructor; |
|
|
4
|
|
|
|
|
8
|
|
|
|
4
|
|
|
|
|
35
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
with 'Slack::BlockKit::Role::Block'; |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
#pod =head1 OVERVIEW |
|
10
|
|
|
|
|
|
|
#pod |
|
11
|
|
|
|
|
|
|
#pod This represents an C<image> block, which displays an image. |
|
12
|
|
|
|
|
|
|
#pod |
|
13
|
|
|
|
|
|
|
#pod =cut |
|
14
|
|
|
|
|
|
|
|
|
15
|
4
|
|
|
4
|
|
11477
|
use v5.36.0; |
|
|
4
|
|
|
|
|
12
|
|
|
16
|
|
|
|
|
|
|
|
|
17
|
4
|
|
|
4
|
|
18
|
use Moose::Util::TypeConstraints qw(class_type); |
|
|
4
|
|
|
|
|
8
|
|
|
|
4
|
|
|
|
|
36
|
|
|
18
|
4
|
|
|
4
|
|
1833
|
use MooseX::Types::Moose qw(ArrayRef); |
|
|
4
|
|
|
|
|
7
|
|
|
|
4
|
|
|
|
|
46
|
|
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
#pod =attr alt_text |
|
21
|
|
|
|
|
|
|
#pod |
|
22
|
|
|
|
|
|
|
#pod This is a simple string, which provides alt text. It's I<not> a text |
|
23
|
|
|
|
|
|
|
#pod composition object, and can't contain Markdown or mrkdwn. |
|
24
|
|
|
|
|
|
|
#pod |
|
25
|
|
|
|
|
|
|
#pod =cut |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
has alt_text => ( |
|
28
|
|
|
|
|
|
|
is => 'ro', |
|
29
|
|
|
|
|
|
|
isa => 'Str', |
|
30
|
|
|
|
|
|
|
required => 1, |
|
31
|
|
|
|
|
|
|
); |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
#pod =attr image_url |
|
34
|
|
|
|
|
|
|
#pod |
|
35
|
|
|
|
|
|
|
#pod This is a string giving the URL for the image. If you don't provide this, |
|
36
|
|
|
|
|
|
|
#pod you'd have to provide C<slack_file>. Unfortunately, though, Slack::BlockKit |
|
37
|
|
|
|
|
|
|
#pod doesn't support that! |
|
38
|
|
|
|
|
|
|
#pod |
|
39
|
|
|
|
|
|
|
#pod =cut |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
has image_url => ( |
|
42
|
|
|
|
|
|
|
is => 'ro', |
|
43
|
|
|
|
|
|
|
isa => 'Str', |
|
44
|
|
|
|
|
|
|
predicate => 'has_image_url', |
|
45
|
|
|
|
|
|
|
required => 1, # eventually, allow an unset image_url if we add slack_file |
|
46
|
|
|
|
|
|
|
); |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
#pod =attr title |
|
49
|
|
|
|
|
|
|
#pod |
|
50
|
|
|
|
|
|
|
#pod This attribute stores a title to display for the image. It should be a L<text |
|
51
|
|
|
|
|
|
|
#pod composition object|Slack::BlockKit::CompObj::Text>, but it's optional and you |
|
52
|
|
|
|
|
|
|
#pod can leave it out. |
|
53
|
|
|
|
|
|
|
#pod |
|
54
|
|
|
|
|
|
|
#pod =cut |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
has title => ( |
|
57
|
|
|
|
|
|
|
is => 'ro', |
|
58
|
|
|
|
|
|
|
isa => class_type('Slack::BlockKit::CompObj::Text'), |
|
59
|
|
|
|
|
|
|
predicate => 'has_title', |
|
60
|
|
|
|
|
|
|
); |
|
61
|
|
|
|
|
|
|
|
|
62
|
0
|
|
|
0
|
0
|
|
sub BUILD ($self, @) { |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
63
|
0
|
0
|
0
|
|
|
|
if ($self->has_title && $self->title->type ne 'plain_text') { |
|
64
|
0
|
|
|
|
|
|
Carp::croak("non-plain_text text object provided as title for image"); |
|
65
|
|
|
|
|
|
|
} |
|
66
|
|
|
|
|
|
|
} |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub as_struct ($self) { |
|
69
|
|
|
|
|
|
|
return { |
|
70
|
|
|
|
|
|
|
type => 'image', |
|
71
|
|
|
|
|
|
|
image_url => $self->image_url, |
|
72
|
|
|
|
|
|
|
alt_text => $self->alt_text, |
|
73
|
|
|
|
|
|
|
($self->has_title |
|
74
|
|
|
|
|
|
|
? (title => $self->title->as_struct) |
|
75
|
|
|
|
|
|
|
: ()), |
|
76
|
|
|
|
|
|
|
}; |
|
77
|
|
|
|
|
|
|
} |
|
78
|
|
|
|
|
|
|
|
|
79
|
4
|
|
|
4
|
|
17628
|
no Moose; |
|
|
4
|
|
|
|
|
9
|
|
|
|
4
|
|
|
|
|
23
|
|
|
80
|
4
|
|
|
4
|
|
850
|
no Moose::Util::TypeConstraints; |
|
|
4
|
|
|
|
|
5
|
|
|
|
4
|
|
|
|
|
19
|
|
|
81
|
4
|
|
|
4
|
|
474
|
no MooseX::Types::Moose; |
|
|
4
|
|
|
|
|
6
|
|
|
|
4
|
|
|
|
|
231
|
|
|
82
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
__END__ |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=pod |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=encoding UTF-8 |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 NAME |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
Slack::BlockKit::Block::Image - a Block Kit image block, used to show an image |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 VERSION |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
version 0.005 |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 OVERVIEW |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
This represents an C<image> block, which displays an image. |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 PERL VERSION |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
This module should work on any version of perl still receiving updates from |
|
105
|
|
|
|
|
|
|
the Perl 5 Porters. This means it should work on any version of perl |
|
106
|
|
|
|
|
|
|
released in the last two to three years. (That is, if the most recently |
|
107
|
|
|
|
|
|
|
released version is v5.40, then this module should work on both v5.40 and |
|
108
|
|
|
|
|
|
|
v5.38.) |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
Although it may work on older versions of perl, no guarantee is made that the |
|
111
|
|
|
|
|
|
|
minimum required version will not be increased. The version may be increased |
|
112
|
|
|
|
|
|
|
for any reason, and there is no promise that patches will be accepted to |
|
113
|
|
|
|
|
|
|
lower the minimum required perl. |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head2 alt_text |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
This is a simple string, which provides alt text. It's I<not> a text |
|
120
|
|
|
|
|
|
|
composition object, and can't contain Markdown or mrkdwn. |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head2 image_url |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
This is a string giving the URL for the image. If you don't provide this, |
|
125
|
|
|
|
|
|
|
you'd have to provide C<slack_file>. Unfortunately, though, Slack::BlockKit |
|
126
|
|
|
|
|
|
|
doesn't support that! |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head2 title |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
This attribute stores a title to display for the image. It should be a L<text |
|
131
|
|
|
|
|
|
|
composition object|Slack::BlockKit::CompObj::Text>, but it's optional and you |
|
132
|
|
|
|
|
|
|
can leave it out. |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head1 AUTHOR |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
Ricardo SIGNES <cpan@semiotic.systems> |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
This software is copyright (c) 2024 by Ricardo SIGNES. |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
143
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=cut |