mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-10-21 01:54:44 +00:00
Use Percona::Toolkit::_d() and Dumper(). Set Lmo::VERSION=0.01.
This commit is contained in:
16
lib/Lmo.pm
16
lib/Lmo.pm
@@ -1,4 +1,4 @@
|
|||||||
# This program is copyright 2007-2011 Baron Schwartz, 2012 Percona Inc.
|
# This program is copyright 2012-2013 Percona Inc.
|
||||||
# Feedback and improvements are welcome.
|
# Feedback and improvements are welcome.
|
||||||
#
|
#
|
||||||
# THIS PROGRAM IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
|
# THIS PROGRAM IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||||
@@ -19,10 +19,12 @@
|
|||||||
# ###########################################################################
|
# ###########################################################################
|
||||||
# Package: Lmo
|
# Package: Lmo
|
||||||
# Lmo provides a miniature object system in the style of Moose and Moo.
|
# Lmo provides a miniature object system in the style of Moose and Moo.
|
||||||
|
# Forked from 0.30 of Mo.
|
||||||
|
|
||||||
BEGIN {
|
BEGIN {
|
||||||
$INC{"Lmo.pm"} = __FILE__;
|
$INC{"Lmo.pm"} = __FILE__;
|
||||||
package Lmo;
|
package Lmo;
|
||||||
our $VERSION = '0.30_Percona'; # Forked from 0.30 of Mo.
|
our $VERSION = '0.01';
|
||||||
|
|
||||||
{
|
{
|
||||||
# Gets the glob from a given string.
|
# Gets the glob from a given string.
|
||||||
@@ -312,16 +314,6 @@ sub unimport {
|
|||||||
delete $stash->{$_} for @{$export_for{$caller}};
|
delete $stash->{$_} for @{$export_for{$caller}};
|
||||||
}
|
}
|
||||||
|
|
||||||
sub Dumper {
|
|
||||||
require Data::Dumper;
|
|
||||||
local $Data::Dumper::Indent = 0;
|
|
||||||
local $Data::Dumper::Sortkeys = 0;
|
|
||||||
local $Data::Dumper::Quotekeys = 0;
|
|
||||||
local $Data::Dumper::Terse = 1;
|
|
||||||
|
|
||||||
Data::Dumper::Dumper(@_)
|
|
||||||
}
|
|
||||||
|
|
||||||
BEGIN {
|
BEGIN {
|
||||||
# mro is the method resolution order. The module itself is core in
|
# mro is the method resolution order. The module itself is core in
|
||||||
# recent Perls; In older Perls it's available from MRO::Compat from
|
# recent Perls; In older Perls it's available from MRO::Compat from
|
||||||
|
@@ -34,7 +34,7 @@ sub check_type_constaints {
|
|||||||
|| Carp::confess(
|
|| Carp::confess(
|
||||||
qq<Attribute ($attribute) does not pass the type constraint because: >
|
qq<Attribute ($attribute) does not pass the type constraint because: >
|
||||||
. qq<Validation failed for '$check_name' with value >
|
. qq<Validation failed for '$check_name' with value >
|
||||||
. (defined $val ? Lmo::Dumper($val) : 'undef') )
|
. (defined $val ? Percona::Toolkit::Dumper($val) : 'undef') )
|
||||||
}
|
}
|
||||||
|
|
||||||
# Nested (or parametized) constraints look like this: ArrayRef[CONSTRAINT] or
|
# Nested (or parametized) constraints look like this: ArrayRef[CONSTRAINT] or
|
||||||
|
@@ -39,10 +39,6 @@ use Test::More;
|
|||||||
use Time::HiRes qw(sleep time);
|
use Time::HiRes qw(sleep time);
|
||||||
use File::Temp qw(tempfile);
|
use File::Temp qw(tempfile);
|
||||||
use POSIX qw(signal_h);
|
use POSIX qw(signal_h);
|
||||||
use Data::Dumper;
|
|
||||||
$Data::Dumper::Indent = 1;
|
|
||||||
$Data::Dumper::Sortkeys = 1;
|
|
||||||
$Data::Dumper::Quotekeys = 0;
|
|
||||||
|
|
||||||
require Exporter;
|
require Exporter;
|
||||||
our @ISA = qw(Exporter);
|
our @ISA = qw(Exporter);
|
||||||
@@ -710,15 +706,6 @@ sub get_slave_pos_relative_to_master {
|
|||||||
return $ss->{exec_master_log_pos};
|
return $ss->{exec_master_log_pos};
|
||||||
}
|
}
|
||||||
|
|
||||||
sub _d {
|
|
||||||
my ($package, undef, $line) = caller 0;
|
|
||||||
@_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }
|
|
||||||
map { defined $_ ? $_ : 'undef' }
|
|
||||||
@_;
|
|
||||||
my $t = sprintf '%.3f', time;
|
|
||||||
print STDERR "# $package:$line $PID $t ", join(' ', @_), "\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
# Like output(), but forks a process to execute the coderef.
|
# Like output(), but forks a process to execute the coderef.
|
||||||
# This is because otherwise, errors thrown during cleanup
|
# This is because otherwise, errors thrown during cleanup
|
||||||
# would be skipped.
|
# would be skipped.
|
||||||
|
Reference in New Issue
Block a user