| 1 | package Kelp::Module::YAML; | ||||||||||
| 2 | 3 | $Kelp::Module::YAML::VERSION = '2.00'; | |||||||||
| 3 | 3 | ▶ | use Kelp::Base qw(Kelp::Module::Encoder); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 3 | ▶ | use YAML::PP; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 3 | our $content_type = 'text/yaml'; | |||||||||
| 7 | 3 | our $content_type_re = qr{^text/yaml}i; | |||||||||
| 8 | |||||||||||
| 9 | 8 | ▶ | sub encoder_name { 'yaml' } | ||||||||
|
Subroutine
encoder_name: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 10 | |||||||||||
| 11 | sub build_encoder | ||||||||||
| 12 | 5 | ▶ | { | ||||||||
|
Subroutine
build_encoder: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 13 | 5 | my ($self, $args) = @_; | |||||||||
| 14 | |||||||||||
| 15 | 5 | return Kelp::Module::YAML::Facade->new( | |||||||||
| 16 | engine => YAML::PP->new(%$args) | ||||||||||
| 17 | ); | ||||||||||
| 18 | } | ||||||||||
| 19 | |||||||||||
| 20 | sub build | ||||||||||
| 21 | 3 | ▶ | { | ||||||||
|
Subroutine
build: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 22 | 3 | my ($self, %args) = @_; | |||||||||
| 23 | |||||||||||
| 24 | require Kelp::Module::YAML::KelpExtensions | ||||||||||
| 25 | 3 | ▶ | if delete $args{kelp_extensions}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 26 | |||||||||||
| 27 | 3 | $self->SUPER::build(%args); | |||||||||
| 28 | |||||||||||
| 29 | 3 | $self->register(yaml => $self->get_encoder); | |||||||||
| 30 | } | ||||||||||
| 31 | |||||||||||
| 32 | 3 | package Kelp::Module::YAML::Facade { | |||||||||
| 33 | 3 | ▶ | use Kelp::Base; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 34 | |||||||||||
| 35 | 3 | attr -engine; | |||||||||
| 36 | |||||||||||
| 37 | sub encode | ||||||||||
| 38 | 5 | ▶ | { | ||||||||
|
Subroutine
encode: called CC=1 SCAR=0.0
| |||||||||||
| 39 | 5 | my $self = shift; | |||||||||
| 40 | 5 | $self->engine->dump_string(@_); | |||||||||
| 41 | } | ||||||||||
| 42 | |||||||||||
| 43 | sub decode | ||||||||||
| 44 | 11 | ▶ | { | ||||||||
|
Subroutine
decode: called CC=1 SCAR=0.0
| |||||||||||
| 45 | 11 | my $self = shift; | |||||||||
| 46 | 11 | $self->engine->load_string(@_); | |||||||||
| 47 | } | ||||||||||
| 48 | } | ||||||||||
| 49 | 3 | $Kelp::Module::YAML::Facade::VERSION = '2.00'; | |||||||||
| 50 | |||||||||||
| 51 | 3 | 1; | |||||||||
| 52 | __END__ | ||||||||||