| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Slack::BlockKit::BlockCollection 0.005; |
|
2
|
|
|
|
|
|
|
# ABSTRACT: a collection of Block Kit blocks |
|
3
|
4
|
|
|
4
|
|
2311
|
use Moose; |
|
|
4
|
|
|
|
|
1684801
|
|
|
|
4
|
|
|
|
|
28
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
#pod =head1 OVERVIEW |
|
6
|
|
|
|
|
|
|
#pod |
|
7
|
|
|
|
|
|
|
#pod This is the very top level "array of Block Kit blocks" object that exists |
|
8
|
|
|
|
|
|
|
#pod mostly to serve as a container for the blocks that are your real message. You |
|
9
|
|
|
|
|
|
|
#pod don't exactly need it, but its C<< ->as_struct >> method will collect all the |
|
10
|
|
|
|
|
|
|
#pod structs created by its contained blocks, so it's easy to pass around as "the |
|
11
|
|
|
|
|
|
|
#pod thing that gets sent to Slack". |
|
12
|
|
|
|
|
|
|
#pod |
|
13
|
|
|
|
|
|
|
#pod =cut |
|
14
|
|
|
|
|
|
|
|
|
15
|
4
|
|
|
4
|
|
22077
|
use v5.36.0; |
|
|
4
|
|
|
|
|
15
|
|
|
16
|
|
|
|
|
|
|
|
|
17
|
4
|
|
|
4
|
|
1954
|
use MooseX::Types::Moose qw(ArrayRef); |
|
|
4
|
|
|
|
|
120593
|
|
|
|
4
|
|
|
|
|
36
|
|
|
18
|
4
|
|
|
4
|
|
17632
|
use Moose::Util::TypeConstraints qw(role_type); |
|
|
4
|
|
|
|
|
7
|
|
|
|
4
|
|
|
|
|
21
|
|
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
#pod =attr blocks |
|
21
|
|
|
|
|
|
|
#pod |
|
22
|
|
|
|
|
|
|
#pod This is an arrayref of objects that implement L<Slack::BlockKit::Role::Block>. |
|
23
|
|
|
|
|
|
|
#pod It must be defined and non-empty, or an exception will be raised. |
|
24
|
|
|
|
|
|
|
#pod |
|
25
|
|
|
|
|
|
|
#pod =cut |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
has blocks => ( |
|
28
|
|
|
|
|
|
|
isa => ArrayRef([ role_type('Slack::BlockKit::Role::Block') ]), |
|
29
|
|
|
|
|
|
|
traits => [ 'Array' ], |
|
30
|
|
|
|
|
|
|
handles => { blocks => 'elements', block_count => 'count' }, |
|
31
|
|
|
|
|
|
|
predicate => '_has_blocks', |
|
32
|
|
|
|
|
|
|
); |
|
33
|
|
|
|
|
|
|
|
|
34
|
4
|
|
|
4
|
0
|
9
|
sub BUILD ($self, @) { |
|
|
4
|
|
|
|
|
10
|
|
|
|
4
|
|
|
|
|
7
|
|
|
35
|
4
|
100
|
100
|
|
|
231
|
Carp::croak("a BlockCollection's list of blocks can't be empty") |
|
36
|
|
|
|
|
|
|
unless $self->_has_blocks and $self->block_count; |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
|
|
39
|
1
|
|
|
1
|
0
|
9
|
sub as_struct ($self) { |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
3
|
|
|
40
|
1
|
|
|
|
|
92
|
return [ map {; $_->as_struct } $self->blocks ]; |
|
|
1
|
|
|
|
|
6
|
|
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
|
|
43
|
0
|
|
|
0
|
0
|
|
sub TO_JSON ($self) { |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
return $self->as_struct; |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
4
|
|
|
4
|
|
2501
|
no Moose; |
|
|
4
|
|
|
|
|
8
|
|
|
|
4
|
|
|
|
|
26
|
|
|
48
|
4
|
|
|
4
|
|
870
|
no MooseX::Types::Moose; |
|
|
4
|
|
|
|
|
7
|
|
|
|
4
|
|
|
|
|
100
|
|
|
49
|
4
|
|
|
4
|
|
15
|
no Moose::Util::TypeConstraints; |
|
|
4
|
|
|
|
|
6
|
|
|
|
4
|
|
|
|
|
20
|
|
|
50
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
__END__ |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=pod |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=encoding UTF-8 |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 NAME |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Slack::BlockKit::BlockCollection - a collection of Block Kit blocks |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 VERSION |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
version 0.005 |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 OVERVIEW |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
This is the very top level "array of Block Kit blocks" object that exists |
|
69
|
|
|
|
|
|
|
mostly to serve as a container for the blocks that are your real message. You |
|
70
|
|
|
|
|
|
|
don't exactly need it, but its C<< ->as_struct >> method will collect all the |
|
71
|
|
|
|
|
|
|
structs created by its contained blocks, so it's easy to pass around as "the |
|
72
|
|
|
|
|
|
|
thing that gets sent to Slack". |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 PERL VERSION |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
This module should work on any version of perl still receiving updates from |
|
77
|
|
|
|
|
|
|
the Perl 5 Porters. This means it should work on any version of perl |
|
78
|
|
|
|
|
|
|
released in the last two to three years. (That is, if the most recently |
|
79
|
|
|
|
|
|
|
released version is v5.40, then this module should work on both v5.40 and |
|
80
|
|
|
|
|
|
|
v5.38.) |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Although it may work on older versions of perl, no guarantee is made that the |
|
83
|
|
|
|
|
|
|
minimum required version will not be increased. The version may be increased |
|
84
|
|
|
|
|
|
|
for any reason, and there is no promise that patches will be accepted to |
|
85
|
|
|
|
|
|
|
lower the minimum required perl. |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head2 blocks |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
This is an arrayref of objects that implement L<Slack::BlockKit::Role::Block>. |
|
92
|
|
|
|
|
|
|
It must be defined and non-empty, or an exception will be raised. |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 AUTHOR |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Ricardo SIGNES <cpan@semiotic.systems> |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
This software is copyright (c) 2024 by Ricardo SIGNES. |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
103
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=cut |