« lib/BioX/Workflow/Command/run/Rules/Directives/Types/CSV.pm
↑ Summary
lib/BioX/Workflow/Command/run/Utils/Debug.pm »
| 1 | package BioX::Workflow::Command::run::Rules::Directives::Functions; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use MooseX::App::Role; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use namespace::autoclean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 1 | ▶ | use File::Slurp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 1 | ▶ | use JSON; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 1 | ▶ | use Try::Tiny; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | has 'remove_from_json' => ( | ||||||||||
| 11 | is => 'rw', | ||||||||||
| 12 | isa => 'ArrayRef', | ||||||||||
| 13 | 0 | ▶ | default => sub { | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 14 | [ | ||||||||||
| 15 | 0 | 'remove_from_json', 'register_namespace', | |||||||||
| 16 | '_ERROR', 'register_process_directives', | ||||||||||
| 17 | 'register_types', 'run_stats', | ||||||||||
| 18 | 'interpol_directive_cache', 'before_meta', | ||||||||||
| 19 | ]; | ||||||||||
| 20 | }, | ||||||||||
| 21 | 1 | ); | |||||||||
| 22 | |||||||||||
| 23 | 0 | ▶ | sub serialize_to_json { | ||||||||
|
Subroutine
serialize_to_json: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||
| 24 | 0 | my $self = shift; | |||||||||
| 25 | 0 | my $file = shift; | |||||||||
| 26 | |||||||||||
| 27 | 0 | my %hacky_self = %{$self}; | |||||||||
| 28 | 0 | foreach my $remove ( @{ $self->remove_from_json } ) { | |||||||||
| 29 | 0 | delete $hacky_self{$remove}; | |||||||||
| 30 | } | ||||||||||
| 31 | |||||||||||
| 32 | 0 | my $json = JSON->new->utf8->pretty->allow_blessed->encode( \%hacky_self ); | |||||||||
| 33 | |||||||||||
| 34 | 0 | ▶ | if ($file) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 35 | 0 | write_file( $file, $json ); | |||||||||
| 36 | } | ||||||||||
| 37 | 0 | return $json; | |||||||||
| 38 | } | ||||||||||
| 39 | |||||||||||
| 40 | 0 | ▶ | sub read_json_file { | ||||||||
|
Subroutine
read_json_file: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 41 | 0 | my $self = shift; | |||||||||
| 42 | 0 | my $file = shift; | |||||||||
| 43 | |||||||||||
| 44 | 0 | my $read = read_file($file); | |||||||||
| 45 | 0 | my $json = JSON->new->utf8->decode($read); | |||||||||
| 46 | |||||||||||
| 47 | 0 | return $json; | |||||||||
| 48 | } | ||||||||||
| 49 | |||||||||||
| 50 | # no Moose; | ||||||||||
| 51 | 1 | ▶ | no Moose::Role; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 52 | |||||||||||
| 53 | 1 | 1; | |||||||||