Commit 273e84b3 authored by Xavier Guimard's avatar Xavier Guimard

Clean some Dumper usage (#1416)

parent fdf2327b
#!/usr/bin/perl #!/usr/bin/perl
use Data::Dumper;
use Plack::Builder; use Plack::Builder;
# Basic test app # Basic test app
......
...@@ -2,7 +2,6 @@ package Lemonldap::NG::Common::Cli; ...@@ -2,7 +2,6 @@ package Lemonldap::NG::Common::Cli;
use strict; use strict;
use Mouse; use Mouse;
use Data::Dumper;
use Lemonldap::NG::Common::Conf; use Lemonldap::NG::Common::Conf;
our $VERSION = '2.0.0'; our $VERSION = '2.0.0';
......
...@@ -9,7 +9,6 @@ use strict; ...@@ -9,7 +9,6 @@ use strict;
use Mouse; use Mouse;
use Crypt::OpenSSL::RSA; use Crypt::OpenSSL::RSA;
use Crypt::OpenSSL::X509; use Crypt::OpenSSL::X509;
use Data::Dumper;
use HTML::Template; use HTML::Template;
use MIME::Base64; use MIME::Base64;
use Safe; use Safe;
......
...@@ -131,7 +131,7 @@ sub oldUnserialize { ...@@ -131,7 +131,7 @@ sub oldUnserialize {
if ( $k =~ $hashParameters and $v ||= {} and not ref($v) ) { if ( $k =~ $hashParameters and $v ||= {} and not ref($v) ) {
$conf->{$k} = {}; $conf->{$k} = {};
# Value should be a Data::Dumper, else this is an old format # Value should be a Data::Dumper, else this is an old-old format
if ( defined($v) and $v !~ /^\$/ ) { if ( defined($v) and $v !~ /^\$/ ) {
$Lemonldap::NG::Common::Conf::msg .= $Lemonldap::NG::Common::Conf::msg .=
......
...@@ -125,6 +125,7 @@ sub jsonResponse { ...@@ -125,6 +125,7 @@ sub jsonResponse {
or die "PSGI lib has refused my get, aborting"; or die "PSGI lib has refused my get, aborting";
unless ( $res->[0] == 200 ) { unless ( $res->[0] == 200 ) {
require Data::Dumper; require Data::Dumper;
$Data::Dumper::Useperl = 1;
print STDERR "Result dump :\n" . Data::Dumper::Dumper($res); print STDERR "Result dump :\n" . Data::Dumper::Dumper($res);
die "Manager lib does not return a 200 code, aborting"; die "Manager lib does not return a 200 code, aborting";
} }
...@@ -139,6 +140,7 @@ sub jsonPostResponse { ...@@ -139,6 +140,7 @@ sub jsonPostResponse {
or die "PSGI lib has refused my post, aborting"; or die "PSGI lib has refused my post, aborting";
unless ( $res->[0] == 200 ) { unless ( $res->[0] == 200 ) {
require Data::Dumper; require Data::Dumper;
$Data::Dumper::Useperl = 1;
print STDERR "Result dump :\n" . Data::Dumper::Dumper($res); print STDERR "Result dump :\n" . Data::Dumper::Dumper($res);
die "Manager lib does not return a 200 code, aborting"; die "Manager lib does not return a 200 code, aborting";
} }
...@@ -153,6 +155,7 @@ sub jsonPutResponse { ...@@ -153,6 +155,7 @@ sub jsonPutResponse {
or die "PSGI lib has refused my put, aborting"; or die "PSGI lib has refused my put, aborting";
unless ( $res->[0] == 200 ) { unless ( $res->[0] == 200 ) {
require Data::Dumper; require Data::Dumper;
$Data::Dumper::Useperl = 1;
print STDERR "Result dump :\n" . Data::Dumper::Dumper($res); print STDERR "Result dump :\n" . Data::Dumper::Dumper($res);
die "Manager lib does not return a 200 code, aborting"; die "Manager lib does not return a 200 code, aborting";
} }
......
...@@ -117,8 +117,6 @@ sub handlerAbort { ...@@ -117,8 +117,6 @@ sub handlerAbort {
sub handler { sub handler {
my ( $self, $req ) = @_; my ( $self, $req ) = @_;
#print STDERR Dumper($self->routes);use Data::Dumper;
# Reinitialize configuration message # Reinitialize configuration message
$Lemonldap::NG::Common::Conf::msg = ''; $Lemonldap::NG::Common::Conf::msg = '';
......
...@@ -6,7 +6,6 @@ package Lemonldap::NG::Handler::Lib::Status; ...@@ -6,7 +6,6 @@ package Lemonldap::NG::Handler::Lib::Status;
use strict; use strict;
use POSIX qw(setuid setgid); use POSIX qw(setuid setgid);
use JSON qw(to_json); use JSON qw(to_json);
use Data::Dumper;
our $VERSION = '2.0.0'; our $VERSION = '2.0.0';
......
use Test::More; use Test::More;
use JSON; use JSON;
use Data::Dumper;
use MIME::Base64; use MIME::Base64;
require 't/test-psgi-lib.pm'; require 't/test-psgi-lib.pm';
......
use Test::More; use Test::More;
use JSON; use JSON;
use Data::Dumper;
use MIME::Base64; use MIME::Base64;
require 't/test-psgi-lib.pm'; require 't/test-psgi-lib.pm';
......
use Test::More; use Test::More;
use JSON; use JSON;
use Data::Dumper;
use MIME::Base64; use MIME::Base64;
require 't/test-psgi-lib.pm'; require 't/test-psgi-lib.pm';
......
use Test::More; use Test::More;
use JSON; use JSON;
use Data::Dumper;
use MIME::Base64; use MIME::Base64;
require 't/test-psgi-lib.pm'; require 't/test-psgi-lib.pm';
......
use Test::More; use Test::More;
use JSON; use JSON;
use Data::Dumper;
use MIME::Base64; use MIME::Base64;
use LWP::UserAgent; use LWP::UserAgent;
......
use Test::More; use Test::More;
use JSON; use JSON;
use Data::Dumper;
use MIME::Base64; use MIME::Base64;
BEGIN { BEGIN {
......
# Base library for tests # Base library for tests
use strict; use strict;
use Data::Dumper;
use 5.10.0; use 5.10.0;
use POSIX 'strftime'; use POSIX 'strftime';
use_ok('Lemonldap::NG::Common::PSGI::Cli::Lib'); use_ok('Lemonldap::NG::Common::PSGI::Cli::Lib');
our $client; our $client;
our $count = 1; our $count = 1;
$Data::Dumper::Deparse = 1;
no warnings 'redefine'; no warnings 'redefine';
......
...@@ -6,6 +6,7 @@ use Data::Dumper; ...@@ -6,6 +6,7 @@ use Data::Dumper;
use Lemonldap::NG::Common::Conf::ReConstants; use Lemonldap::NG::Common::Conf::ReConstants;
our $VERSION = '2.0.0'; our $VERSION = '2.0.0';
$Data::Dumper::Useperl = 1;
extends('Lemonldap::NG::Manager::Cli::Lib'); extends('Lemonldap::NG::Manager::Cli::Lib');
......
...@@ -79,6 +79,7 @@ sub hdebug { ...@@ -79,6 +79,7 @@ sub hdebug {
foreach my $d (@_) { foreach my $d (@_) {
if ( ref $d ) { if ( ref $d ) {
require Data::Dumper; require Data::Dumper;
$Data::Dumper::Useperl = 1;
print STDERR Data::Dumper::Dumper($d); print STDERR Data::Dumper::Dumper($d);
} }
else { print STDERR "$d\n" } else { print STDERR "$d\n" }
......
...@@ -32,7 +32,8 @@ $refConf->{cfgLog} = ''; ...@@ -32,7 +32,8 @@ $refConf->{cfgLog} = '';
# Sort keys # Sort keys
$Data::Dumper::Sortkeys = 1; $Data::Dumper::Sortkeys = 1;
my $tmp = Dumper($refConf); $Data::Dumper::Useperl = 1;
my $tmp = Dumper($refConf);
my $refFile = File::Temp->new( UNLINK => 1 ); my $refFile = File::Temp->new( UNLINK => 1 );
my $editFile = File::Temp->new( UNLINK => 1 ); my $editFile = File::Temp->new( UNLINK => 1 );
...@@ -68,12 +69,13 @@ if (`diff $refFile $editFile`) { ...@@ -68,12 +69,13 @@ if (`diff $refFile $editFile`) {
{ {
refConf => $refConf, refConf => $refConf,
newConf => $VAR1, newConf => $VAR1,
req => 1, req => 1,
} }
); );
unless($parser->testNewConf) { unless ( $parser->testNewConf ) {
print STDERR "Configuration seems to have some errors:\n "; print STDERR "Configuration seems to have some errors:\n ";
print STDERR Dumper({errors => $parser->errors,warnings => $parser->warnings}); print STDERR Dumper(
{ errors => $parser->errors, warnings => $parser->warnings } );
print STDERR "Are you sure you want to write it ? (yes/no) "; print STDERR "Are you sure you want to write it ? (yes/no) ";
my $resp = <STDIN>; my $resp = <STDIN>;
die "Aborted" unless $resp =~ /^yes$/i; die "Aborted" unless $resp =~ /^yes$/i;
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
use Test::More; use Test::More;
use strict; use strict;
use Data::Dumper;
my $formDir = 'site/htdocs/static/forms'; my $formDir = 'site/htdocs/static/forms';
......
...@@ -43,7 +43,6 @@ foreach my $query (@bad) { ...@@ -43,7 +43,6 @@ foreach my $query (@bad) {
or print STDERR "# Receive a $res->[0] code"; or print STDERR "# Receive a $res->[0] code";
my $href; my $href;
#print STDERR Dumper($res->[2]);use Data::Dumper;
ok( $href = from_json( $res->[2]->[0] ), 'Response is JSON' ); ok( $href = from_json( $res->[2]->[0] ), 'Response is JSON' );
ok( $href->{error}, "Receive an explanation message ($href->{error})" ); ok( $href->{error}, "Receive an explanation message ($href->{error})" );
count(3); count(3);
......
...@@ -29,6 +29,4 @@ ok( $res->[0] == 200, "Result code is 200" ); ...@@ -29,6 +29,4 @@ ok( $res->[0] == 200, "Result code is 200" );
ok( $key = from_json( $res->[2]->[0] ), 'Response is JSON' ); ok( $key = from_json( $res->[2]->[0] ), 'Response is JSON' );
count(3); count(3);
#print STDERR Dumper($key);use Data::Dumper;
done_testing( count() ); done_testing( count() );
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
use Test::More; use Test::More;
use strict; use strict;
use JSON; use JSON;
use Data::Dumper;
require 't/test-lib.pm'; require 't/test-lib.pm';
my @struct = my @struct =
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
use Test::More; use Test::More;
use strict; use strict;
use JSON; use JSON;
use Data::Dumper;
require 't/test-lib.pm'; require 't/test-lib.pm';
my $struct = 't/jsonfiles/12-modified.json'; my $struct = 't/jsonfiles/12-modified.json';
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
use Test::More; use Test::More;
use strict; use strict;
use JSON; use JSON;
use Data::Dumper;
require 't/test-lib.pm'; require 't/test-lib.pm';
my $struct = 't/jsonfiles/14-bad.json'; my $struct = 't/jsonfiles/14-bad.json';
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
use Test::More; use Test::More;
use strict; use strict;
use JSON; use JSON;
use Data::Dumper;
require 't/test-lib.pm'; require 't/test-lib.pm';
my $struct = 't/jsonfiles/15-combination.json'; my $struct = 't/jsonfiles/15-combination.json';
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
use strict; use strict;
use Test::More; use Test::More;
use Data::Dumper;
# CONSTANTS # CONSTANTS
......
# Base library for tests # Base library for tests
use strict; use strict;
use Data::Dumper;
use 5.10.0; use 5.10.0;
use_ok('Lemonldap::NG::Manager::Cli::Lib'); use_ok('Lemonldap::NG::Manager::Cli::Lib');
......
...@@ -679,7 +679,8 @@ sub cookie { ...@@ -679,7 +679,8 @@ sub cookie {
sub _dump { sub _dump {
my ( $self, $variable ) = @_; my ( $self, $variable ) = @_;
require Data::Dumper; require Data::Dumper;
$Data::Dumper::Indent = 0; $Data::Dumper::Indent = 0;
$Data::Dumper::Useperl = 1;
$self->logger->debug( "Dump: " . Data::Dumper::Dumper($variable) ); $self->logger->debug( "Dump: " . Data::Dumper::Dumper($variable) );
return; return;
} }
......
...@@ -3,7 +3,6 @@ package main; ...@@ -3,7 +3,6 @@ package main;
use strict; use strict;
use Data::Dumper; use Data::Dumper;
$Data::Dumper::Sortkeys = 1;
use LWP::UserAgent; use LWP::UserAgent;
use URI::Escape; use URI::Escape;
use 5.10.0; use 5.10.0;
...@@ -15,7 +14,9 @@ BEGIN { ...@@ -15,7 +14,9 @@ BEGIN {
} }
our $count = 1; our $count = 1;
$Data::Dumper::Deparse = 1; $Data::Dumper::Deparse = 1;
$Data::Dumper::Sortkeys = 1;
$Data::Dumper::Useperl = 1;
my $ini; my $ini;
sub count { sub count {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment