| 1 | 9 | ▶ | use v5.14; | ||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||
| 2 | 9 | ▶ | use Moops; | ||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||
| 3 | 5 | ||||||||||||||||||||||||||
| 4 | 9 | ▶ | class AnyEvent::Discord::Payload { | ||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||
| 5 | 4 | ▶ | use JSON qw(decode_json encode_json); | ||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||
| 7 | 1 | our $VERSION = '0.1'; | |||||||||||||||||||||||||
| 8 | 1 | has version => ( is => 'ro', isa => Str, default => $VERSION ); | |||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||
| 10 | 1 | has op => ( is => 'rw', isa => Num ); | |||||||||||||||||||||||||
| 11 | 1 | has d => ( is => 'rw' ); | |||||||||||||||||||||||||
| 12 | 1 | has s => ( is => 'rw' ); | |||||||||||||||||||||||||
| 13 | 1 | has t => ( is => 'rw' ); | |||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||
| 15 | 4 | ▶ | method from_json($class: Str $json) { | ||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.1
Subroutine
BEGIN: called CC=1 SCAR=0.1
Subroutine
from_json: called CC=6 SCAR=18.3
Branch: 5 branches
| |||||||||||||||||||||||||||
| 16 | 2 | $class->new(decode_json($json)); | |||||||||||||||||||||||||
| 17 | } | ||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||
| 19 | 3 | ▶ | method from_hashref($class: HashRef $ref) { | ||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.1
Subroutine
BEGIN: called CC=1 SCAR=0.1
Subroutine
from_hashref: called CC=6 SCAR=18.3
Branch: 5 branches
| |||||||||||||||||||||||||||
| 20 | 5 | $class->new($ref); | |||||||||||||||||||||||||
| 21 | } | ||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||
| 23 | 3 | ▶ | method as_json() { | ||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.1
Subroutine
as_json: called CC=3 SCAR=11.1
Branch: 2 branches
| |||||||||||||||||||||||||||
| 24 | 1 | return encode_json({ | |||||||||||||||||||||||||
| 25 | op => $self->op, | ||||||||||||||||||||||||||
| 26 | d => $self->d, | ||||||||||||||||||||||||||
| 27 | }); | ||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||
| 31 | 5 | 1; | |||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||
| 33 | =pod | ||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||
| 35 | =head1 NAME | ||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||
| 37 | AnyEvent::Discord::Payload - Represents a Discord payload | ||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||
| 39 | =head1 DESCRIPTION | ||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||
| 41 | https://discord.com/developers/docs/topics/gateway | ||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||
| 43 | =head1 ACCESSORS | ||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||
| 45 | =over 4 | ||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||
| 47 | =item op (Number) | ||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||
| 49 | Opcode | ||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||
| 51 | =item d (HashRef) | ||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||
| 53 | Data structure for message | ||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||
| 55 | =item t (String) | ||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||
| 57 | Event name | ||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||
| 59 | =back | ||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||
| 61 | =head1 CAVEATS | ||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||
| 63 | This is incredibly unfinished. | ||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||
| 65 | =head1 AUTHOR | ||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||
| 67 | Nick Melnick <nmelnick@cpan.org> | ||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||
| 69 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||
| 71 | This software is copyright (c) 2021, Nick Melnick. | ||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||
| 73 | This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||
| 75 | =cut | ||||||||||||||||||||||||||