| 1 | package Mojolicious::Plugin::EDumper; | ||||||||||||
| 2 | |||||||||||||
| 3 | 1 | ▶ | use Mojo::Base 'Mojolicious::Plugin'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | |||||||||||||
| 5 | 1 | our $VERSION = '0.00007'; | |||||||||||
| 6 | |||||||||||||
| 7 | =pod | ||||||||||||
| 8 | |||||||||||||
| 9 | =encoding utf8 | ||||||||||||
| 10 | |||||||||||||
| 11 | |||||||||||||
| 12 | =head1 ¡ ¡ ¡ ALL GLORY TO GLORIA ! ! ! | ||||||||||||
| 13 | |||||||||||||
| 14 | Доброго всем, соответственно | ||||||||||||
| 15 | |||||||||||||
| 16 | =head1 VERSION | ||||||||||||
| 17 | |||||||||||||
| 18 | 0.00007 | ||||||||||||
| 19 | |||||||||||||
| 20 | =head1 NAME | ||||||||||||
| 21 | |||||||||||||
| 22 | Mojolicious::Plugin::EDumper - pretty dumps encoded data. | ||||||||||||
| 23 | |||||||||||||
| 24 | =head1 SINOPSYS | ||||||||||||
| 25 | |||||||||||||
| 26 | $app->plugin('EDumper'); | ||||||||||||
| 27 | $app->plugin('EDumper', helper=>'dumper'); | ||||||||||||
| 28 | |||||||||||||
| 29 | $c->dumper( +{'Вася' => 'Пупкин'} ); | ||||||||||||
| 30 | |||||||||||||
| 31 | |||||||||||||
| 32 | =head1 OPTIONS | ||||||||||||
| 33 | |||||||||||||
| 34 | =head2 helper | ||||||||||||
| 35 | |||||||||||||
| 36 | Name of the helper. Default - 'edumper'. | ||||||||||||
| 37 | |||||||||||||
| 38 | |||||||||||||
| 39 | =head1 SEE ALSO | ||||||||||||
| 40 | |||||||||||||
| 41 | L<Data::Dumper> | ||||||||||||
| 42 | L<Data::Dumper::AutoEncode> | ||||||||||||
| 43 | L<Data::Recursive::Encode> | ||||||||||||
| 44 | L<Mojolicious::Plugin::DefaultHelpers> | ||||||||||||
| 45 | |||||||||||||
| 46 | Redefine might not work: | ||||||||||||
| 47 | |||||||||||||
| 48 | sub Data::Dumper::qquote { | ||||||||||||
| 49 | my $s = shift; | ||||||||||||
| 50 | return "'$s'"; | ||||||||||||
| 51 | } | ||||||||||||
| 52 | |||||||||||||
| 53 | |||||||||||||
| 54 | =head1 AUTHOR | ||||||||||||
| 55 | |||||||||||||
| 56 | Михаил Че (Mikhail Che), C<< <mche [on] cpan.org> >> | ||||||||||||
| 57 | |||||||||||||
| 58 | =head1 BUGS / CONTRIBUTING | ||||||||||||
| 59 | |||||||||||||
| 60 | Please report any bugs or feature requests at L<https://github.com/mche/Mojolicious-Plugin-EDumper/issues>. Pull requests also welcome. | ||||||||||||
| 61 | |||||||||||||
| 62 | =head1 COPYRIGHT | ||||||||||||
| 63 | |||||||||||||
| 64 | Copyright 2016+ Mikhail Che. | ||||||||||||
| 65 | |||||||||||||
| 66 | This library is free software; you can redistribute it and/or modify | ||||||||||||
| 67 | it under the same terms as Perl itself. | ||||||||||||
| 68 | |||||||||||||
| 69 | =cut | ||||||||||||
| 70 | |||||||||||||
| 71 | 0 | ▶ | sub register { | ||||||||||
|
Subroutine
register: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||
| 72 | 0 | my ($self, $app, $conf) = @_; | |||||||||||
| 73 | #~ my $enc = delete $conf->{enc} || 'utf8'; | ||||||||||||
| 74 | 0 | ▶ | my $helper = delete $conf->{helper} || 'edumper'; | ||||||||||
|
Condition0%0/2
delete $conf->{'helper'} || 'edumper'
MC/DC0%0/1
delete $conf->{'helper'} || 'edumper'
delete $conf->{'helper'}
Truth table0%0/2
A
A= delete $conf->{'helper'}
| |||||||||||||
| 75 | 0 | ▶ | $app->helper($helper => sub { | ||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||
| 76 | 0 | shift; | |||||||||||
| 77 | |||||||||||||
| 78 | #~ my $dump = eval 'qq★'. | ||||||||||||
| 79 | 0 | Data::Dumper->new(\@_)->Indent(1)->Sortkeys(1)->Terse(1)->Useqq(0)->Dump | |||||||||||
| 80 | #~ .'★'; | ||||||||||||
| 81 | 0 | =~ s/((?:\\x\{[\da-f]+\})+)/eval '"'.$1.'"'/eigr; | |||||||||||
| 82 | |||||||||||||
| 83 | #~ die __PACKAGE__." error: $@" | ||||||||||||
| 84 | #~ if $@; | ||||||||||||
| 85 | |||||||||||||
| 86 | #~ return $dump; | ||||||||||||
| 87 | |||||||||||||
| 88 | 0 | }); | |||||||||||
| 89 | 0 | return $self; | |||||||||||
| 90 | } | ||||||||||||
| 91 | |||||||||||||
| 92 | 1 | 1; | |||||||||||