From 47091424aa5cfa37ba986127729ee4ee62f3ae84 Mon Sep 17 00:00:00 2001 From: Brian Fraser Date: Fri, 23 Dec 2011 00:04:44 -0300 Subject: [PATCH 01/35] Removed indirect object syntax from CompareQueryTimes.pm --- lib/CompareQueryTimes.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/CompareQueryTimes.pm b/lib/CompareQueryTimes.pm index 900b87bf..b2f86837 100644 --- a/lib/CompareQueryTimes.pm +++ b/lib/CompareQueryTimes.pm @@ -295,7 +295,7 @@ sub _report_diff_big { return unless keys %{$self->{diffs}->{big}}; - my $report = new ReportFormatter(); + my $report = ReportFormatter->new(); $report->set_title('Big query time differences'); $report->set_columns( $args{query_id_col}, @@ -342,7 +342,7 @@ sub _report_diff_in_bucket { return unless keys %{$self->{diffs}->{in_bucket}}; - my $report = new ReportFormatter(); + my $report = ReportFormatter->new(); $report->set_title('Significant query time differences'); $report->set_columns( $args{query_id_col}, From 37e321ef650cf37fa486968de647ba2775ada97f Mon Sep 17 00:00:00 2001 From: Brian Fraser Date: Fri, 23 Dec 2011 00:09:07 -0300 Subject: [PATCH 02/35] Removed indirect object syntax from CompareResults.pm --- lib/CompareResults.pm | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/CompareResults.pm b/lib/CompareResults.pm index 8d390bbb..2fd61917 100644 --- a/lib/CompareResults.pm +++ b/lib/CompareResults.pm @@ -354,7 +354,7 @@ sub _compare_rows { # it to the 3rd and subsequent events. my @event0_rows = @{ $event0->{results_sth}->fetchall_arrayref({}) }; $event0->{row_count} = scalar @event0_rows; - my $left = new MockSth(@event0_rows); + my $left = MockSth->new(@event0_rows); $left->{NAME} = [ @{$event0->{results_sth}->{NAME}} ]; EVENT: @@ -368,7 +368,7 @@ sub _compare_rows { # we gobble the remaining rows in that sth and print them to an outfile. # This short circuits RowDiff::compare_sets() which is what we want to do. my $no_diff = 1; # results are identical; this catches 0 row results - my $outfile = new Outfile(); + my $outfile = Outfile->new(); my ($left_outfile, $right_outfile, $n_rows); my $same_row = sub { $event->{row_count}++; # Keep track of this event's row_count. @@ -399,8 +399,8 @@ sub _compare_rows { return; }; - my $rd = new RowDiff(dbh => $dbh); - my $mocksync = new MockSyncStream( + my $rd = RowDiff->new(dbh => $dbh); + my $mocksync = MockSyncStream->new( query => $event0->{arg}, cols => $res_struct->{cols}, same_row => $same_row, @@ -634,7 +634,7 @@ sub diff_rows { }; }; - my $rd = new RowDiff( + my $rd = RowDiff->new( dbh => $left_dbh, key_cmp => $key_cmp, same_row => $same_row, @@ -643,7 +643,7 @@ sub diff_rows { done => $done, trf => $trf, ); - my $ch = new ChangeHandler( + my $ch = ChangeHandler->new( left_db => $db, left_tbl => 'mk_upgrade_left', right_db => $db, @@ -863,7 +863,7 @@ sub _report_diff_checksums { return unless keys %{$self->{diffs}->{checksums}}; - my $report = new ReportFormatter(); + my $report = ReportFormatter->new(); $report->set_title('Checksum differences'); $report->set_columns( $args{query_id_col}, @@ -894,7 +894,7 @@ sub _report_diff_col_vals { return unless keys %{$self->{diffs}->{col_vals}}; - my $report = new ReportFormatter(); + my $report = ReportFormatter->new(); $report->set_title('Column value differences'); $report->set_columns( $args{query_id_col}, @@ -929,7 +929,7 @@ sub _report_diff_row_counts { return unless keys %{$self->{diffs}->{row_counts}}; - my $report = new ReportFormatter(); + my $report = ReportFormatter->new(); $report->set_title('Row count differences'); $report->set_columns( $args{query_id_col}, From 29c1ea30cf5fc323684b032f455b5185e90d577d Mon Sep 17 00:00:00 2001 From: Brian Fraser Date: Fri, 23 Dec 2011 00:09:56 -0300 Subject: [PATCH 03/35] Removed indirect object syntax from CompareWarnings.pm --- lib/CompareWarnings.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/CompareWarnings.pm b/lib/CompareWarnings.pm index 548247f6..eed501d9 100644 --- a/lib/CompareWarnings.pm +++ b/lib/CompareWarnings.pm @@ -321,7 +321,7 @@ sub _report_diff_warnings { return unless keys %{$self->{diffs}->{warnings}}; - my $report = new ReportFormatter(extend_right => 1); + my $report = ReportFormatter->new(extend_right => 1); $report->set_title('New warnings'); $report->set_columns( $args{query_id_col}, @@ -355,7 +355,7 @@ sub _report_diff_levels { return unless keys %{$self->{diffs}->{levels}}; - my $report = new ReportFormatter(extend_right => 1); + my $report = ReportFormatter->new(extend_right => 1); $report->set_title('Warning level differences'); $report->set_columns( $args{query_id_col}, @@ -391,7 +391,7 @@ sub _report_diff_warning_counts { return unless keys %{$self->{diffs}->{warning_counts}}; - my $report = new ReportFormatter(); + my $report = ReportFormatter->new(); $report->set_title('Warning count differences'); $report->set_columns( $args{query_id_col}, From a7fd3775fae3309f599663e4c1d94dc29096922c Mon Sep 17 00:00:00 2001 From: Brian Fraser Date: Fri, 23 Dec 2011 00:22:51 -0300 Subject: [PATCH 04/35] Removed indirect object syntax from EventAggregator.pm --- lib/EventAggregator.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/EventAggregator.pm b/lib/EventAggregator.pm index 67e4ad2a..9b7ac62b 100644 --- a/lib/EventAggregator.pm +++ b/lib/EventAggregator.pm @@ -1046,7 +1046,7 @@ sub merge { # Create a new EventAggregator obj, initialize it with the summed results, # and return it. - my $ea_merged = new EventAggregator( + my $ea_merged = EventAggregator->new( groupby => $ea1->{groupby}, worst => $ea1->{worst}, attributes => { map { $_=>[$_] } keys %attrib_types }, From 4cec08f768ad8bbb4805f6a75ad1bdf3f3b7c898 Mon Sep 17 00:00:00 2001 From: Brian Fraser Date: Fri, 23 Dec 2011 00:25:55 -0300 Subject: [PATCH 05/35] Removed indirect object syntax from MySQLProtocolParser.pm --- lib/MySQLProtocolParser.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/MySQLProtocolParser.pm b/lib/MySQLProtocolParser.pm index 9cf2552e..632776f0 100644 --- a/lib/MySQLProtocolParser.pm +++ b/lib/MySQLProtocolParser.pm @@ -1369,7 +1369,7 @@ sub uncompress_data { # Uncompress the compressed binary data. my $uncomp_bin_data = ''; - my $z = new IO::Uncompress::Inflate( + my $z = IO::Uncompress::Inflate->new( \$comp_bin_data ) or die "IO::Uncompress::Inflate failed: $InflateError"; my $status = $z->read(\$uncomp_bin_data, $len) From 017f95e532df45f2ae22060f38c3d5c97b10ea73 Mon Sep 17 00:00:00 2001 From: Brian Fraser Date: Fri, 23 Dec 2011 00:29:04 -0300 Subject: [PATCH 06/35] Removed indirect object syntax from OptionParser.pm --- lib/OptionParser.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/OptionParser.pm b/lib/OptionParser.pm index 4b5fbef6..13b5f3a2 100644 --- a/lib/OptionParser.pm +++ b/lib/OptionParser.pm @@ -200,7 +200,7 @@ sub get_specs { %$attribs, }; }; - my $dsn_o = new OptionParser( + my $dsn_o = OptionParser->new( description => 'DSN OPTIONS', head1 => 'DSN OPTIONS', dsn => 0, # XXX don't infinitely recurse! From 7e4b1def6a96c61cfb62b220ded41a5ecfb7201b Mon Sep 17 00:00:00 2001 From: Brian Fraser Date: Fri, 23 Dec 2011 00:34:47 -0300 Subject: [PATCH 07/35] Removed indirect object syntax from PgLogParser.pm --- lib/PgLogParser.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/PgLogParser.pm b/lib/PgLogParser.pm index 9aa62d17..7f3f2f37 100644 --- a/lib/PgLogParser.pm +++ b/lib/PgLogParser.pm @@ -615,7 +615,7 @@ sub generate_wrappers { if ( ($self->{sanity} || '') ne "$args{next_event}" ){ MKDEBUG && _d("Clearing and recreating internal state"); eval { require SysLogParser; }; # Required for tests to work. - my $sl = new SysLogParser(); + my $sl = SysLogParser->new(); # We need a special item in %args for syslog parsing. (This might not be # a syslog log file...) See the test for t/samples/pg-syslog-002.txt for From be40a0280d3c35de70394fbf0897a90b732ec22b Mon Sep 17 00:00:00 2001 From: Brian Fraser Date: Fri, 23 Dec 2011 00:38:57 -0300 Subject: [PATCH 08/35] Removed indirect object syntax from ProtocolParser.pm --- lib/ProtocolParser.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ProtocolParser.pm b/lib/ProtocolParser.pm index 7e933f1a..a2b2bf7a 100644 --- a/lib/ProtocolParser.pm +++ b/lib/ProtocolParser.pm @@ -315,7 +315,7 @@ sub uncompress_data { # Uncompress the compressed binary data. my $uncomp_bin_data = ''; - my $z = new IO::Uncompress::Inflate( + my $z = IO::Uncompress::Inflate->new( \$comp_bin_data ) or die "IO::Uncompress::Inflate failed: $InflateError"; my $status = $z->read(\$uncomp_bin_data, $len) From 27b79ac337dc627b33f8319def8ddd6a6b01c1b6 Mon Sep 17 00:00:00 2001 From: Brian Fraser Date: Fri, 23 Dec 2011 02:44:54 -0300 Subject: [PATCH 09/35] Removed indirect object syntax from UpgradeReportFormatter.pm --- lib/UpgradeReportFormatter.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/UpgradeReportFormatter.pm b/lib/UpgradeReportFormatter.pm index c92e684f..96fe7275 100644 --- a/lib/UpgradeReportFormatter.pm +++ b/lib/UpgradeReportFormatter.pm @@ -85,7 +85,7 @@ sub event_report { } # Side-by-side hosts report. - my $report = new ReportFormatter( + my $report = ReportFormatter->new( underline_header => 0, strip_whitespace => 0, ); From 8c2d09b555995cc9a3174fe7efd074d45b1367b1 Mon Sep 17 00:00:00 2001 From: Brian Fraser Date: Fri, 23 Dec 2011 12:02:10 -0300 Subject: [PATCH 10/35] Removed indirect object syntax from the modulino portion of pt-archiver. --- bin/pt-archiver | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/bin/pt-archiver b/bin/pt-archiver index 2d0a07b7..25eaa706 100755 --- a/bin/pt-archiver +++ b/bin/pt-archiver @@ -3349,8 +3349,8 @@ my ( $src, $dst ); # Holds the arguments for the $sth's bind variables, so it can be re-tried # easily. my @beginning_of_txn; -my $vp = new VersionParser; -my $q = new Quoter; +my $vp = VersionParser->new(); +my $q = Quoter->new(); sub main { @ARGV = @_; # set global ARGV for this package @@ -3371,7 +3371,7 @@ sub main { # ######################################################################## # Get configuration information. # ######################################################################## - my $o = new OptionParser(); + my $o = OptionParser->new(); $o->get_specs(); $o->get_opts(); @@ -3461,7 +3461,7 @@ sub main { # We're not daemoninzing, it just handles PID stuff. Keep $daemon # in the the scope of main() because when it's destroyed it automatically # removes the PID file. - $daemon = new Daemon(o=>$o); + $daemon = Daemon->new(o=>$o); $daemon->make_PID_file(); } @@ -3496,8 +3496,8 @@ sub main { # Inspect DB servers and tables. # ######################################################################## - my $tp = new TableParser(Quoter => $q); - my $du = new MySQLDump(); + my $tp = TableParser->new(Quoter => $q); + my $du = MySQLDump->new(); foreach my $table ( grep { $_ } ($src, $dst) ) { my $ac = !$txnsize && !$commit_each; if ( !defined $table->{p} && $o->get('ask-pass') ) { @@ -3606,7 +3606,7 @@ sub main { my $dsn_defaults = $dp->parse_options($o); my $dsn = $dp->parse($o->get('check-slave-lag'), $dsn_defaults); $lag_dbh = $dp->get_dbh($dp->get_cxn_params($dsn), { AutoCommit => 1 }); - $ms = new MasterSlave(VersionParser => $vp); + $ms = MasterSlave->new(VersionParser => $vp); } # ######################################################################## @@ -3627,7 +3627,7 @@ sub main { # Design SQL statements. # ######################################################################## my $dbh = $src->{dbh}; - my $nibbler = new TableNibbler( + my $nibbler = TableNibbler->new( TableParser => $tp, Quoter => $q, ); From f5ff076c7c570e0b6f062bcfffd9f1e638dbfa52 Mon Sep 17 00:00:00 2001 From: Brian Fraser Date: Fri, 23 Dec 2011 12:06:14 -0300 Subject: [PATCH 11/35] Removed indirect object syntax from the modulino portion of pt-config-diff --- bin/pt-config-diff | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/bin/pt-config-diff b/bin/pt-config-diff index 176d9748..0faa19fa 100755 --- a/bin/pt-config-diff +++ b/bin/pt-config-diff @@ -2749,7 +2749,7 @@ sub main { # ######################################################################## # Get configuration information. # ######################################################################## - my $o = new OptionParser(); + my $o = OptionParser->new(); $o->get_specs(); $o->get_opts(); @@ -2767,8 +2767,8 @@ sub main { # ######################################################################### # Make common modules. # ######################################################################### - my $trp = new TextResultSetParser(); - my $config_cmp = new MySQLConfigComparer( + my $trp = TextResultSetParser->new(); + my $config_cmp = MySQLConfigComparer->new( ignore_variables => $o->get('ignore-variables'), ); my %common_modules = ( @@ -2788,7 +2788,7 @@ sub main { foreach my $config_src ( @ARGV ) { if ( -f $config_src ) { MKDEBUG && _d('Config source', $config_src, 'is a file'); - push @configs, new MySQLConfig( + push @configs, MySQLConfig->new( file => $config_src, %common_modules, ); @@ -2801,7 +2801,7 @@ sub main { $dp->fill_in_dsn($dbh, $dsn); $last_dsn = $dsn; - push @configs, new MySQLConfig( + push @configs, MySQLConfig->new( dbh => $dbh, %common_modules, ); @@ -2816,13 +2816,13 @@ sub main { # ######################################################################## my $daemon; if ( $o->get('daemonize') ) { - $daemon = new Daemon(o=>$o); + $daemon = Daemon->new(o=>$o); $daemon->daemonize(); MKDEBUG && _d('I am a daemon now'); } elsif ( $o->get('pid') ) { # We're not daemoninzing, it just handles PID stuff. - $daemon = new Daemon(o=>$o); + $daemon = Daemon->new(o=>$o); $daemon->make_PID_file(); } @@ -2832,7 +2832,7 @@ sub main { my $report; my $truncate_callback; if ( $o->get('report') ) { - $report = new ReportFormatter( + $report = ReportFormatter->new( line_prefix => '', line_width => $o->get('report-width'), ); From 78cca4a6e834a9fca38259deeda3f46b8e2b2e53 Mon Sep 17 00:00:00 2001 From: Brian Fraser Date: Fri, 23 Dec 2011 12:07:36 -0300 Subject: [PATCH 12/35] Removed indirect object syntax from the modulino portion of pt-deadlock-logger --- bin/pt-deadlock-logger | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/pt-deadlock-logger b/bin/pt-deadlock-logger index 4d6fa94a..d457f5af 100755 --- a/bin/pt-deadlock-logger +++ b/bin/pt-deadlock-logger @@ -1806,13 +1806,13 @@ my %is_proc_info = ( sub main { @ARGV = @_; # set global ARGV for this package - my $q = new Quoter(); - my $vp = new VersionParser(); + my $q = Quoter->new(); + my $vp = VersionParser->new(); # ######################################################################## # Get configuration information. # ######################################################################## - $o = new OptionParser(); + $o = OptionParser->new(); $o->get_specs(); $o->get_opts(); @@ -1897,13 +1897,13 @@ sub main { # Daemonize only after (potentially) asking for passwords for --ask-pass. my $daemon; if ( $o->get('daemonize') ) { - $daemon = new Daemon(o=>$o); + $daemon = Daemon->new(o=>$o); $daemon->daemonize(); MKDEBUG && _d('I am a daemon now'); } elsif ( $o->get('pid') ) { # We're not daemoninzing, it just handles PID stuff. - $daemon = new Daemon(o=>$o); + $daemon = Daemon->new(o=>$o); $daemon->make_PID_file(); } From a45ea9cb2b8a95b277a26a30521981f3ea530f23 Mon Sep 17 00:00:00 2001 From: Brian Fraser Date: Fri, 23 Dec 2011 12:11:05 -0300 Subject: [PATCH 13/35] Removed indirect object syntax from the modulino portion of pt-duplicate-key-checker --- bin/pt-duplicate-key-checker | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/bin/pt-duplicate-key-checker b/bin/pt-duplicate-key-checker index ce9625e4..567ff2ba 100755 --- a/bin/pt-duplicate-key-checker +++ b/bin/pt-duplicate-key-checker @@ -3574,13 +3574,13 @@ sub main { my %summary = ( 'Total Indexes' => 0 ); my %seen_tbl; - my $q = new Quoter(); - my $tp = new TableParser(Quoter => $q); + my $q = Quoter->new(); + my $tp = TableParser->new(Quoter => $q); # ####################################################################### # Get configuration information and parse command line options. # ####################################################################### - my $o = new OptionParser(); + my $o = OptionParser->new(); $o->get_specs(); $o->get_opts(); @@ -3597,7 +3597,7 @@ sub main { # We're not daemoninzing, it just handles PID stuff. Keep $daemon # in the the scope of main() because when it's destroyed it automatically # removes the PID file. - $daemon = new Daemon(o=>$o); + $daemon = Daemon->new(o=>$o); $daemon->make_PID_file(); } @@ -3613,15 +3613,15 @@ sub main { my $dbh = $dp->get_dbh($dp->get_cxn_params($dsn), { AutoCommit => 1, }); - my $vp = new VersionParser(); + my $vp = VersionParser->new(); my $version = $vp->parse($dbh->selectrow_array('SELECT VERSION()')); # ####################################################################### # Do the main work. # ####################################################################### - my $ks = $o->get('summary') ? new KeySize(q=>$q) : undef; - my $dk = new DuplicateKeyFinder(); - my $du = new MySQLDump(); + my $ks = $o->get('summary') ? KeySize->new(q=>$q) : undef; + my $dk = DuplicateKeyFinder->new(); + my $du = MySQLDump->new(); my %tp_opts = ( ignore_type => $o->get('all-structs'), @@ -3632,8 +3632,8 @@ sub main { my $get_keys = $o->get('key-types') =~ m/k/ ? 1 : 0; my $get_fks = $o->get('key-types') =~ m/f/ ? 1 : 0; - my $schema = new Schema(); - my $schema_itr = new SchemaIterator( + my $schema = Schema->new(); + my $schema_itr = SchemaIterator->new( dbh => $dbh, OptionParser => $o, Quoter => $q, From b586a1287481fee475406a963ccb78f8baf25f97 Mon Sep 17 00:00:00 2001 From: Brian Fraser Date: Fri, 23 Dec 2011 12:16:15 -0300 Subject: [PATCH 14/35] Removed indirect object syntax from the modulino portion of pt-fifo-split --- bin/pt-fifo-split | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/pt-fifo-split b/bin/pt-fifo-split index ee32e061..d92d755a 100755 --- a/bin/pt-fifo-split +++ b/bin/pt-fifo-split @@ -1241,7 +1241,7 @@ sub main { # ######################################################################## # Get configuration information. # ######################################################################## - my $o = new OptionParser(); + my $o = OptionParser->new(); $o->get_specs(); $o->get_opts(); @@ -1258,7 +1258,7 @@ sub main { # We're not daemoninzing, it just handles PID stuff. Keep $daemon # in the the scope of main() because when it's destroyed it automatically # removes the PID file. - $daemon = new Daemon(o=>$o); + $daemon = Daemon->new(o=>$o); $daemon->make_PID_file(); } From 277f487fef77f8e7e8de738f04f9eadf3ccf92d0 Mon Sep 17 00:00:00 2001 From: Brian Fraser Date: Fri, 23 Dec 2011 17:30:56 -0300 Subject: [PATCH 15/35] Removed indirect object syntax from the modulino portion of pt-find --- bin/pt-find | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bin/pt-find b/bin/pt-find index abeb2de9..494fd75a 100755 --- a/bin/pt-find +++ b/bin/pt-find @@ -2722,8 +2722,8 @@ sub main { # ######################################################################## # Get configuration information. # ######################################################################## - my $q = new Quoter(); - $o = new OptionParser(); + my $q = Quoter->new(); + $o = OptionParser->new(); $o->get_specs(); $o->get_opts(); @@ -2765,8 +2765,8 @@ sub main { my $need_table_struct = grep { $o->got($_); } @table_struct_tests; MKDEBUG && _d('Need table struct:', $need_table_struct); if ( $need_table_struct ) { - $du = new MySQLDump(); - $tp = new TableParser(Quoter => $q); + $du = MySQLDump->new(); + $tp = TableParser->new(Quoter => $q); } # ######################################################################## @@ -2777,7 +2777,7 @@ sub main { # We're not daemoninzing, it just handles PID stuff. Keep $daemon # in the the scope of main() because when it's destroyed it automatically # removes the PID file. - $daemon = new Daemon(o=>$o); + $daemon = Daemon->new(o=>$o); $daemon->make_PID_file(); } @@ -2838,7 +2838,7 @@ sub main { ($server_id) = $dbh->selectrow_array('SELECT @@SERVER_ID'); # Discover if we need to get stored code. Need dbh to do this. - my $vp = new VersionParser(); + my $vp = VersionParser->new(); my $need_stored_code = $vp->version_ge($dbh, '5.0.0'); $need_stored_code = grep { $o->got($_); } @stored_code_tests if $need_stored_code; From 264fdbd271e3c089b4ce46d82223e0cd10b8364a Mon Sep 17 00:00:00 2001 From: Brian Fraser Date: Fri, 23 Dec 2011 17:31:38 -0300 Subject: [PATCH 16/35] Removed indirect object syntax from the modulino portion of pt-fk-error-logger --- bin/pt-fk-error-logger | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/pt-fk-error-logger b/bin/pt-fk-error-logger index ac1c4c38..c6073aa8 100755 --- a/bin/pt-fk-error-logger +++ b/bin/pt-fk-error-logger @@ -1933,7 +1933,7 @@ sub main { # ######################################################################## # Get configuration information. # ######################################################################## - my $o = new OptionParser(); + my $o = OptionParser->new(); $o->get_specs(); $o->get_opts(); @@ -1969,7 +1969,7 @@ sub main { # ######################################################################## # Make common modules. # ######################################################################## - my $q = new Quoter(); + my $q = Quoter->new(); my %modules = ( o => $o, dp => $dp, @@ -2007,13 +2007,13 @@ sub main { # Daemonize only after (potentially) asking for passwords for --ask-pass. my $daemon; if ( $o->get('daemonize') ) { - $daemon = new Daemon(o=>$o); + $daemon = Daemon->new(o=>$o); $daemon->daemonize(); MKDEBUG && _d('I am a daemon now'); } elsif ( $o->get('pid') ) { # We're not daemoninzing, it just handles PID stuff. - $daemon = new Daemon(o=>$o); + $daemon = Daemon->new(o=>$o); $daemon->make_PID_file(); } From 512a98cecc13644b45dac9918e9af943bcd00241 Mon Sep 17 00:00:00 2001 From: Brian Fraser Date: Fri, 23 Dec 2011 17:34:25 -0300 Subject: [PATCH 17/35] Removed indirect object syntax from the modulino portion of pt-heartbeat Also added parens around the Transformer import list. Previously it was a bare qw() following the import, like this: Module->import qw( stuff ) However, that's actually ambiguous syntax, which happens to be deprecated in 5.14 (so it throws warnings by default), and will be removed in 5.18. --- bin/pt-heartbeat | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/bin/pt-heartbeat b/bin/pt-heartbeat index 5db1947c..b0847a92 100755 --- a/bin/pt-heartbeat +++ b/bin/pt-heartbeat @@ -3024,7 +3024,7 @@ use IO::File; use constant MKDEBUG => $ENV{MKDEBUG} || 0; -Transformers->import qw(ts unix_timestamp); +Transformers->import(qw(ts unix_timestamp)); my @dbhs; # Holds slave DBHs if --recurse my @sths; # Holds [$host, $sth] if --recurse @@ -3039,7 +3039,7 @@ sub main { # ######################################################################## # Get configuration information. # ######################################################################## - my $o = new OptionParser(); + my $o = OptionParser->new(); $o->get_specs(); $o->get_opts(); @@ -3089,8 +3089,8 @@ sub main { # ######################################################################## # Make common modules and var for frequently used options. # ######################################################################## - my $q = new Quoter(); - my $tp = new TableParser(Quoter => $q); + my $q = Quoter->new(); + my $tp = TableParser->new(Quoter => $q); my $interval = $o->get('interval'); my $skew = $o->get('update') ? 0 : $o->get('skew'); @@ -3205,8 +3205,8 @@ sub main { my $master_server_id = $o->get('master-server-id'); if ( !$master_server_id ) { eval { - my $vp = new VersionParser(); - my $ms = new MasterSlave(VersionParser => $vp); + my $vp = VersionParser->new(); + my $ms = MasterSlave->new(VersionParser => $vp); my $master_dsn = $ms->get_master_dsn($dbh, $dsn, $dp) or die "This server is not a slave"; my $master_dbh = $dp->get_dbh($dp->get_cxn_params($master_dsn), @@ -3393,13 +3393,13 @@ sub main { # ######################################################################## my $daemon; if ( $o->get('daemonize') ) { - $daemon = new Daemon(o=>$o); + $daemon = Daemon->new(o=>$o); $daemon->daemonize(); MKDEBUG && _d('I am a daemon now'); } elsif ( $o->get('pid') ) { # We're not daemoninzing, it just handles PID stuff. - $daemon = new Daemon(o=>$o); + $daemon = Daemon->new(o=>$o); $daemon->make_PID_file(); } @@ -3533,8 +3533,8 @@ sub check_delay { # Collect a list of connections to the slaves. if ( $o->get('recurse') ) { MKDEBUG && _d('Recursing to slaves'); - my $vp = new VersionParser(); - my $ms = new MasterSlave(VersionParser => $vp); + my $vp = VersionParser->new(); + my $ms = MasterSlave->new(VersionParser => $vp); $ms->recurse_to_slaves( { dbh => $dbh, dsn => $dsn, From 9fc9f631799ee72d39707b2781f4b3d176803eee Mon Sep 17 00:00:00 2001 From: Brian Fraser Date: Fri, 23 Dec 2011 17:40:24 -0300 Subject: [PATCH 18/35] Removed indirect object syntax from the modulino portion of pt-index-usage --- bin/pt-index-usage | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/bin/pt-index-usage b/bin/pt-index-usage index fc6af344..cfaa0d6f 100755 --- a/bin/pt-index-usage +++ b/bin/pt-index-usage @@ -4965,7 +4965,7 @@ sub main { # ########################################################################## # Get configuration information. # ########################################################################## - my $o = new OptionParser(); + my $o = OptionParser->new(); $o->get_specs(); $o->get_opts(); my $dp = $o->DSNParser(); @@ -5047,18 +5047,18 @@ sub main { # ########################################################################## # Make common modules. # ########################################################################## - my $q = new Quoter(); - my $qp = new QueryParser(); - my $qr = new QueryRewriter(QueryParser => $qp); - my $tp = new TableParser(Quoter => $q); - my $vp = new VersionParser(); - my $parser = new SlowLogParser(); - my $fi = new FileIterator(); - my $du = new MySQLDump(); - my $iu = new IndexUsage( + my $q = Quoter->new(); + my $qp = QueryParser->new(); + my $qr = QueryRewriter->new(QueryParser => $qp); + my $tp = TableParser->new(Quoter => $q); + my $vp = VersionParser->new(); + my $parser = SlowLogParser->new(); + my $fi = FileIterator->new(); + my $du = MySQLDump->new(); + my $iu = IndexUsage->new( QueryRewriter => $qr, ); - my $exa = new ExplainAnalyzer( + my $exa = ExplainAnalyzer->new( QueryRewriter => $qr, QueryParser => $qp ); @@ -5139,8 +5139,8 @@ sub main { # ######################################################################## my $version = $vp->parse($dbh->selectrow_array('SELECT VERSION()')); - my $schema = new Schema(); - my $schema_itr = new SchemaIterator( + my $schema = Schema->new(); + my $schema_itr = SchemaIterator->new( dbh => $dbh, OptionParser => $o, Quoter => $q, @@ -5203,7 +5203,7 @@ sub main { # ##################################################################### my $pr; if ( $o->get('progress') && $filename && -e $filename ) { - $pr = new Progress( + $pr = Progress->new( jobsize => -s $filename, spec => $o->get('progress'), name => $filename, @@ -5530,7 +5530,7 @@ sub create_views { my ($dbh) = @args{@required_args}; MKDEBUG && _d("Creating views"); - my $pod_parser = new PodParser(); + my $pod_parser = PodParser->new(); $pod_parser->parse_from_file(__FILE__); my $magic = $pod_parser->get_magic('OPTIONS'); From d6a94bbe6aec816c5e856cd1cf65fac6187b1e4f Mon Sep 17 00:00:00 2001 From: Brian Fraser Date: Fri, 23 Dec 2011 17:50:54 -0300 Subject: [PATCH 19/35] Removed indirect object syntax from the modulino portion of pt-kill. See also the note on the parens around qw() in a previous commit. --- bin/pt-kill | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/bin/pt-kill b/bin/pt-kill index 05f638e1..49d6998b 100755 --- a/bin/pt-kill +++ b/bin/pt-kill @@ -3420,7 +3420,7 @@ $Data::Dumper::Indent = 1; $Data::Dumper::Sortkeys = 1; $Data::Dumper::Quotekeys = 0; -Transformers->import qw(ts); +Transformers->import(qw(ts)); use constant MKDEBUG => $ENV{MKDEBUG} || 0; @@ -3435,15 +3435,15 @@ my $o; sub main { @ARGV = @_; # set global ARGV for this package - my $ms = new MasterSlave(); - my $pl = new Processlist(MasterSlave => $ms); - my $vp = new VersionParser(); - my $qr = new QueryRewriter(); + my $ms = MasterSlave->new(); + my $pl = Processlist->new(MasterSlave => $ms); + my $vp = VersionParser->new(); + my $qr = QueryRewriter->new(); # ######################################################################## # Get configuration information. # ######################################################################## - $o = new OptionParser(); + $o = OptionParser->new(); $o->get_specs(); $o->get_opts(); @@ -3504,7 +3504,7 @@ sub main { my $get_proclist; if ( @ARGV ) { MKDEBUG && _d('Getting processlist from files:', @ARGV); - my $trp = new TextResultSetParser(); + my $trp = TextResultSetParser->new(); my $fh; $get_proclist = sub { if ( !$fh ) { @@ -3555,13 +3555,13 @@ sub main { # ######################################################################## my $daemon; if ( $o->get('daemonize') ) { - $daemon = new Daemon(o=>$o); + $daemon = Daemon->new(o=>$o); $daemon->daemonize(); MKDEBUG && _d('I am a daemon now'); } elsif ( $o->get('pid') ) { # We're not daemoninzing, it just handles PID stuff. - $daemon = new Daemon(o=>$o); + $daemon = Daemon->new(o=>$o); $daemon->make_PID_file(); } From 1d555c28e3eaf16d51fafa6264d7f2d7a61beb6a Mon Sep 17 00:00:00 2001 From: Brian Fraser Date: Fri, 23 Dec 2011 17:52:30 -0300 Subject: [PATCH 20/35] Removed indirect object syntax from the modulino portion of pt-log-player --- bin/pt-log-player | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bin/pt-log-player b/bin/pt-log-player index 3a2afad8..6c7c5f9c 100755 --- a/bin/pt-log-player +++ b/bin/pt-log-player @@ -2565,7 +2565,7 @@ sub main { # ######################################################################### # Get configuration information. # ######################################################################### - $o = new OptionParser(); + $o = OptionParser->new(); $o->get_specs(); $o->get_opts(); @@ -2607,7 +2607,7 @@ sub main { # We're not daemoninzing, it just handles PID stuff. Keep $daemon # in the the scope of main() because when it's destroyed it automatically # removes the PID file. - $daemon = new Daemon(o=>$o); + $daemon = Daemon->new(o=>$o); $daemon->make_PID_file(); } @@ -2647,11 +2647,11 @@ sub main { push @callbacks, $sub; } - my $parser = $o->get('type') eq 'slowlog' ? new SlowLogParser() - : $o->get('type') eq 'binlog' ? new BinaryLogParser() - : $o->get('type') eq 'genlog' ? new GeneralLogParser() + my $parser = $o->get('type') eq 'slowlog' ? SlowLogParser->new() + : $o->get('type') eq 'binlog' ? BinaryLogParser->new() + : $o->get('type') eq 'genlog' ? GeneralLogParser->new() : die("Unknown type " . $o->get('type')); - my $ls = new LogSplitter( + my $ls = LogSplitter->new( attribute => $split, split_random => $o->get('split-random'), base_dir => $base_dir, From fff967a108fd00ab31399f157a424a85a29a2606 Mon Sep 17 00:00:00 2001 From: Brian Fraser Date: Mon, 26 Dec 2011 11:05:32 -0300 Subject: [PATCH 21/35] Removed indirect object syntax from the modulino portion of pt-online-schema-change --- bin/pt-online-schema-change | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/bin/pt-online-schema-change b/bin/pt-online-schema-change index e993a791..5fe6f7e1 100755 --- a/bin/pt-online-schema-change +++ b/bin/pt-online-schema-change @@ -4102,7 +4102,7 @@ $Data::Dumper::Indent = 1; $Data::Dumper::Sortkeys = 1; $Data::Dumper::Quotekeys = 0; -Transformers->import qw(ts); +Transformers->import(qw(ts)); use constant MKDEBUG => $ENV{MKDEBUG} || 0; @@ -4110,16 +4110,16 @@ my $quiet = 0; # for msg() sub main { @ARGV = @_; # set global ARGV for this package - my $vp = new VersionParser(); - my $q = new Quoter(); - my $tp = new TableParser(Quoter => $q); - my $du = new MySQLDump(); - my $chunker = new TableChunker(Quoter => $q, MySQLDump => $du); + my $vp = VersionParser->new(); + my $q = Quoter->new(); + my $tp = TableParser->new(Quoter => $q); + my $du = MySQLDump->new(); + my $chunker = TableChunker->new(Quoter => $q, MySQLDump => $du); # ######################################################################## # Get configuration information. # ######################################################################## - my $o = new OptionParser(); + my $o = OptionParser->new(); $o->get_specs(); $o->get_opts(); @@ -4143,7 +4143,7 @@ sub main { } } - my $rename_fk_method = lc $o->get('update-foreign-keys-method'); + my $rename_fk_method = lc($o->get('update-foreign-keys-method') || ''); if ( ($rename_fk_method || '') eq 'drop_old_table' ) { $o->set('rename-tables', 0); $o->set('drop-old-table', 0), @@ -4205,7 +4205,7 @@ sub main { my $daemon; if ( $o->get('pid') ) { # We're not daemoninzing, it just handles PID stuff. - $daemon = new Daemon(o=>$o); + $daemon = Daemon->new(o=>$o); $daemon->make_PID_file(); } @@ -4236,8 +4236,8 @@ sub main { # Create the capture-sync and copy-rows plugins. Currently, we just have # one method for each. # ######################################################################## - my $capture_sync = new OSCCaptureSync(); - my $copy_rows = new CopyRowsInsertSelect(Retry => new Retry()); + my $capture_sync = OSCCaptureSync->new(); + my $copy_rows = CopyRowsInsertSelect->new(Retry => Retry->new()); # More values are added later. These are the minimum need to do --cleanup. my %plugin_args = ( @@ -4313,7 +4313,7 @@ sub main { %range_stats, ); $plugin_args{chunks} = \@chunks; - $plugin_args{Progress} = new Progress( + $plugin_args{Progress} = Progress->new( jobsize => scalar @chunks, spec => $o->get('progress'), name => "Copying rows", From 451f25a932432bb25025fb39d3d103a779da1c17 Mon Sep 17 00:00:00 2001 From: Brian Fraser Date: Mon, 26 Dec 2011 11:05:52 -0300 Subject: [PATCH 22/35] Removed indirect object syntax from the modulino portion of pt-query-advisor --- bin/pt-query-advisor | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/bin/pt-query-advisor b/bin/pt-query-advisor index b61e1a69..3fdb7a95 100755 --- a/bin/pt-query-advisor +++ b/bin/pt-query-advisor @@ -6036,7 +6036,7 @@ sub main { # ######################################################################## # Get configuration information. # ######################################################################## - my $o = new OptionParser(); + my $o = OptionParser->new(); $o->get_specs(); $o->get_opts(); @@ -6063,9 +6063,9 @@ sub main { # ######################################################################### # Load rules from POD and plugins. # ######################################################################### - my $p = new PodParser(); - my $qar = new QueryAdvisorRules(PodParser => $p); - my $adv = new Advisor( + my $p = PodParser->new(); + my $qar = QueryAdvisorRules->new(PodParser => $p); + my $adv = Advisor->new( match_type => "pos", ignore_rules => $o->get('ignore-rules'), ); @@ -6082,12 +6082,12 @@ sub main { # ######################################################################### # Make common modules. # ######################################################################### - my $q = new Quoter(); - my $qp = new QueryParser(); - my $qr = new QueryRewriter( QueryParser => $qp ); - my $sp = new SQLParser(); - my $tp = new TableParser(Quoter => $q); - my $du = new MySQLDump(); + my $q = Quoter->new(); + my $qp = QueryParser->new(); + my $qr = QueryRewriter->new( QueryParser => $qp ); + my $sp = SQLParser->new(); + my $tp = TableParser->new(Quoter => $q); + my $du = MySQLDump->new(); my %common_modules = ( DSNParser => $dp, Quoter => $q, @@ -6370,13 +6370,13 @@ sub main { # ######################################################################## my $daemon; if ( $o->get('daemonize') ) { - $daemon = new Daemon(o=>$o); + $daemon = Daemon->new(o=>$o); $daemon->daemonize(); MKDEBUG && _d('I am a daemon now'); } elsif ( $o->get('pid') ) { # We're not daemoninzing, it just handles PID stuff. - $daemon = new Daemon(o=>$o); + $daemon = Daemon->new(o=>$o); $daemon->make_PID_file(); } @@ -6453,7 +6453,7 @@ sub main { # ######################################################################## if ( keys %severity_count ) { eval { - my $profile = new ReportFormatter( + my $profile = ReportFormatter->new( long_last_column => 1, extend_right => 1, ); From c4f127092dc719cf78ef1fe7887e62f800a11761 Mon Sep 17 00:00:00 2001 From: Brian Fraser Date: Mon, 26 Dec 2011 11:09:33 -0300 Subject: [PATCH 23/35] Removed indirect object syntax from the modulino portion of pt-query-digest --- bin/pt-query-digest | 48 ++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/bin/pt-query-digest b/bin/pt-query-digest index 21dec40e..3353575b 100755 --- a/bin/pt-query-digest +++ b/bin/pt-query-digest @@ -11803,7 +11803,7 @@ sub main { # ########################################################################## # Get configuration information. # ########################################################################## - my $o = new OptionParser(); + my $o = OptionParser->new(); $o->get_specs(); $o->get_opts(); @@ -11888,9 +11888,9 @@ sub main { # ######################################################################## # Common modules. # ####################################################################### - my $q = new Quoter(); - my $qp = new QueryParser(); - my $qr = new QueryRewriter(QueryParser=>$qp); + my $q = Quoter->new(); + my $qp = QueryParser->new(); + my $qr = QueryRewriter->new(QueryParser=>$qp); my %common_modules = ( OptionParser => $o, DSNParser => $dp, @@ -11913,7 +11913,7 @@ sub main { ); $ep_dbh->{InactiveDestroy} = 1; # Don't die on fork(). - $exa = new ExplainAnalyzer( + $exa = ExplainAnalyzer->new( QueryRewriter => $qr, QueryParser => $qp, ); @@ -11926,8 +11926,8 @@ sub main { my $qv_dbh; # For QueryReview my $qv_dbh2; # For QueryReview and --review-history if ( $review_dsn ) { - my $tp = new TableParser(Quoter => $q); - my $du = new MySQLDump(); + my $tp = TableParser->new(Quoter => $q); + my $du = MySQLDump->new(); $qv_dbh = get_cxn( for => '--review', dsn => $review_dsn, @@ -11962,7 +11962,7 @@ sub main { # Set up the new QueryReview object. my $struct = $tp->parse($du->get_create_table($qv_dbh, $q, @db_tbl)); - $qv = new QueryReview( + $qv = QueryReview->new( dbh => $qv_dbh, db_tbl => $db_tbl, tbl_struct => $struct, @@ -12067,7 +12067,7 @@ sub main { my $instrument = $o->get('pipeline-profile') || $o->get('execute-throttle'); MKDEBUG && _d('Instrument:', $instrument); - my $pipeline = new Pipeline( + my $pipeline = Pipeline->new( instrument => $instrument, continue_on_error => $o->get('continue-on-error'), ); @@ -12096,7 +12096,7 @@ sub main { } # prep { # input - my $fi = new FileIterator(); + my $fi = FileIterator->new(); my $next_file = $fi->get_file_itr(@ARGV); my $input_fh; # the current input fh my $pr; # Progress obj for ^ @@ -12138,7 +12138,7 @@ sub main { # Make a progress reporter, one per file. if ( $o->get('progress') && $filename && -e $filename ) { - $pr = new Progress( + $pr = Progress->new( jobsize => $filesize, spec => $o->get('progress'), name => $filename, @@ -12161,8 +12161,8 @@ sub main { { # event my $misc; if ( my $ps_dsn = $o->get('processlist') ) { - my $ms = new MasterSlave(); - my $pl = new Processlist( + my $ms = MasterSlave->new(); + my $pl = Processlist->new( interval => $o->get('interval') * 1_000_000, MasterSlave => $ms ); @@ -12321,7 +12321,7 @@ sub main { else { $now_callback = sub { return; }; } - $pipeline_data->{Runtime} = new Runtime( + $pipeline_data->{Runtime} = Runtime->new( now => $now_callback, runtime => $o->get('run-time'), ); @@ -12537,7 +12537,7 @@ sub main { if ( $o->get('statistics') ) { if ( keys %stats ) { - my $report = new ReportFormatter( + my $report = ReportFormatter->new( line_width => 74, ); $report->set_columns( @@ -12858,7 +12858,7 @@ sub main { ); }; - $et = new ExecutionThrottler( + $et = ExecutionThrottler->new( rate_max => $rate_max, get_rate => $get_rate, check_int => $int, @@ -12974,7 +12974,7 @@ sub main { } # execute throttle and execute if ( $o->get('print') ) { - my $w = new SlowLogWriter(); + my $w = SlowLogWriter->new(); $pipeline->add( name => 'print', process => sub { @@ -13017,7 +13017,7 @@ sub main { Killed => 'bool', }; - my $ea = new EventAggregator( + my $ea = EventAggregator->new( groupby => $groupby, attributes => { %attributes }, worst => $orderby_attrib, @@ -13040,7 +13040,7 @@ sub main { # If user wants a timeline report, too, then create an EventTimeline # aggregator for this groupby attrib and add it to the callbacks, too. if ( $o->get('timeline') ) { - my $tl = new EventTimeline( + my $tl = EventTimeline->new( groupby => [$groupby], attributes => [qw(Query_time ts)], ); @@ -13062,13 +13062,13 @@ sub main { # ######################################################################## my $daemon; if ( $o->get('daemonize') ) { - $daemon = new Daemon(o=>$o); + $daemon = Daemon->new(o=>$o); $daemon->daemonize(); MKDEBUG && _d('I am a daemon now'); } elsif ( $o->get('pid') ) { # We're not daemoninzing, it just handles PID stuff. - $daemon = new Daemon(o=>$o); + $daemon = Daemon->new(o=>$o); $daemon->make_PID_file(); } @@ -13159,14 +13159,14 @@ sub print_reports { $print_header = 1; } - my $qrf = new QueryReportFormatter( + my $qrf = QueryReportFormatter->new( dbh => $ep_dbh, %args, ); # http://code.google.com/p/maatkit/issues/detail?id=1141 $qrf->set_report_formatter( report => 'profile', - formatter => new ReportFormatter ( + formatter => ReportFormatter->new( line_width => $o->get('explain') ? 82 : 74, long_last_column => 1, extend_right => 1, @@ -13221,7 +13221,7 @@ sub print_reports { } # Each groupby if ( $o->get('pipeline-profile') ) { - my $report = new ReportFormatter( + my $report = ReportFormatter->new( line_width => 74, ); $report->set_columns( From dbbdada99bb5a6b7c33e627607be765f487385c9 Mon Sep 17 00:00:00 2001 From: Brian Fraser Date: Mon, 26 Dec 2011 11:17:18 -0300 Subject: [PATCH 24/35] Removed indirect object syntax from the modulino portion of pt-show-grants --- bin/pt-show-grants | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/pt-show-grants b/bin/pt-show-grants index 3bb1f3b8..6ed1f907 100755 --- a/bin/pt-show-grants +++ b/bin/pt-show-grants @@ -1595,7 +1595,7 @@ sub main { # ######################################################################## # Get configuration information. # ######################################################################## - my $o = new OptionParser(); + my $o = OptionParser->new(); $o->get_specs(); $o->get_opts(); From edf48ae7e0e063450e266fe530b63e8142fafcb2 Mon Sep 17 00:00:00 2001 From: Brian Fraser Date: Mon, 26 Dec 2011 11:18:24 -0300 Subject: [PATCH 25/35] Removed indirect object syntax from the modulino portion of pt-slave-delay --- bin/pt-slave-delay | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/pt-slave-delay b/bin/pt-slave-delay index 37a6f797..2825ae6b 100755 --- a/bin/pt-slave-delay +++ b/bin/pt-slave-delay @@ -2023,8 +2023,8 @@ my $oktorun = 1; sub main { @ARGV = @_; # set global ARGV for this package - my $vp = new VersionParser(); - $o = new OptionParser(); + my $vp = VersionParser->new(); + $o = OptionParser->new(); $o->get_specs(); $o->get_opts(); @@ -2087,13 +2087,13 @@ sub main { # Daemonize only after (potentially) asking for passwords for --ask-pass. my $daemon; if ( $o->get('daemonize') ) { - $daemon = new Daemon(o=>$o); + $daemon = Daemon->new(o=>$o); $daemon->daemonize(); MKDEBUG && _d('I am a daemon now'); } elsif ( $o->get('pid') ) { # We're not daemoninzing, it just handles PID stuff. - $daemon = new Daemon(o=>$o); + $daemon = Daemon->new(o=>$o); $daemon->make_PID_file(); } @@ -2113,7 +2113,7 @@ sub main { # increasing wait time from 3 to 15 seconds. $o->set('ask-pass', 0); # don't ask again my $tries = 10; - my $rt = new Retry(); + my $rt = Retry->new(); $rt->retry( tries => $tries, retry_on_die => 1, From 0348e06e167f5cae125c6503cc08f8c7ff713fca Mon Sep 17 00:00:00 2001 From: Brian Fraser Date: Mon, 26 Dec 2011 11:26:59 -0300 Subject: [PATCH 26/35] Removed indirect object syntax from the modulino portion of pt-slave-find --- bin/pt-slave-find | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/pt-slave-find b/bin/pt-slave-find index 5baa0db3..e317e4ec 100755 --- a/bin/pt-slave-find +++ b/bin/pt-slave-find @@ -2552,7 +2552,7 @@ sub main { # ######################################################################## # Get configuration information. # ######################################################################## - my $o = new OptionParser(); + my $o = OptionParser->new(); $o->get_specs(); $o->get_opts(); @@ -2580,7 +2580,7 @@ sub main { # We're not daemoninzing, it just handles PID stuff. Keep $daemon # in the the scope of main() because when it's destroyed it automatically # removes the PID file. - $daemon = new Daemon(o=>$o); + $daemon = Daemon->new(o=>$o); $daemon->make_PID_file(); } @@ -2595,8 +2595,8 @@ sub main { # Despite the name, recursing to slaves actually begins at the specified # server, so the named server may also be included. - my $vp = new VersionParser(); - my $ms = new MasterSlave(VersionParser => $vp); + my $vp = VersionParser->new(); + my $ms = MasterSlave->new(VersionParser => $vp); $ms->recurse_to_slaves( { dbh => $dbh, dsn => $master_dsn, From b46bec2d7f405ac4a8646876bc1bfa772084d303 Mon Sep 17 00:00:00 2001 From: Brian Fraser Date: Mon, 26 Dec 2011 11:33:26 -0300 Subject: [PATCH 27/35] Removed indirect object syntax from the modulino portion of pt-slave-restart --- bin/pt-slave-restart | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bin/pt-slave-restart b/bin/pt-slave-restart index 70a43db9..edf01fe9 100755 --- a/bin/pt-slave-restart +++ b/bin/pt-slave-restart @@ -2372,8 +2372,8 @@ $OUTPUT_AUTOFLUSH = 1; my $o; my $dp; -my $q = new Quoter(); -my $vp = new VersionParser(); +my $q = Quoter->new(); +my $vp = VersionParser->new(); my %children; sub main { @@ -2382,7 +2382,7 @@ sub main { # ######################################################################## # Get configuration information. # ######################################################################## - $o = new OptionParser(); + $o = OptionParser->new(); $o->get_specs(); $o->get_opts(); @@ -2454,13 +2454,13 @@ sub main { # Daemonize only after connecting and doing --ask-pass. my $daemon; if ( $o->get('daemonize') ) { - $daemon = new Daemon(o=>$o); + $daemon = Daemon->new(o=>$o); $daemon->daemonize(); MKDEBUG && _d('I am a daemon now'); } elsif ( $o->get('pid') ) { # We're not daemoninzing, it just handles PID stuff. - $daemon = new Daemon(o=>$o); + $daemon = Daemon->new(o=>$o); $daemon->make_PID_file(); } @@ -2469,7 +2469,7 @@ sub main { # Despite the name, recursing to slaves actually begins at the specified # server, so the named server may also be watched, if it's a slave. - my $ms = new MasterSlave(VersionParser => $vp); + my $ms = MasterSlave->new(VersionParser => $vp); $ms->recurse_to_slaves( { dbh => $dbh, dsn => $dsn, From 985379547b944e8f181b65f80cc7f015642d9b3f Mon Sep 17 00:00:00 2001 From: Brian Fraser Date: Mon, 26 Dec 2011 11:37:25 -0300 Subject: [PATCH 28/35] Removed indirect object syntax from the modulino portion of pt-table-checksum --- bin/pt-table-checksum | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/bin/pt-table-checksum b/bin/pt-table-checksum index 0d55dfa2..39274bca 100755 --- a/bin/pt-table-checksum +++ b/bin/pt-table-checksum @@ -5010,7 +5010,7 @@ sub main { $already_checksummed = undef; %tables_to_checksum = (); - my $q = new Quoter(); + my $q = Quoter->new(); my $exit_status = 0; # ######################################################################## @@ -5018,7 +5018,7 @@ sub main { # ######################################################################## # Because of --arg-table, $final_o is the OptionParser obj used to get # most options (see my $final_o below). - my $o = new OptionParser(); + my $o = OptionParser->new(); $o->get_specs(); $o->get_opts(); @@ -5181,19 +5181,19 @@ sub main { # We're not daemoninzing, it just handles PID stuff. Keep $daemon # in the the scope of main() because when it's destroyed it automatically # removes the PID file. - $daemon = new Daemon(o=>$o); + $daemon = Daemon->new(o=>$o); $daemon->make_PID_file(); } # ######################################################################## # Ready to work now. # ######################################################################## - my $vp = new VersionParser(); - my $tp = new TableParser(Quoter => $q); - my $tc = new TableChecksum(Quoter=> $q, VersionParser => $vp); - my $ms = new MasterSlave(VersionParser => $vp); - my $du = new MySQLDump(); - my $ch = new TableChunker(Quoter => $q, MySQLDump => $du); + my $vp = VersionParser->new(); + my $tp = TableParser->new(Quoter => $q); + my $tc = TableChecksum->new(Quoter=> $q, VersionParser => $vp); + my $ms = MasterSlave->new(VersionParser => $vp); + my $du = MySQLDump->new(); + my $ch = TableChunker->new(Quoter => $q, MySQLDump => $du); my %common_modules = ( ch => $ch, dp => $dp, @@ -5456,7 +5456,7 @@ sub get_all_tbls_info { my $dbh = $args{dbh}; MKDEBUG && _d('Getting all schema objects'); - my $si = new SchemaIterator( + my $si = SchemaIterator->new( dbh => $dbh, OptionParser => $args{o}, Quoter => $args{q}, @@ -5853,7 +5853,7 @@ sub checksum_chunks { my @hosts = @{$args{hosts}}; my $tbl = $args{tbl}; - my $retry = new Retry(); + my $retry = Retry->new(); # ################################################################## # This loop may seem suboptimal, because it causes a new child to be @@ -5909,7 +5909,7 @@ sub checksum_chunks { if ( $throttle_method eq 'slavelag' ) { my $pr; if ( $o->get('progress') ) { - $pr = new Progress( + $pr = Progress->new( jobsize => scalar @{$args{slaves}}, spec => $o->get('progress'), name => "Wait for slave(s) to catch up", From fb263eb9343dc4a51761ae9c85405f7e6f5ff050 Mon Sep 17 00:00:00 2001 From: Brian Fraser Date: Mon, 26 Dec 2011 11:41:23 -0300 Subject: [PATCH 29/35] Removed indirect object syntax from the modulino portion of pt-table-sync --- bin/pt-table-sync | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/bin/pt-table-sync b/bin/pt-table-sync index 08be61f7..7d856d95 100755 --- a/bin/pt-table-sync +++ b/bin/pt-table-sync @@ -7266,7 +7266,7 @@ sub main { # ######################################################################## # Get configuration information. # ######################################################################## - my $o = new OptionParser(); + my $o = OptionParser->new(); $o->get_specs(); $o->get_opts(); @@ -7368,23 +7368,23 @@ sub main { # We're not daemoninzing, it just handles PID stuff. Keep $daemon # in the the scope of main() because when it's destroyed it automatically # removes the PID file. - $daemon = new Daemon(o=>$o); + $daemon = Daemon->new(o=>$o); $daemon->make_PID_file(); } # ######################################################################## # Do the work. # ######################################################################## - my $q = new Quoter(); - my $tp = new TableParser( Quoter => $q ); - my $vp = new VersionParser(); - my $ms = new MasterSlave(VersionParser => $vp); - my $du = new MySQLDump( cache => 0 ); - my $rt = new Retry(); - my $chunker = new TableChunker( Quoter => $q, MySQLDump => $du ); - my $nibbler = new TableNibbler( Quoter => $q, TableParser => $tp ); - my $checksum = new TableChecksum( Quoter => $q, VersionParser => $vp ); - my $syncer = new TableSyncer( + my $q = Quoter->new(); + my $tp = TableParser->new( Quoter => $q ); + my $vp = VersionParser->new(); + my $ms = MasterSlave->new(VersionParser => $vp); + my $du = MySQLDump->new( cache => 0 ); + my $rt = Retry->new(); + my $chunker = TableChunker->new( Quoter => $q, MySQLDump => $du ); + my $nibbler = TableNibbler->new( Quoter => $q, TableParser => $tp ); + my $checksum = TableChecksum->new( Quoter => $q, VersionParser => $vp ); + my $syncer = TableSyncer->new( Quoter => $q, VersionParser => $vp, MasterSlave => $ms, @@ -7876,7 +7876,7 @@ sub sync_all { tbl => undef, # set later }; - my $si = new SchemaIterator( + my $si = SchemaIterator->new( Quoter => $args{Quoter}, ); $si->set_filter($si->make_filter($o)); @@ -8103,8 +8103,8 @@ sub sync_a_table { my $change_dbh = get_change_dbh(tbl_struct => $tbl_struct, %args); my $actions = make_action_subs(change_dbh => $change_dbh, %args); - my $rd = new RowDiff(dbh => $src->{misc_dbh}); - my $ch = new ChangeHandler( + my $rd = RowDiff->new(dbh => $src->{misc_dbh}); + my $ch = ChangeHandler->new( left_db => $src->{db}, left_tbl => $src->{tbl}, right_db => $dst->{db}, From b8cb469a55ba74af5f7d6bd88ee2bef88adac40f Mon Sep 17 00:00:00 2001 From: Brian Fraser Date: Mon, 26 Dec 2011 11:57:26 -0300 Subject: [PATCH 30/35] Removed indirect object syntax from the modulino portion of pt-tcp-model --- bin/pt-tcp-model | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/pt-tcp-model b/bin/pt-tcp-model index a604f35e..2f5b3160 100755 --- a/bin/pt-tcp-model +++ b/bin/pt-tcp-model @@ -1902,7 +1902,7 @@ sub main { # ########################################################################## # Get configuration information. # ########################################################################## - my $o = new OptionParser(); + my $o = OptionParser->new(); $o->get_specs(); $o->get_opts(); if ( !$o->get('help') ) { @@ -1922,13 +1922,13 @@ sub main { # ######################################################################## # Set up objects and variables. # ######################################################################## - my $fi = new FileIterator(); + my $fi = FileIterator->new(); my $parser; if ( $o->get('type') eq 'tcpdump' ) { # Default: parse tcpdump - $parser = new SimpleTCPDumpParser(watch => $o->get('watch-server')); + $parser = SimpleTCPDumpParser->new(watch => $o->get('watch-server')); } else { - $parser = new TCPRequestAggregator( + $parser = TCPRequestAggregator->new( interval => $o->get('run-time'), quantile => $o->get('quantile') ); @@ -1963,7 +1963,7 @@ sub main { # ##################################################################### my $pr; if ( $o->get('progress') && $filename && -e $filename ) { - $pr = new Progress( + $pr = Progress->new( jobsize => -s $filename, spec => $o->get('progress'), name => $filename, From 465c6bd31edaae1ef214407a7263fdec17abddaa Mon Sep 17 00:00:00 2001 From: Brian Fraser Date: Mon, 26 Dec 2011 12:00:14 -0300 Subject: [PATCH 31/35] Removed indirect object syntax from the modulino portion of pt-trend --- bin/pt-trend | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/pt-trend b/bin/pt-trend index 15de89c9..f01cce2e 100755 --- a/bin/pt-trend +++ b/bin/pt-trend @@ -1806,7 +1806,7 @@ sub main { # ######################################################################## # Get configuration information. # ######################################################################## - my $o = new OptionParser(); + my $o = OptionParser->new(); $o->get_specs(); $o->get_opts(); $o->set('progress', undef) if $o->get('quiet'); @@ -1822,8 +1822,8 @@ sub main { $o->usage_or_errors(); # Set up common modules. - my $fi = new FileIterator(); - my $tst = new TimeSeriesTrender(callback => \&print_report); + my $fi = FileIterator->new(); + my $tst = TimeSeriesTrender->new(callback => \&print_report); # ######################################################################## # If --pid, check it first since we'll die if it already exists. @@ -1833,7 +1833,7 @@ sub main { # We're not daemonizing, it just handles PID stuff. Keep $daemon # in the the scope of main() because when it's destroyed it automatically # removes the PID file. - $daemon = new Daemon(o=>$o); + $daemon = Daemon->new(o=>$o); $daemon->make_PID_file(); } @@ -1854,7 +1854,7 @@ sub main { # ##################################################################### my $pr; if ( $o->get('progress') && $filename && -e $filename ) { - $pr = new Progress( + $pr = Progress->new( jobsize => -s $filename, spec => $o->get('progress'), name => $filename, From ac6789352a3320d212759302429fb4feb377746c Mon Sep 17 00:00:00 2001 From: Brian Fraser Date: Mon, 26 Dec 2011 12:02:22 -0300 Subject: [PATCH 32/35] Removed indirect object syntax from the modulino portion of pt-upgrade --- bin/pt-upgrade | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/bin/pt-upgrade b/bin/pt-upgrade index 246d9245..661caf6f 100755 --- a/bin/pt-upgrade +++ b/bin/pt-upgrade @@ -10479,7 +10479,7 @@ sub main { # ########################################################################## # Get configuration information. # ########################################################################## - my $o = new OptionParser(); + my $o = OptionParser->new(); $o->get_specs(); $o->get_opts(); @@ -10546,17 +10546,17 @@ sub main { # ######################################################################## # Make some common modules. # ######################################################################## - my $q = new Quoter(); - my $vp = new VersionParser(); - my $qp = new QueryParser(); - my $qr = new QueryRewriter(); - my $du = new MySQLDump(cache => 0); - my $rr = new Retry(); - my $tp = new TableParser(Quoter => $q); - my $chunker = new TableChunker(Quoter => $q, MySQLDump => $du ); - my $nibbler = new TableNibbler(Quoter => $q, TableParser => $tp ); - my $checksum = new TableChecksum(Quoter => $q, VersionParser => $vp); - my $syncer = new TableSyncer( + my $q = Quoter->new(); + my $vp = VersionParser->new(); + my $qp = QueryParser->new(); + my $qr = QueryRewriter->new(); + my $du = MySQLDump->new(cache => 0); + my $rr = Retry->new(); + my $tp = TableParser->new(Quoter => $q); + my $chunker = TableChunker->new(Quoter => $q, MySQLDump => $du ); + my $nibbler = TableNibbler->new(Quoter => $q, TableParser => $tp ); + my $checksum = TableChecksum->new(Quoter => $q, VersionParser => $vp); + my $syncer = TableSyncer->new( MasterSlave => 1, # I don't think we need this. Quoter => $q, VersionParser => $vp, @@ -10589,12 +10589,12 @@ sub main { my $plugins = []; if ( $method eq 'rows' ) { - push @$plugins, new TableSyncChunk(%common_modules); - push @$plugins, new TableSyncNibble(%common_modules); - push @$plugins, new TableSyncGroupBy(%common_modules); + push @$plugins, TableSyncChunk->new(%common_modules); + push @$plugins, TableSyncNibble->new(%common_modules); + push @$plugins, TableSyncGroupBy->new(%common_modules); } - push @compare_modules, new CompareResults( + push @compare_modules, CompareResults->new( method => $method, plugins => $plugins, get_id => sub { return make_checksum(@_); }, @@ -10604,7 +10604,7 @@ sub main { } if ( $compare->{query_times} ) { - push @compare_modules, new CompareQueryTimes( + push @compare_modules, CompareQueryTimes->new( get_id => sub { return make_checksum(@_); }, %common_modules, ); @@ -10622,7 +10622,7 @@ sub main { } } if ( $have_warnings ) { - push @compare_modules, new CompareWarnings( + push @compare_modules, CompareWarnings->new( 'clear-warnings' => $o->get('clear-warnings'), 'clear-warnings-table' => $o->get('clear-warnings-table'), get_id => sub { return make_checksum(@_); }, @@ -10636,14 +10636,14 @@ sub main { # ######################################################################## my $groupby = 'fingerprint'; map { - my $ea = new EventAggregator( + my $ea = EventAggregator->new( groupby => 'fingerprint', worst => 'Query_time', ); $_->{ea} = $ea; } @$hosts; - my $meta_ea = new EventAggregator( + my $meta_ea = EventAggregator->new( groupby => 'fingerprint', worst => 'differences' ); @@ -10671,7 +10671,7 @@ sub main { }; } else { - my $parser = new SlowLogParser(); + my $parser = SlowLogParser->new(); push @callbacks, sub { my ( $event, %args ) = @_; return $parser->parse_event(%args); @@ -10914,13 +10914,13 @@ sub main { # ######################################################################## my $daemon; if ( $o->get('daemonize') ) { - $daemon = new Daemon(o=>$o); + $daemon = Daemon->new(o=>$o); $daemon->daemonize(); MKDEBUG && _d('I am a daemon now'); } elsif ( $o->get('pid') ) { # We're not daemoninzing, it just handles PID stuff. - $daemon = new Daemon(o=>$o); + $daemon = Daemon->new(o=>$o); $daemon->make_PID_file(); } @@ -11009,7 +11009,7 @@ sub main { $host->{ea}->calculate_statistical_metrics(); } - my $urf = new UpgradeReportFormatter(); + my $urf = UpgradeReportFormatter->new(); my ($orderby_attrib, $orderby_func) = split(/:/, $o->get('order-by')); # We don't report on all queries, just the worst, i.e. the top @@ -11146,7 +11146,7 @@ sub report_errors { return unless keys %$errors; - my $rf = new ReportFormatter(extend_right=>1); + my $rf = ReportFormatter->new(extend_right=>1); $rf->set_title('Errors'); $rf->set_columns( { name => 'Query ID' }, From 2c9a0e8cbde30a73ad01780ff86fd253e84c705f Mon Sep 17 00:00:00 2001 From: Brian Fraser Date: Mon, 26 Dec 2011 12:03:21 -0300 Subject: [PATCH 33/35] Removed indirect object syntax from the modulino portion of pt-variable-advisor --- bin/pt-variable-advisor | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/bin/pt-variable-advisor b/bin/pt-variable-advisor index d294fc8c..32cf3bd3 100755 --- a/bin/pt-variable-advisor +++ b/bin/pt-variable-advisor @@ -2831,7 +2831,7 @@ sub main { # ######################################################################## # Get configuration information. # ######################################################################## - my $o = new OptionParser(); + my $o = OptionParser->new(); $o->get_specs(); $o->get_opts(); @@ -2863,9 +2863,9 @@ sub main { # ######################################################################### # Load rules from POD and plugins. # ######################################################################### - my $p = new PodParser(); - my $var = new VariableAdvisorRules(PodParser => $p); - my $adv = new Advisor( + my $p = PodParser->new(); + my $var = VariableAdvisorRules->new(PodParser => $p); + my $adv = Advisor->new( match_type => "bool", ignore_rules => $o->get('ignore-rules'), ); @@ -2882,8 +2882,8 @@ sub main { # ######################################################################### # Make common modules. # ######################################################################### - my $vp = new VersionParser(); - my $trp = new TextResultSetParser(); + my $vp = VersionParser->new(); + my $trp = TextResultSetParser->new(); my %common_modules = ( OptionParser => $o, DSNParser => $dp, @@ -2913,13 +2913,13 @@ sub main { # ######################################################################## my $daemon; if ( $o->get('daemonize') ) { - $daemon = new Daemon(o=>$o); + $daemon = Daemon->new(o=>$o); $daemon->daemonize(); MKDEBUG && _d('I am a daemon now'); } elsif ( $o->get('pid') ) { # We're not daemoninzing, it just handles PID stuff. - $daemon = new Daemon(o=>$o); + $daemon = Daemon->new(o=>$o); $daemon->make_PID_file(); } From 352a800446ab613883eee0a2e7b3c977dd8b9954 Mon Sep 17 00:00:00 2001 From: Brian Fraser Date: Mon, 26 Dec 2011 12:04:11 -0300 Subject: [PATCH 34/35] Removed indirect object syntax from the modulino portion of pt-visual-explain --- bin/pt-visual-explain | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/pt-visual-explain b/bin/pt-visual-explain index 6c985f71..6e643432 100755 --- a/bin/pt-visual-explain +++ b/bin/pt-visual-explain @@ -2271,7 +2271,7 @@ sub main { # ####################################################################### # Get configuration information and parse command line options. # ####################################################################### - my $o = new OptionParser(); + my $o = OptionParser->new(); $o->get_specs(); $o->get_opts(); @@ -2288,7 +2288,7 @@ sub main { # We're not daemoninzing, it just handles PID stuff. Keep $daemon # in the the scope of main() because when it's destroyed it automatically # removes the PID file. - $daemon = new Daemon(o=>$o); + $daemon = Daemon->new(o=>$o); $daemon->make_PID_file(); } From 6718eab36b5895c975e0da8de9f8513d1a52c63e Mon Sep 17 00:00:00 2001 From: Brian Fraser Date: Mon, 26 Dec 2011 16:06:41 -0300 Subject: [PATCH 35/35] Removed indirect object syntax from all the files in t/lib/ --- t/lib/Advisor.t | 8 +-- t/lib/BinaryLogParser.t | 2 +- t/lib/ChangeHandler.t | 26 +++++----- t/lib/CompareQueryTimes.t | 6 +-- t/lib/CompareResults.t | 32 ++++++------ t/lib/CompareWarnings.t | 12 ++--- t/lib/CopyRowsInsertSelect.t | 10 ++-- t/lib/DSNParser.t | 8 +-- t/lib/Daemon.t | 8 +-- t/lib/DuplicateKeyFinder.t | 6 +-- t/lib/EventAggregator.t | 50 +++++++++---------- t/lib/EventTimeline.t | 4 +- t/lib/ExecutionThrottler.t | 2 +- t/lib/ExplainAnalyzer.t | 10 ++-- t/lib/FileIterator.t | 2 +- t/lib/GeneralLogParser.t | 2 +- t/lib/HTTPProtocolParser.t | 18 +++---- t/lib/IndexUsage.t | 10 ++-- t/lib/KeySize.t | 10 ++-- t/lib/LogSplitter.t | 22 ++++----- t/lib/MasterSlave.t | 8 +-- t/lib/MemcachedEvent.t | 2 +- t/lib/MemcachedProtocolParser.t | 30 +++++------ t/lib/MockSth.t | 4 +- t/lib/MockSyncStream.t | 12 ++--- t/lib/MySQLConfig.t | 30 +++++------ t/lib/MySQLConfigComparer.t | 56 ++++++++++----------- t/lib/MySQLDump.t | 8 +-- t/lib/MySQLProtocolParser.t | 70 +++++++++++++------------- t/lib/NibbleIterator.t | 22 ++++----- t/lib/OSCCaptureSync.t | 6 +-- t/lib/OptionParser.t | 88 ++++++++++++++++----------------- t/lib/Outfile.t | 6 +-- t/lib/PgLogParser.t | 2 +- t/lib/Pipeline.t | 12 ++--- t/lib/PodParser.t | 2 +- t/lib/Processlist.t | 6 +-- t/lib/Progress.t | 12 ++--- t/lib/ProtocolParser.t | 2 +- t/lib/QueryAdvisorRules.t | 10 ++-- t/lib/QueryParser.t | 4 +- t/lib/QueryReportFormatter.t | 78 ++++++++++++++--------------- t/lib/QueryReview.t | 18 +++---- t/lib/QueryRewriter.t | 4 +- t/lib/Quoter.t | 2 +- t/lib/ReportFormatter.t | 32 ++++++------ t/lib/Retry.t | 2 +- t/lib/RowChecksum.t | 14 +++--- t/lib/RowDiff-custom.t | 22 ++++----- t/lib/RowDiff.t | 88 ++++++++++++++++----------------- t/lib/Runtime.t | 8 +-- t/lib/SQLParser.t | 14 +++--- t/lib/Schema.t | 12 ++--- t/lib/SchemaIterator.t | 20 ++++---- t/lib/SimpleTCPDumpParser.t | 2 +- t/lib/SlowLogParser.t | 4 +- t/lib/SlowLogWriter.t | 4 +- t/lib/SysLogParser.t | 2 +- t/lib/TCPRequestAggregator.t | 4 +- t/lib/TableChecksum.t | 14 +++--- t/lib/TableChunker.t | 12 ++--- t/lib/TableNibbler.t | 6 +-- t/lib/TableParser.t | 8 +-- t/lib/TableSyncChunk.t | 28 +++++------ t/lib/TableSyncGroupBy.t | 14 +++--- t/lib/TableSyncNibble.t | 28 +++++------ t/lib/TableSyncStream.t | 14 +++--- t/lib/TableSyncer.t | 44 ++++++++--------- t/lib/TcpdumpParser.t | 2 +- t/lib/TextResultSetParser.t | 4 +- t/lib/TimeSeriesTrender.t | 2 +- t/lib/Transformers.t | 4 +- t/lib/UpgradeReportFormatter.t | 10 ++-- t/lib/VariableAdvisorRules.t | 6 +-- t/lib/VersionParser.t | 6 +-- 75 files changed, 586 insertions(+), 586 deletions(-) diff --git a/t/lib/Advisor.t b/t/lib/Advisor.t index 8c8084f8..e41f1b19 100644 --- a/t/lib/Advisor.t +++ b/t/lib/Advisor.t @@ -19,9 +19,9 @@ use PodParser; # This module's purpose is to run rules and return a list of the IDs of the # triggered rules. It should be very simple. (But we don't want to put the two # modules together. Their purposes are distinct.) -my $p = new PodParser(); -my $qar = new QueryAdvisorRules(PodParser => $p); -my $adv = new Advisor(match_type=>"pos"); +my $p = PodParser->new(); +my $qar = QueryAdvisorRules->new(PodParser => $p); +my $adv = Advisor->new(match_type=>"pos"); # This should make $qa internally call get_rules() on $qar and save the rules # into its own list. If the user plugs in his own module, we'd call @@ -76,7 +76,7 @@ is_deeply( # ############################################################################# # Ignore rules. # ############################################################################# -$adv = new Advisor( +$adv = Advisor->new( match_type => "pos", ignore_rules => { 'LIT.002' => 1 }, ); diff --git a/t/lib/BinaryLogParser.t b/t/lib/BinaryLogParser.t index a4d237ed..fef3abca 100644 --- a/t/lib/BinaryLogParser.t +++ b/t/lib/BinaryLogParser.t @@ -14,7 +14,7 @@ use Test::More tests => 7; use PerconaTest; use BinaryLogParser; -my $p = new BinaryLogParser(); +my $p = BinaryLogParser->new(); my $oktorun = 1; my $sample = "t/lib/samples/binlogs/"; diff --git a/t/lib/ChangeHandler.t b/t/lib/ChangeHandler.t index 87d7a53b..ca7b66de 100644 --- a/t/lib/ChangeHandler.t +++ b/t/lib/ChangeHandler.t @@ -17,20 +17,20 @@ use DSNParser; use Sandbox; use PerconaTest; -my $dp = new DSNParser(opts => $dsn_opts); -my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp); +my $dp = DSNParser->new(opts => $dsn_opts); +my $sb = Sandbox->new(basedir => '/tmp', DSNParser => $dp); my $dbh = $sb->get_dbh_for('master'); throws_ok( - sub { new ChangeHandler() }, + sub { ChangeHandler->new() }, qr/I need a Quoter/, 'Needs a Quoter', ); my @rows; my @dbhs; -my $q = new Quoter(); -my $ch = new ChangeHandler( +my $q = Quoter->new(); +my $ch = ChangeHandler->new( Quoter => $q, right_db => 'test', # dst right_tbl => 'foo', @@ -150,7 +150,7 @@ is_deeply( # ############################################################################# # Test switching direction (swap src/dst). # ############################################################################# -$ch = new ChangeHandler( +$ch = ChangeHandler->new( Quoter => $q, left_db => 'test', left_tbl => 'left_foo', @@ -204,7 +204,7 @@ SKIP: { $dbh->do('CREATE DATABASE IF NOT EXISTS test'); - $ch = new ChangeHandler( + $ch = ChangeHandler->new( Quoter => $q, right_db => 'test', # dst right_tbl => 'foo', @@ -245,7 +245,7 @@ my $row = { my $tbl_struct = { col_posn => { id=>0, foo=>1, bar=>2 }, }; -$ch = new ChangeHandler( +$ch = ChangeHandler->new( Quoter => $q, right_db => 'test', # dst right_tbl => 'issue_371', @@ -342,7 +342,7 @@ $tbl_struct = { cols => [qw(a x b)], type_for => {a=>'int', x=>'blob', b=>'varchar'}, }; -$ch = new ChangeHandler( +$ch = ChangeHandler->new( Quoter => $q, left_db => 'test', left_tbl => 'lt', @@ -360,7 +360,7 @@ is( "Wraps BLOB column in CONCAT('0x', HEX(col)) AS col" ); -$ch = new ChangeHandler( +$ch = ChangeHandler->new( Quoter => $q, left_db => 'test', left_tbl => 'lt', @@ -387,7 +387,7 @@ $tbl_struct = { cols => [qw(t)], type_for => {t=>'text'}, }; -$ch = new ChangeHandler( +$ch = ChangeHandler->new( Quoter => $q, left_db => 'test', left_tbl => 't', @@ -417,7 +417,7 @@ SKIP: { col_posn => {id=>0, b=>1}, type_for => {id=>'int', b=>'blob'}, }; - $ch = new ChangeHandler( + $ch = ChangeHandler->new( Quoter => $q, left_db => 'issue_641', left_tbl => 'lt', @@ -447,7 +447,7 @@ SKIP: { # Issue 387: More useful comments in mk-table-sync statements # ############################################################################# @rows = (); -$ch = new ChangeHandler( +$ch = ChangeHandler->new( Quoter => $q, right_db => 'test', # dst right_tbl => 'foo', diff --git a/t/lib/CompareQueryTimes.t b/t/lib/CompareQueryTimes.t index 972b182f..b86cdef7 100644 --- a/t/lib/CompareQueryTimes.t +++ b/t/lib/CompareQueryTimes.t @@ -18,8 +18,8 @@ use Sandbox; use CompareQueryTimes; use PerconaTest; -my $dp = new DSNParser(opts=>$dsn_opts); -my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp); +my $dp = DSNParser->new(opts=>$dsn_opts); +my $sb = Sandbox->new(basedir => '/tmp', DSNParser => $dp); my $dbh = $sb->get_dbh_for('master'); if ( !$dbh ) { @@ -50,7 +50,7 @@ sub get_id { # diag(`/tmp/12345/use < samples/compare-warnings.sql`); -$ct = new CompareQueryTimes( +$ct = CompareQueryTimes->new( get_id => \&get_id, ); diff --git a/t/lib/CompareResults.t b/t/lib/CompareResults.t index 8f6df71d..174152b4 100644 --- a/t/lib/CompareResults.t +++ b/t/lib/CompareResults.t @@ -32,8 +32,8 @@ use Sandbox; use CompareResults; use PerconaTest; -my $dp = new DSNParser(opts=>$dsn_opts); -my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp); +my $dp = DSNParser->new(opts=>$dsn_opts); +my $sb = Sandbox->new(basedir => '/tmp', DSNParser => $dp); my $dbh1 = $sb->get_dbh_for('master'); my $dbh2 = $sb->get_dbh_for('slave1'); @@ -51,15 +51,15 @@ $sb->create_dbs($dbh1, ['test']); Transformers->import(qw(make_checksum)); -my $vp = new VersionParser(); -my $q = new Quoter(); -my $qp = new QueryParser(); -my $du = new MySQLDump(cache => 0); -my $tp = new TableParser(Quoter => $q); -my $tc = new TableChecksum(Quoter => $q, VersionParser => $vp); -my $of = new Outfile(); -my $rr = new Retry(); -my $ts = new TableSyncer( +my $vp = VersionParser->new(); +my $q = Quoter->new(); +my $qp = QueryParser->new(); +my $du = MySQLDump->new(cache => 0); +my $tp = TableParser->new(Quoter => $q); +my $tc = TableChecksum->new(Quoter => $q, VersionParser => $vp); +my $of = Outfile->new(); +my $rr = Retry->new(); +my $ts = TableSyncer->new( Quoter => $q, VersionParser => $vp, TableChecksum => $tc, @@ -76,7 +76,7 @@ my %modules = ( Outfile => $of, ); -my $plugin = new TableSyncGroupBy(Quoter => $q); +my $plugin = TableSyncGroupBy->new(Quoter => $q); my $cr; my $i; @@ -112,7 +112,7 @@ sub get_id { diag(`/tmp/12345/use < $trunk/t/lib/samples/compare-results.sql`); -$cr = new CompareResults( +$cr = CompareResults->new( method => 'checksum', 'base-dir' => '/dev/null', # not used with checksum method plugins => [$plugin], @@ -333,7 +333,7 @@ my $tmpdir = '/tmp/mk-upgrade-res'; diag(`/tmp/12345/use < $trunk/t/lib/samples/compare-results.sql`); diag(`rm -rf $tmpdir; mkdir $tmpdir`); -$cr = new CompareResults( +$cr = CompareResults->new( method => 'rows', 'base-dir' => $tmpdir, plugins => [$plugin], @@ -728,7 +728,7 @@ is( }, ); -$cr = new CompareResults( +$cr = CompareResults->new( method => 'checksum', 'base-dir' => '/dev/null', # not used with checksum method plugins => [$plugin], @@ -758,7 +758,7 @@ is_deeply( 'No differences after bad compare()' ); -$cr = new CompareResults( +$cr = CompareResults->new( method => 'rows', 'base-dir' => $tmpdir, plugins => [$plugin], diff --git a/t/lib/CompareWarnings.t b/t/lib/CompareWarnings.t index 07c49edd..ce58b48c 100644 --- a/t/lib/CompareWarnings.t +++ b/t/lib/CompareWarnings.t @@ -20,8 +20,8 @@ use Sandbox; use CompareWarnings; use PerconaTest; -my $dp = new DSNParser(opts=>$dsn_opts); -my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp); +my $dp = DSNParser->new(opts=>$dsn_opts); +my $sb = Sandbox->new(basedir => '/tmp', DSNParser => $dp); my $dbh = $sb->get_dbh_for('master', {no_lc=>1}); if ( !$dbh ) { @@ -35,8 +35,8 @@ $sb->create_dbs($dbh, ['test']); Transformers->import(qw(make_checksum)); -my $q = new Quoter(); -my $qp = new QueryParser(); +my $q = Quoter->new(); +my $qp = QueryParser->new(); my %modules = ( Quoter => $q, QueryParser => $qp, @@ -88,7 +88,7 @@ diag(`/tmp/12345/use < $trunk/t/lib/samples/compare-warnings.sql`); }, ); -$cw = new CompareWarnings( +$cw = CompareWarnings->new( 'clear-warnings' => 1, 'clear-warnings-table' => 'mysql.bad', get_id => \&get_id, @@ -110,7 +110,7 @@ like( "Can't clear warnings with bad table" ); -$cw = new CompareWarnings( +$cw = CompareWarnings->new( 'clear-warnings' => 1, get_id => \&get_id, %modules, diff --git a/t/lib/CopyRowsInsertSelect.t b/t/lib/CopyRowsInsertSelect.t index b5a4e0a1..b3af42a7 100644 --- a/t/lib/CopyRowsInsertSelect.t +++ b/t/lib/CopyRowsInsertSelect.t @@ -26,8 +26,8 @@ $Data::Dumper::Indent = 1; $Data::Dumper::Sortkeys = 1; $Data::Dumper::Quotekeys = 0; -my $dp = new DSNParser(opts=>$dsn_opts); -my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp); +my $dp = DSNParser->new(opts=>$dsn_opts); +my $sb = Sandbox->new(basedir => '/tmp', DSNParser => $dp); my $dbh = $sb->get_dbh_for('master'); if ( !$dbh ) { @@ -41,8 +41,8 @@ else { plan tests => 8; } -my $rr = new Retry(); -my $osc = new CopyRowsInsertSelect(Retry => $rr); +my $rr = Retry->new(); +my $osc = CopyRowsInsertSelect->new(Retry => $rr); my $msg = sub { print "$_[0]\n"; }; my $output = ""; @@ -109,7 +109,7 @@ my $chunks = [ "`city_id` >= '491' AND `city_id` < '561'", "`city_id` >= '561'", ]; -my $pr = new Progress( +my $pr = Progress->new( jobsize => scalar @$chunks, spec => [qw(percentage 10)], name => "Copy rows" diff --git a/t/lib/DSNParser.t b/t/lib/DSNParser.t index 56259efd..5b0e7561 100644 --- a/t/lib/DSNParser.t +++ b/t/lib/DSNParser.t @@ -66,7 +66,7 @@ my $opts = [ }, ]; -my $dp = new DSNParser(opts => $opts); +my $dp = DSNParser->new(opts => $opts); is_deeply( $dp->parse('u=a,p=b'), @@ -301,7 +301,7 @@ throws_ok ( # ############################################################################# # Test parse_options(). # ############################################################################# -my $o = new OptionParser( +my $o = OptionParser->new( description => 'parses command line options.', dp => $dp, ); @@ -336,7 +336,7 @@ is_deeply( # ############################################################################# push @$opts, { key => 't', desc => 'table' }; -$dp = new DSNParser(opts => $opts); +$dp = DSNParser->new(opts => $opts); my $dsn_1 = { D => undef, @@ -420,7 +420,7 @@ SKIP: { # it now else we'll get an error. $dbh->disconnect(); - $dp = new DSNParser(opts => $opts); + $dp = DSNParser->new(opts => $opts); $dp->prop('set-vars', 'wait_timeout=1000'); $d = $dp->parse('h=127.0.0.1,P=12345,A=utf8,u=msandbox,p=msandbox'); my $dbh2 = $dp->get_dbh($dp->get_cxn_params($d), {mysql_use_result=>1}); diff --git a/t/lib/Daemon.t b/t/lib/Daemon.t index a2798681..920ee10d 100644 --- a/t/lib/Daemon.t +++ b/t/lib/Daemon.t @@ -15,8 +15,8 @@ use Daemon; use OptionParser; use PerconaTest; -my $o = new OptionParser(file => "$trunk/t/lib/samples/daemonizes.pl"); -my $d = new Daemon(o=>$o); +my $o = OptionParser->new(file => "$trunk/t/lib/samples/daemonizes.pl"); +my $d = Daemon->new(o=>$o); my $pid_file = '/tmp/daemonizes.pl.pid'; my $log_file = '/tmp/daemonizes.output'; @@ -201,7 +201,7 @@ rm_tmp_files(); @ARGV = qw(--pid /tmp/d2.pid); $o->get_specs("$trunk/t/lib/samples/daemonizes.pl"); $o->get_opts(); - my $d2 = new Daemon(o=>$o); + my $d2 = Daemon->new(o=>$o); $d2->make_PID_file(); ok( -f '/tmp/d2.pid', @@ -222,7 +222,7 @@ ok( @ARGV = qw(--pid /tmp/d2.pid); $o->get_opts(); eval { - my $d2 = new Daemon(o=>$o); # should die here actually + my $d2 = Daemon->new(o=>$o); # should die here actually $d2->make_PID_file(); }; like( diff --git a/t/lib/DuplicateKeyFinder.t b/t/lib/DuplicateKeyFinder.t index 4fee786f..5bfde3bb 100644 --- a/t/lib/DuplicateKeyFinder.t +++ b/t/lib/DuplicateKeyFinder.t @@ -16,9 +16,9 @@ use Quoter; use TableParser; use PerconaTest; -my $dk = new DuplicateKeyFinder(); -my $q = new Quoter(); -my $tp = new TableParser(Quoter => $q); +my $dk = DuplicateKeyFinder->new(); +my $q = Quoter->new(); +my $tp = TableParser->new(Quoter => $q); my $sample = "t/lib/samples/dupekeys/"; my $dupes; diff --git a/t/lib/EventAggregator.t b/t/lib/EventAggregator.t index 5ac7c56c..d6762246 100644 --- a/t/lib/EventAggregator.t +++ b/t/lib/EventAggregator.t @@ -19,13 +19,13 @@ use BinaryLogParser; use Transformers; use PerconaTest; -my $qr = new QueryRewriter(); -my $qp = new QueryParser(); -my $p = new SlowLogParser(); -my $bp = new BinaryLogParser(); +my $qr = QueryRewriter->new(); +my $qp = QueryParser->new(); +my $p = SlowLogParser->new(); +my $bp = BinaryLogParser->new(); my ( $result, $events, $ea, $expected ); -$ea = new EventAggregator( +$ea = EventAggregator->new( groupby => 'fingerprint', worst => 'Query_time', attributes => { @@ -203,7 +203,7 @@ is_deeply( ); # Test with a nonexistent 'worst' attribute. -$ea = new EventAggregator( +$ea = EventAggregator->new( groupby => 'fingerprint', worst => 'nonexistent', attributes => { @@ -294,7 +294,7 @@ is_deeply( $ea->results->{globals}, # ############################################################################# # Test grouping on user # ############################################################################# -$ea = new EventAggregator( +$ea = EventAggregator->new( groupby => 'user', worst => 'Query_time', attributes => { @@ -729,7 +729,7 @@ is( $EVAL_ERROR, '', "Handles an undef attrib OK" ); # ############################################################################# # Issue 184: db OR Schema # ############################################################################# -$ea = new EventAggregator( +$ea = EventAggregator->new( groupby => 'arg', attributes => { db => [qw(db Schema)], @@ -758,7 +758,7 @@ is( $ea->results->{classes}->{foo2}->{db}->{min}, # ############################################################################# # Make sure large values are kept reasonable. # ############################################################################# -$ea = new EventAggregator( +$ea = EventAggregator->new( attributes => { Rows_read => [qw(Rows_read)], }, attrib_limit => 1000, worst => 'foo', @@ -864,7 +864,7 @@ is_deeply( $ea->results, $result, 'Limited attribute values', ); } } -$ea = new EventAggregator( +$ea = EventAggregator->new( groupby => 'fingerprint', worst => 'foo', attributes => { @@ -962,7 +962,7 @@ $events = [ }, ]; -$ea = new EventAggregator( +$ea = EventAggregator->new( groupby => 'tables', worst => 'foo', attributes => { @@ -1035,7 +1035,7 @@ is_deeply( ); # Event attribute with space in name. -$ea = new EventAggregator( +$ea = EventAggregator->new( groupby => 'fingerprint', worst => 'Query time', attributes => { @@ -1054,7 +1054,7 @@ is( ); # Make sure types can be hinted directly. -$ea = new EventAggregator( +$ea = EventAggregator->new( groupby => 'fingerprint', worst => 'Query time', attributes => { @@ -1080,7 +1080,7 @@ is( # ############################################################################# # Issue 323: mk-query-digest does not properly handle logs with an empty Schema: # ############################################################################# -$ea = new EventAggregator( +$ea = EventAggregator->new( groupby => 'fingerprint', worst => 'Query time', attributes => { @@ -1257,7 +1257,7 @@ is_deeply( # ############################################################################# # Issue 396: Make mk-query-digest detect properties of events to output # ############################################################################# -$ea = new EventAggregator( +$ea = EventAggregator->new( groupby => 'arg', worst => 'Query_time', ); @@ -1405,7 +1405,7 @@ my $only_query_time_results = { } }; -$ea = new EventAggregator( +$ea = EventAggregator->new( groupby => 'arg', worst => 'Query_time', attributes => { @@ -1421,7 +1421,7 @@ is_deeply( 'Do not auto-detect attributes if given explicit attributes', ); -$ea = new EventAggregator( +$ea = EventAggregator->new( groupby => 'arg', worst => 'Query_time', ignore_attributes => [ qw(new_prop other_prop Schema) ], @@ -1439,7 +1439,7 @@ is_deeply( # Issue 458: mk-query-digest Use of uninitialized value in division (/) at # line 3805. # ############################################################################# -$ea = new EventAggregator( +$ea = EventAggregator->new( groupby => 'arg', worst => 'Query_time', ); @@ -1515,7 +1515,7 @@ ok( # Issue 514: mk-query-digest does not create handler sub for new auto-detected # attributes # ############################################################################# -$ea = new EventAggregator( +$ea = EventAggregator->new( groupby => 'arg', worst => 'Query_time', ); @@ -1530,7 +1530,7 @@ ok( 'New event class has new attrib; default unroll_limit(issue 514)' ); -$ea = new EventAggregator( +$ea = EventAggregator->new( groupby => 'arg', worst => 'Query_time', unroll_limit => 50, @@ -1562,7 +1562,7 @@ $events = [ }, ]; -$ea = new EventAggregator( +$ea = EventAggregator->new( groupby => 'arg', worst => 'Query_time', ); @@ -1595,7 +1595,7 @@ is_deeply( # Issue 607: mk-query-digest throws Possible unintended interpolation of # @session in string # ############################################################################# -$ea = new EventAggregator( +$ea = EventAggregator->new( groupby => 'arg', worst => 'Query_time', unroll_limit => 1, @@ -1612,7 +1612,7 @@ is( # ############################################################################# # merge() # ############################################################################# -my $ea1 = new EventAggregator( +my $ea1 = EventAggregator->new( groupby => 'fingerprint', worst => 'Query_time', attributes => { @@ -1625,7 +1625,7 @@ my $ea1 = new EventAggregator( ea2_only => [qw(ea2_only)], }, ); -my $ea2 = new EventAggregator( +my $ea2 = EventAggregator->new( groupby => 'fingerprint', worst => 'Query_time', attributes => { @@ -1875,7 +1875,7 @@ is( # Any attrib called *_crc should be automatically treated as a string, # so no need to specify type_for. -$ea = new EventAggregator( +$ea = EventAggregator->new( groupby => 'arg', worst => 'Query_time', ); diff --git a/t/lib/EventTimeline.t b/t/lib/EventTimeline.t index ae781d22..a63c71cc 100644 --- a/t/lib/EventTimeline.t +++ b/t/lib/EventTimeline.t @@ -16,10 +16,10 @@ use QueryRewriter; use EventTimeline; use PerconaTest; -my $qr = new QueryRewriter(); +my $qr = QueryRewriter->new(); my ( $result, $events, $et, $expected ); -$et = new EventTimeline( +$et = EventTimeline->new( groupby => [qw(fingerprint)], attributes => [qw(Query_time ts)], ); diff --git a/t/lib/ExecutionThrottler.t b/t/lib/ExecutionThrottler.t index 37d11244..682cd11a 100644 --- a/t/lib/ExecutionThrottler.t +++ b/t/lib/ExecutionThrottler.t @@ -28,7 +28,7 @@ my %args = ( ); my $get_rate = sub { return $rate; }; -my $et = new ExecutionThrottler( +my $et = ExecutionThrottler->new( rate_max => 90, get_rate => $get_rate, check_int => 0.4, diff --git a/t/lib/ExplainAnalyzer.t b/t/lib/ExplainAnalyzer.t index c2c37d58..4c2fb122 100644 --- a/t/lib/ExplainAnalyzer.t +++ b/t/lib/ExplainAnalyzer.t @@ -24,8 +24,8 @@ use DSNParser; use Sandbox; use PerconaTest; -my $dp = new DSNParser(opts=>$dsn_opts); -my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp); +my $dp = DSNParser->new(opts=>$dsn_opts); +my $sb = Sandbox->new(basedir => '/tmp', DSNParser => $dp); my $dbh = $sb->get_dbh_for('master', {no_lc=>1}); if ( !$dbh ) { @@ -37,9 +37,9 @@ else { $dbh->do('use sakila'); -my $qr = new QueryRewriter(); -my $qp = new QueryParser(); -my $exa = new ExplainAnalyzer(QueryRewriter => $qr, QueryParser => $qp); +my $qr = QueryRewriter->new(); +my $qp = QueryParser->new(); +my $exa = ExplainAnalyzer->new(QueryRewriter => $qr, QueryParser => $qp); # ############################################################################# # Tests for getting an EXPLAIN from a database. diff --git a/t/lib/FileIterator.t b/t/lib/FileIterator.t index 2c1e5e53..0a92ff65 100644 --- a/t/lib/FileIterator.t +++ b/t/lib/FileIterator.t @@ -24,7 +24,7 @@ $Data::Dumper::Quotekeys = 0; my $sample = "$trunk/t/lib/samples/"; my ($next_fh, $fh, $name, $size); -my $fi = new FileIterator(); +my $fi = FileIterator->new(); isa_ok($fi, 'FileIterator'); # ############################################################################# diff --git a/t/lib/GeneralLogParser.t b/t/lib/GeneralLogParser.t index 619e3883..6fc45528 100644 --- a/t/lib/GeneralLogParser.t +++ b/t/lib/GeneralLogParser.t @@ -14,7 +14,7 @@ use Test::More tests => 7; use GeneralLogParser; use PerconaTest; -my $p = new GeneralLogParser(); +my $p = GeneralLogParser->new(); my $oktorun = 1; my $sample = "t/lib/samples/genlogs/"; diff --git a/t/lib/HTTPProtocolParser.t b/t/lib/HTTPProtocolParser.t index 8c240159..d321a7a6 100644 --- a/t/lib/HTTPProtocolParser.t +++ b/t/lib/HTTPProtocolParser.t @@ -16,11 +16,11 @@ use ProtocolParser; use HTTPProtocolParser; use PerconaTest; -my $tcpdump = new TcpdumpParser(); +my $tcpdump = TcpdumpParser->new(); my $protocol; # Create a new HTTPProtocolParser for each test. # GET a very simple page. -$protocol = new HTTPProtocolParser(); +$protocol = HTTPProtocolParser->new(); test_protocol_parser( parser => $tcpdump, protocol => $protocol, @@ -40,7 +40,7 @@ test_protocol_parser( ); # Get http://www.percona.com/about-us.html -$protocol = new HTTPProtocolParser(); +$protocol = HTTPProtocolParser->new(); test_protocol_parser( parser => $tcpdump, protocol => $protocol, @@ -160,7 +160,7 @@ test_protocol_parser( ); # A reponse received in out of order packet. -$protocol = new HTTPProtocolParser(); +$protocol = HTTPProtocolParser->new(); test_protocol_parser( parser => $tcpdump, protocol => $protocol, @@ -180,7 +180,7 @@ test_protocol_parser( ); # A client request broken over 2 packets. -$protocol = new HTTPProtocolParser(); +$protocol = HTTPProtocolParser->new(); test_protocol_parser( parser => $tcpdump, protocol => $protocol, @@ -201,7 +201,7 @@ test_protocol_parser( # Out of order header that might look like the text header # but is really data; text header arrives last. -$protocol = new HTTPProtocolParser(); +$protocol = HTTPProtocolParser->new(); test_protocol_parser( parser => $tcpdump, protocol => $protocol, @@ -221,7 +221,7 @@ test_protocol_parser( ); # One 2.6M image that took almost a minute to load (very slow wifi). -$protocol = new HTTPProtocolParser(); +$protocol = HTTPProtocolParser->new(); test_protocol_parser( parser => $tcpdump, protocol => $protocol, @@ -241,7 +241,7 @@ test_protocol_parser( ); # A simple POST. -$protocol = new HTTPProtocolParser(); +$protocol = HTTPProtocolParser->new(); test_protocol_parser( parser => $tcpdump, protocol => $protocol, @@ -261,7 +261,7 @@ test_protocol_parser( ); # .http instead of .80 -$protocol = new HTTPProtocolParser(); +$protocol = HTTPProtocolParser->new(); test_protocol_parser( parser => $tcpdump, protocol => $protocol, diff --git a/t/lib/IndexUsage.t b/t/lib/IndexUsage.t index 52ff97ff..b486b599 100644 --- a/t/lib/IndexUsage.t +++ b/t/lib/IndexUsage.t @@ -28,12 +28,12 @@ $Data::Dumper::Quotekeys = 0; Transformers->import(qw(make_checksum)); -my $qr = new QueryRewriter(); -my $dp = new DSNParser(opts=>$dsn_opts); -my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp); +my $qr = QueryRewriter->new(); +my $dp = DSNParser->new(opts=>$dsn_opts); +my $sb = Sandbox->new(basedir => '/tmp', DSNParser => $dp); my $dbh = $sb->get_dbh_for('master'); -my $iu = new IndexUsage(); +my $iu = IndexUsage->new(); # These are mock TableParser::get_keys() structs. my $actor_idx = { @@ -118,7 +118,7 @@ SKIP: { # pre-populate the tables with mysql.*, sakila.*, etc. `$trunk/bin/pt-index-usage -F /tmp/12345/my.sandbox.cnf --create-save-results-database --save-results-database D=mk_iu --empty-save-results-tables --no-report --quiet --databases foo $trunk/t/lib/samples/empty >/dev/null`; - $iu = new IndexUsage(); + $iu = IndexUsage->new(); # ##################################################################### # First, add all the index, tbl and query data. diff --git a/t/lib/KeySize.t b/t/lib/KeySize.t index c8e9521e..06554b31 100644 --- a/t/lib/KeySize.t +++ b/t/lib/KeySize.t @@ -18,8 +18,8 @@ use DSNParser; use Sandbox; use PerconaTest; -my $dp = new DSNParser(opts=>$dsn_opts); -my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp); +my $dp = DSNParser->new(opts=>$dsn_opts); +my $sb = Sandbox->new(basedir => '/tmp', DSNParser => $dp); my $dbh = $sb->get_dbh_for('master'); if ( !$dbh ) { @@ -29,9 +29,9 @@ else { plan tests => 18; } -my $q = new Quoter(); -my $tp = new TableParser(Quoter => $q); -my $ks = new KeySize(Quoter=>$q); +my $q = Quoter->new(); +my $tp = TableParser->new(Quoter => $q); +my $ks = KeySize->new(Quoter=>$q); my $tbl; my $struct; diff --git a/t/lib/LogSplitter.t b/t/lib/LogSplitter.t index 98937d90..e913fefc 100644 --- a/t/lib/LogSplitter.t +++ b/t/lib/LogSplitter.t @@ -19,8 +19,8 @@ my $output; my $tmpdir = '/tmp/LogSplitter'; diag(`rm -rf $tmpdir ; mkdir $tmpdir`); -my $lp = new SlowLogParser(); -my $ls = new LogSplitter( +my $lp = SlowLogParser->new(); +my $ls = LogSplitter->new( attribute => 'foo', base_dir => $tmpdir, parser => $lp, @@ -54,7 +54,7 @@ is( # Test a simple split of 6 events, 3 sessions into 3 session files. # ############################################################################# diag(`rm -rf $tmpdir/*`); -$ls = new LogSplitter( +$ls = LogSplitter->new( attribute => 'Thread_id', base_dir => $tmpdir, parser => $lp, @@ -92,7 +92,7 @@ is( # Test splitting more sessions than we can have open filehandles at once. # ############################################################################# diag(`rm -rf $tmpdir/*`); -$ls = new LogSplitter( +$ls = LogSplitter->new( attribute => 'Thread_id', base_dir => $tmpdir, parser => $lp, @@ -128,7 +128,7 @@ like( # Test max_sessions. # ############################################################################# diag(`rm -rf $tmpdir/*`); -$ls = new LogSplitter( +$ls = LogSplitter->new( attribute => 'Thread_id', base_dir => $tmpdir, parser => $lp, @@ -181,7 +181,7 @@ is_deeply( # Test session file merging. # ############################################################################# diag(`rm -rf $tmpdir/*`); -$ls = new LogSplitter( +$ls = LogSplitter->new( attribute => 'Thread_id', base_dir => $tmpdir, parser => $lp, @@ -209,7 +209,7 @@ ok( # LogSplitter should pre-process queries before writing them so that they # do not contain blank lines. diag(`rm -rf $tmpdir/*`); -$ls = new LogSplitter( +$ls = LogSplitter->new( attribute => 'Thread_id', base_dir => $tmpdir, parser => $lp, @@ -226,7 +226,7 @@ is( # Make sure it works for --maxsessionfiles #diag(`rm -rf $tmpdir/*`); -#$ls = new LogSplitter( +#$ls = LogSplitter->new( # attribute => 'Thread_id', # saveto_dir => "$tmpdir/", # lp => $lp, @@ -247,7 +247,7 @@ is( my $callback = sub { return; }; -$ls = new LogSplitter( +$ls = LogSplitter->new( attribute => 'Thread_id', base_dir => $tmpdir, parser => $lp, @@ -266,7 +266,7 @@ is( # Issue 798: Make mk-log-player --split work without an attribute # ############################################################################# diag(`rm -rf $tmpdir/*`); -$ls = new LogSplitter( +$ls = LogSplitter->new( attribute => 'Thread_id', split_random => 1, base_dir => $tmpdir, @@ -294,7 +294,7 @@ is( # Issue 1179: mk-log-player --filter example does not work # ############################################################################# diag(`rm -rf $tmpdir/*`); -$ls = new LogSplitter( +$ls = LogSplitter->new( attribute => 'cmd', base_dir => $tmpdir, parser => $lp, diff --git a/t/lib/MasterSlave.t b/t/lib/MasterSlave.t index a29e845b..19b7c2b5 100644 --- a/t/lib/MasterSlave.t +++ b/t/lib/MasterSlave.t @@ -17,10 +17,10 @@ use VersionParser; use Sandbox; use PerconaTest; -my $vp = new VersionParser(); -my $ms = new MasterSlave(VersionParser => $vp); -my $dp = new DSNParser(opts=>$dsn_opts); -my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp); +my $vp = VersionParser->new(); +my $ms = MasterSlave->new(VersionParser => $vp); +my $dp = DSNParser->new(opts=>$dsn_opts); +my $sb = Sandbox->new(basedir => '/tmp', DSNParser => $dp); # ############################################################################# # First we need to setup a special replication sandbox environment apart from diff --git a/t/lib/MemcachedEvent.t b/t/lib/MemcachedEvent.t index e122d097..64ade67d 100644 --- a/t/lib/MemcachedEvent.t +++ b/t/lib/MemcachedEvent.t @@ -14,7 +14,7 @@ use Test::More tests => 15; use MemcachedEvent; use PerconaTest; -my $memce = new MemcachedEvent(); +my $memce = MemcachedEvent->new(); isa_ok($memce, 'MemcachedEvent'); sub make_events { diff --git a/t/lib/MemcachedProtocolParser.t b/t/lib/MemcachedProtocolParser.t index e220d59e..dcfa39b2 100644 --- a/t/lib/MemcachedProtocolParser.t +++ b/t/lib/MemcachedProtocolParser.t @@ -15,11 +15,11 @@ use MemcachedProtocolParser; use TcpdumpParser; use PerconaTest; -my $tcpdump = new TcpdumpParser(); +my $tcpdump = TcpdumpParser->new(); my $protocol; # Create a new MemcachedProtocolParser for each test. # A session with a simple set(). -$protocol = new MemcachedProtocolParser(); +$protocol = MemcachedProtocolParser->new(); test_protocol_parser( parser => $tcpdump, protocol => $protocol, @@ -41,7 +41,7 @@ test_protocol_parser( ); # A session with a simple get(). -$protocol = new MemcachedProtocolParser(); +$protocol = MemcachedProtocolParser->new(); test_protocol_parser( parser => $tcpdump, protocol => $protocol, @@ -63,7 +63,7 @@ test_protocol_parser( ); # A session with a simple incr() and decr(). -$protocol = new MemcachedProtocolParser(); +$protocol = MemcachedProtocolParser->new(); test_protocol_parser( parser => $tcpdump, protocol => $protocol, @@ -97,7 +97,7 @@ test_protocol_parser( ); # A session with a simple incr() and decr(), but the value doesn't exist. -$protocol = new MemcachedProtocolParser(); +$protocol = MemcachedProtocolParser->new(); test_protocol_parser( parser => $tcpdump, protocol => $protocol, @@ -132,7 +132,7 @@ test_protocol_parser( ); # A session with a huge set() that will not fit into a single TCP packet. -$protocol = new MemcachedProtocolParser(); +$protocol = MemcachedProtocolParser->new(); test_protocol_parser( parser => $tcpdump, protocol => $protocol, @@ -154,7 +154,7 @@ test_protocol_parser( ); # A session with a huge get() that will not fit into a single TCP packet. -$protocol = new MemcachedProtocolParser(); +$protocol = MemcachedProtocolParser->new(); test_protocol_parser( parser => $tcpdump, protocol => $protocol, @@ -177,7 +177,7 @@ test_protocol_parser( ); # A session with a get() that doesn't exist. -$protocol = new MemcachedProtocolParser(); +$protocol = MemcachedProtocolParser->new(); test_protocol_parser( parser => $tcpdump, protocol => $protocol, @@ -202,7 +202,7 @@ test_protocol_parser( # A session with a huge get() that will not fit into a single TCP packet, but # the connection seems to be broken in the middle of the receive and then the # new client picks up and asks for something different. -$protocol = new MemcachedProtocolParser(); +$protocol = MemcachedProtocolParser->new(); test_protocol_parser( parser => $tcpdump, protocol => $protocol, @@ -237,7 +237,7 @@ test_protocol_parser( ); # A session with a delete() that doesn't exist. TODO: delete takes a queue_time. -$protocol = new MemcachedProtocolParser(); +$protocol = MemcachedProtocolParser->new(); test_protocol_parser( parser => $tcpdump, protocol => $protocol, @@ -260,7 +260,7 @@ test_protocol_parser( ); # A session with a delete() that does exist. -$protocol = new MemcachedProtocolParser(); +$protocol = MemcachedProtocolParser->new(); test_protocol_parser( parser => $tcpdump, protocol => $protocol, @@ -286,7 +286,7 @@ test_protocol_parser( # Issue 537: MySQLProtocolParser and MemcachedProtocolParser do not handle # multiple servers. # ############################################################################# -$protocol = new MemcachedProtocolParser(); +$protocol = MemcachedProtocolParser->new(); test_protocol_parser( parser => $tcpdump, protocol => $protocol, @@ -324,7 +324,7 @@ test_protocol_parser( # ############################################################################# # Multiple delete in one packet. -$protocol = new MemcachedProtocolParser(); +$protocol = MemcachedProtocolParser->new(); test_protocol_parser( parser => $tcpdump, protocol => $protocol, @@ -346,7 +346,7 @@ test_protocol_parser( ); # Multiple mixed commands: get delete delete -$protocol = new MemcachedProtocolParser(); +$protocol = MemcachedProtocolParser->new(); test_protocol_parser( parser => $tcpdump, protocol => $protocol, @@ -375,7 +375,7 @@ test_protocol_parser( # ############################################################################# # A replace command. -$protocol = new MemcachedProtocolParser(); +$protocol = MemcachedProtocolParser->new(); test_protocol_parser( parser => $tcpdump, protocol => $protocol, diff --git a/t/lib/MockSth.t b/t/lib/MockSth.t index 53b757d0..018e4d6e 100644 --- a/t/lib/MockSth.t +++ b/t/lib/MockSth.t @@ -16,12 +16,12 @@ use PerconaTest; my $m; -$m = new MockSth(); +$m = MockSth->new(); is($m->{Active}, 0, 'Empty is not active'); is($m->fetchrow_hashref(), undef, 'Cannot fetch from empty'); -$m = new MockSth( +$m = MockSth->new( { a => 1 }, ); ok($m->{Active}, 'Has rows, is active'); diff --git a/t/lib/MockSyncStream.t b/t/lib/MockSyncStream.t index f0946988..1e01878a 100644 --- a/t/lib/MockSyncStream.t +++ b/t/lib/MockSyncStream.t @@ -17,7 +17,7 @@ use MockSth; use RowDiff; use PerconaTest; -my $rd = new RowDiff( dbh => 1 ); +my $rd = RowDiff->new( dbh => 1 ); my @rows; sub same_row { @@ -30,7 +30,7 @@ sub not_in_right { push @rows, 'not in right'; } -my $mss = new MockSyncStream( +my $mss = MockSyncStream->new( query => 'SELECT a, b, c FROM foo WHERE id = 1', cols => [qw(a b c)], same_row => \&same_row, @@ -48,13 +48,13 @@ is( $mss->done(), undef, 'Not done yet' ); @rows = (); $rd->compare_sets( - left_sth => new MockSth( + left_sth => MockSth->new( { a => 1, b => 2, c => 3 }, { a => 2, b => 2, c => 3 }, { a => 3, b => 2, c => 3 }, # { a => 4, b => 2, c => 3 }, ), - right_sth => new MockSth( + right_sth => MockSth->new( # { a => 1, b => 2, c => 3 }, { a => 2, b => 2, c => 3 }, { a => 3, b => 2, c => 3 }, @@ -79,8 +79,8 @@ is_deeply( # ############################################################################# use DSNParser; use Sandbox; -my $dp = new DSNParser(opts=>$dsn_opts); -my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp); +my $dp = DSNParser->new(opts=>$dsn_opts); +my $sb = Sandbox->new(basedir => '/tmp', DSNParser => $dp); my $dbh = $sb->get_dbh_for('master'); SKIP: { diff --git a/t/lib/MySQLConfig.t b/t/lib/MySQLConfig.t index 0295d025..f591b869 100644 --- a/t/lib/MySQLConfig.t +++ b/t/lib/MySQLConfig.t @@ -17,8 +17,8 @@ use Sandbox; use TextResultSetParser; use PerconaTest; -my $dp = new DSNParser(opts=>$dsn_opts); -my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp); +my $dp = DSNParser->new(opts=>$dsn_opts); +my $sb = Sandbox->new(basedir => '/tmp', DSNParser => $dp); my $dbh = $sb->get_dbh_for('master'); use Data::Dumper; @@ -28,11 +28,11 @@ $Data::Dumper::Quotekeys = 0; my $output; my $sample = "t/lib/samples/configs/"; -my $trp = new TextResultSetParser(); +my $trp = TextResultSetParser->new(); throws_ok( sub { - my $config = new MySQLConfig( + my $config = MySQLConfig->new( TextResultSetParser => $trp, ); }, @@ -42,7 +42,7 @@ throws_ok( throws_ok( sub { - my $config = new MySQLConfig( + my $config = MySQLConfig->new( file => 'foo', output => 'bar', TextResultSetParser => $trp, @@ -54,7 +54,7 @@ throws_ok( throws_ok( sub { - my $config = new MySQLConfig( + my $config = MySQLConfig->new( file => 'fooz', TextResultSetParser => $trp, ); @@ -320,7 +320,7 @@ is_deeply( # ############################################################################# # Config from mysqld --help --verbose # ############################################################################# -my $config = new MySQLConfig( +my $config = MySQLConfig->new( file => "$trunk/$sample/mysqldhelp001.txt", TextResultSetParser => $trp, ); @@ -612,7 +612,7 @@ ok( # ############################################################################# # Config from SHOW VARIABLES # ############################################################################# -$config = new MySQLConfig( +$config = MySQLConfig->new( result_set => [ [qw(foo bar)], [qw(a z)] ], TextResultSetParser => $trp, ); @@ -646,7 +646,7 @@ ok( # ############################################################################# # Config from my_print_defaults # ############################################################################# -$config = new MySQLConfig( +$config = MySQLConfig->new( file => "$trunk/$sample/myprintdef001.txt", TextResultSetParser => $trp, ); @@ -686,7 +686,7 @@ is_deeply( # ############################################################################# # Config from option file (my.cnf) # ############################################################################# -$config = new MySQLConfig( +$config = MySQLConfig->new( file => "$trunk/$sample/mycnf001.txt", TextResultSetParser => $trp, ); @@ -723,7 +723,7 @@ is_deeply( "Vars from option file" ) or print Dumper($config->variables()); -$config = new MySQLConfig( +$config = MySQLConfig->new( file => "$trunk/$sample/mycnf002.txt", TextResultSetParser => $trp, ); @@ -750,7 +750,7 @@ is_deeply( # ############################################################################ # Baron's test cases. # ############################################################################ -$config = new MySQLConfig( +$config = MySQLConfig->new( file => "$trunk/$sample/mycnf-baron-001.txt", TextResultSetParser => $trp, ); @@ -770,7 +770,7 @@ is_deeply( "mycnf-baron-001.cnf" ); -$config = new MySQLConfig( +$config = MySQLConfig->new( file => "$trunk/t/lib/samples/show-variables/vars-baron-001.txt", TextResultSetParser => $trp, ); @@ -787,7 +787,7 @@ is( "Get vars from unformatted SHOW VARIABLES output" ); -$config = new MySQLConfig( +$config = MySQLConfig->new( file => "$trunk/$sample/mycnf-baron-002.txt", TextResultSetParser => $trp, ); @@ -804,7 +804,7 @@ is_deeply( SKIP: { skip 'Cannot connect to sandbox master', 3 unless $dbh; - $config = new MySQLConfig( + $config = MySQLConfig->new( dbh => $dbh, ); diff --git a/t/lib/MySQLConfigComparer.t b/t/lib/MySQLConfigComparer.t index 46b1d5c9..84b7e64e 100644 --- a/t/lib/MySQLConfigComparer.t +++ b/t/lib/MySQLConfigComparer.t @@ -21,8 +21,8 @@ $Data::Dumper::Indent = 1; $Data::Dumper::Sortkeys = 1; $Data::Dumper::Quotekeys = 0; -my $trp = new TextResultSetParser(); -my $cc = new MySQLConfigComparer(); +my $trp = TextResultSetParser->new(); +my $cc = MySQLConfigComparer->new(); my $c1; my $c2; @@ -47,7 +47,7 @@ sub missing { return $missing; } -$c1 = new MySQLConfig( +$c1 = MySQLConfig->new( file => "$trunk/$sample/mysqldhelp001.txt", TextResultSetParser => $trp, ); @@ -57,7 +57,7 @@ is_deeply( "mysqld config does not differ with itself" ); -$c2 = new MySQLConfig( +$c2 = MySQLConfig->new( result_set => [['query_cache_size', 0]], ); is_deeply( @@ -66,7 +66,7 @@ is_deeply( "SHOW VARS config does not differ with itself" ); -$c2 = new MySQLConfig( +$c2 = MySQLConfig->new( result_set => [['query_cache_size', 1024]], ); is_deeply( @@ -80,11 +80,11 @@ is_deeply( # ############################################################################# # Compare one config against another. # ############################################################################# -$c1 = new MySQLConfig( +$c1 = MySQLConfig->new( file => "$trunk/$sample/mysqldhelp001.txt", TextResultSetParser => $trp, ); -$c2 = new MySQLConfig( +$c2 = MySQLConfig->new( file => "$trunk/$sample/mysqldhelp002.txt", TextResultSetParser => $trp, ); @@ -150,10 +150,10 @@ is_deeply( # ############################################################################# # Missing vars. # ############################################################################# -$c1 = new MySQLConfig( +$c1 = MySQLConfig->new( result_set => [['query_cache_size', 1024]], ); -$c2 = new MySQLConfig( +$c2 = MySQLConfig->new( result_set => [], TextResultSetParser => $trp, ); @@ -167,7 +167,7 @@ is_deeply( "Missing var, right" ) or print Dumper($missing); -$c2 = new MySQLConfig( +$c2 = MySQLConfig->new( result_set => [['query_cache_size', 1024]], ); $missing = missing($c1, $c2); @@ -177,7 +177,7 @@ is_deeply( "No missing vars" ); -$c2 = new MySQLConfig( +$c2 = MySQLConfig->new( result_set => [['query_cache_size', 1024], ['foo', 1]], ); $missing = missing($c1, $c2); @@ -193,11 +193,11 @@ is_deeply( # ############################################################################# # Some tricky vars. # ############################################################################# -$c1 = new MySQLConfig( +$c1 = MySQLConfig->new( result_set => [['log_error', undef]], format => 'optiona_file', ); -$c2 = new MySQLConfig( +$c2 = MySQLConfig->new( result_set => [['log_error', '/tmp/12345/data/mysqld.log']], format => 'show_variables', ); @@ -208,11 +208,11 @@ is_deeply( "log_error: undef, value" ); -$c1 = new MySQLConfig( +$c1 = MySQLConfig->new( result_set => [['log_error', '/tmp/12345/data/mysqld.log']], format => 'show_variables', ); -$c2 = new MySQLConfig( +$c2 = MySQLConfig->new( result_set => [['log_error', undef]], format => 'option_file', ); @@ -223,11 +223,11 @@ is_deeply( "log_error: value, undef" ); -$c1 = new MySQLConfig( +$c1 = MySQLConfig->new( result_set => [[qw(log_bin mysql-bin)]], format => 'option_file', ); -$c2 = new MySQLConfig( +$c2 = MySQLConfig->new( result_set => [[qw(log_bin ON)]], format => 'show_variables', ); @@ -242,14 +242,14 @@ is_deeply( # ############################################################################ # Vars with default values. # ############################################################################ -$c1 = new MySQLConfig( +$c1 = MySQLConfig->new( result_set => [ ['log', ''], ['log_bin', ''], ], type => 'option_file', ); -$c2 = new MySQLConfig( +$c2 = MySQLConfig->new( result_set => [ ['log', '/opt/mysql/data/mysqld.log'], ['log_bin', '/opt/mysql/data/mysql-bin' ], @@ -271,7 +271,7 @@ my $datadir = '/tmp/12345/data'; # This simulates a my.cnf. We just need vars with relative paths, so no need # to parse a real my.cnf with other vars that we don't need. -$c1 = new MySQLConfig( +$c1 = MySQLConfig->new( result_set => [ ['basedir', $basedir ], # must have this ['datadir', $datadir ], # must have this @@ -283,7 +283,7 @@ $c1 = new MySQLConfig( # This simulates SHOW VARIABLES. Like $c1, we just need vars with relative # paths. But be sure to get real values because the whole point here is the # different way these vars are listed in my.cnf vs. SHOW VARS. -$c2 = new MySQLConfig( +$c2 = MySQLConfig->new( result_set => [ ['basedir', $basedir ], # must have this ['datadir', $datadir ], # must have this @@ -303,15 +303,15 @@ is_deeply( # ############################################################################ # Compare 3 configs. # ############################################################################ -$c1 = new MySQLConfig( +$c1 = MySQLConfig->new( result_set => [['log_error', '/tmp/12345/data/mysqld.log']], format => 'show_variables', ); -$c2 = new MySQLConfig( +$c2 = MySQLConfig->new( result_set => [['log_error', undef]], format => 'option_file', ); -my $c3 = new MySQLConfig( +my $c3 = MySQLConfig->new( result_set => [['log_error', '/tmp/12345/data/mysqld.log']], format => 'show_variables', ); @@ -323,7 +323,7 @@ is_deeply( "Compare 3 configs" ); -$c3 = new MySQLConfig( +$c3 = MySQLConfig->new( result_set => [['log_error', '/tmp/12345/data/mysql-error.log']], format => 'show_variables', ); @@ -344,17 +344,17 @@ is_deeply( # ############################################################################ # Add to, override defaults. # ############################################################################ -$c1 = new MySQLConfig( +$c1 = MySQLConfig->new( result_set => [['log_error', 'foo']], format => 'show_variables', ); -$c2 = new MySQLConfig( +$c2 = MySQLConfig->new( result_set => [['log_error', 'bar']], format => 'show_variables', ); { - my $cc = new MySQLConfigComparer( + my $cc = MySQLConfigComparer->new( ignore_variables => [qw(log_error)], ); diff --git a/t/lib/MySQLDump.t b/t/lib/MySQLDump.t index 7a935af9..8c1445f0 100644 --- a/t/lib/MySQLDump.t +++ b/t/lib/MySQLDump.t @@ -17,8 +17,8 @@ use DSNParser; use Sandbox; use PerconaTest; -my $dp = new DSNParser(opts=>$dsn_opts); -my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp); +my $dp = DSNParser->new(opts=>$dsn_opts); +my $sb = Sandbox->new(basedir => '/tmp', DSNParser => $dp); my $dbh = $sb->get_dbh_for('master'); @@ -31,8 +31,8 @@ else { $sb->create_dbs($dbh, ['test']); -my $du = new MySQLDump(); -my $q = new Quoter(); +my $du = MySQLDump->new(); +my $q = Quoter->new(); my $dump; diff --git a/t/lib/MySQLProtocolParser.t b/t/lib/MySQLProtocolParser.t index 54b7f9d7..b079b2a9 100644 --- a/t/lib/MySQLProtocolParser.t +++ b/t/lib/MySQLProtocolParser.t @@ -16,11 +16,11 @@ use TcpdumpParser; use PerconaTest; my $sample = "t/lib/samples/tcpdump/"; -my $tcpdump = new TcpdumpParser(); -my $protocol; # Create a new MySQLProtocolParser for each test. +my $tcpdump = TcpdumpParser->new(); +my $protocol; # Create a MySQLProtocolParser->new for each test. # Check that I can parse a really simple session. -$protocol = new MySQLProtocolParser(); +$protocol = MySQLProtocolParser->new(); test_protocol_parser( parser => $tcpdump, protocol => $protocol, @@ -48,7 +48,7 @@ test_protocol_parser( ); # A more complex session with a complete login/logout cycle. -$protocol = new MySQLProtocolParser(); +$protocol = MySQLProtocolParser->new(); test_protocol_parser( parser => $tcpdump, protocol => $protocol, @@ -130,7 +130,7 @@ test_protocol_parser( ); # A session that has an error during login. -$protocol = new MySQLProtocolParser(); +$protocol = MySQLProtocolParser->new(); test_protocol_parser( parser => $tcpdump, protocol => $protocol, @@ -159,7 +159,7 @@ test_protocol_parser( ); # A session that has an error executing a query -$protocol = new MySQLProtocolParser(); +$protocol = MySQLProtocolParser->new(); test_protocol_parser( parser => $tcpdump, protocol => $protocol, @@ -188,7 +188,7 @@ test_protocol_parser( ); # A session that has a single-row insert and a multi-row insert -$protocol = new MySQLProtocolParser(); +$protocol = MySQLProtocolParser->new(); test_protocol_parser( parser => $tcpdump, protocol => $protocol, @@ -234,7 +234,7 @@ test_protocol_parser( ); # A session that causes a slow query because it doesn't use an index. -$protocol = new MySQLProtocolParser(); +$protocol = MySQLProtocolParser->new(); test_protocol_parser( parser => $tcpdump, protocol => $protocol, @@ -262,7 +262,7 @@ test_protocol_parser( ); # A session that truncates an insert. -$protocol = new MySQLProtocolParser(); +$protocol = MySQLProtocolParser->new(); test_protocol_parser( parser => $tcpdump, protocol => $protocol, @@ -391,7 +391,7 @@ is_deeply( ); # Test that we can parse with a non-standard port etc. -$protocol = new MySQLProtocolParser( +$protocol = MySQLProtocolParser->new( server => '192.168.1.1', port => '3307', ); @@ -425,7 +425,7 @@ test_protocol_parser( # Issue 447: MySQLProtocolParser does not handle old password algo or # compressed packets # ############################################################################# -$protocol = new MySQLProtocolParser( +$protocol = MySQLProtocolParser->new( server => '10.55.200.15', ); test_protocol_parser( @@ -456,7 +456,7 @@ test_protocol_parser( ); # Check in-stream compression detection. -$protocol = new MySQLProtocolParser( +$protocol = MySQLProtocolParser->new( server => '10.55.200.15', ); test_protocol_parser( @@ -488,7 +488,7 @@ test_protocol_parser( ); # Check data decompression. -$protocol = new MySQLProtocolParser( +$protocol = MySQLProtocolParser->new( server => '127.0.0.1', port => '12345', ); @@ -560,7 +560,7 @@ test_protocol_parser( # TCP retransmission. # Check data decompression. -$protocol = new MySQLProtocolParser( +$protocol = MySQLProtocolParser->new( server => '10.55.200.15', ); test_protocol_parser( @@ -595,7 +595,7 @@ test_protocol_parser( # Issue 537: MySQLProtocolParser and MemcachedProtocolParser do not handle # multiple servers. # ############################################################################# -$protocol = new MySQLProtocolParser(); +$protocol = MySQLProtocolParser->new(); test_protocol_parser( parser => $tcpdump, protocol => $protocol, @@ -644,7 +644,7 @@ test_protocol_parser( ); # Test that --watch-server causes just the given server to be watched. -$protocol = new MySQLProtocolParser(server=>'10.0.0.1',port=>'3306'); +$protocol = MySQLProtocolParser->new(server=>'10.0.0.1',port=>'3306'); test_protocol_parser( parser => $tcpdump, protocol => $protocol, @@ -677,7 +677,7 @@ test_protocol_parser( # ############################################################################# # Issue 558: Make mk-query-digest handle big/fragmented packets # ############################################################################# -$protocol = new MySQLProtocolParser(server=>'127.0.0.1',port=>'12345'); +$protocol = MySQLProtocolParser->new(server=>'127.0.0.1',port=>'12345'); my $e = test_protocol_parser( parser => $tcpdump, protocol => $protocol, @@ -701,7 +701,7 @@ is( # ############################################################################# # Issue 740: Handle prepared statements # ############################################################################# -$protocol = new MySQLProtocolParser(server=>'127.0.0.1',port=>'12345'); +$protocol = MySQLProtocolParser->new(server=>'127.0.0.1',port=>'12345'); test_protocol_parser( parser => $tcpdump, protocol => $protocol, @@ -770,7 +770,7 @@ test_protocol_parser( ], ); -$protocol = new MySQLProtocolParser(server=>'127.0.0.1',port=>'12345'); +$protocol = MySQLProtocolParser->new(server=>'127.0.0.1',port=>'12345'); test_protocol_parser( parser => $tcpdump, protocol => $protocol, @@ -820,7 +820,7 @@ test_protocol_parser( ], ); -$protocol = new MySQLProtocolParser(server=>'127.0.0.1',port=>'12345'); +$protocol = MySQLProtocolParser->new(server=>'127.0.0.1',port=>'12345'); test_protocol_parser( parser => $tcpdump, protocol => $protocol, @@ -870,7 +870,7 @@ test_protocol_parser( ], ); -$protocol = new MySQLProtocolParser(server=>'127.0.0.1',port=>'12345'); +$protocol = MySQLProtocolParser->new(server=>'127.0.0.1',port=>'12345'); test_protocol_parser( parser => $tcpdump, protocol => $protocol, @@ -920,7 +920,7 @@ test_protocol_parser( ], ); -$protocol = new MySQLProtocolParser(server=>'127.0.0.1',port=>'12345'); +$protocol = MySQLProtocolParser->new(server=>'127.0.0.1',port=>'12345'); test_protocol_parser( parser => $tcpdump, protocol => $protocol, @@ -970,7 +970,7 @@ test_protocol_parser( ], ); -$protocol = new MySQLProtocolParser(server=>'127.0.0.1',port=>'3306'); +$protocol = MySQLProtocolParser->new(server=>'127.0.0.1',port=>'3306'); test_protocol_parser( parser => $tcpdump, protocol => $protocol, @@ -999,7 +999,7 @@ test_protocol_parser( ], ); -$protocol = new MySQLProtocolParser(server=>'127.0.0.1',port=>'3306'); +$protocol = MySQLProtocolParser->new(server=>'127.0.0.1',port=>'3306'); test_protocol_parser( parser => $tcpdump, protocol => $protocol, @@ -1029,7 +1029,7 @@ test_protocol_parser( ], ); -$protocol = new MySQLProtocolParser(server=>'127.0.0.1',port=>'12345'); +$protocol = MySQLProtocolParser->new(server=>'127.0.0.1',port=>'12345'); test_protocol_parser( parser => $tcpdump, protocol => $protocol, @@ -1119,7 +1119,7 @@ test_protocol_parser( ], ); -$protocol = new MySQLProtocolParser(server=>'127.0.0.1',port=>'12345'); +$protocol = MySQLProtocolParser->new(server=>'127.0.0.1',port=>'12345'); test_protocol_parser( parser => $tcpdump, protocol => $protocol, @@ -1207,7 +1207,7 @@ test_protocol_parser( ] ); -$protocol = new MySQLProtocolParser(server=>'127.0.0.1',port=>'3306'); +$protocol = MySQLProtocolParser->new(server=>'127.0.0.1',port=>'3306'); test_protocol_parser( parser => $tcpdump, protocol => $protocol, @@ -1257,7 +1257,7 @@ test_protocol_parser( ], ); -$protocol = new MySQLProtocolParser(server=>'127.0.0.1',port=>'3306'); +$protocol = MySQLProtocolParser->new(server=>'127.0.0.1',port=>'3306'); test_protocol_parser( parser => $tcpdump, protocol => $protocol, @@ -1310,7 +1310,7 @@ test_protocol_parser( # ############################################################################# # Issue 761: mk-query-digest --tcpdump does not handle incomplete packets # ############################################################################# -$protocol = new MySQLProtocolParser(server=>'127.0.0.1',port=>'3306'); +$protocol = MySQLProtocolParser->new(server=>'127.0.0.1',port=>'3306'); test_protocol_parser( parser => $tcpdump, protocol => $protocol, @@ -1342,7 +1342,7 @@ test_protocol_parser( # ############################################################################# # Issue 760: mk-query-digest --tcpdump might not get the whole query # ############################################################################# -$protocol = new MySQLProtocolParser(server=>'127.0.0.1',port=>'3306'); +$protocol = MySQLProtocolParser->new(server=>'127.0.0.1',port=>'3306'); test_protocol_parser( parser => $tcpdump, protocol => $protocol, @@ -1374,7 +1374,7 @@ test_protocol_parser( # ############################################################################# # Issue 794: MySQLProtocolParser does not handle client port reuse # ############################################################################# -$protocol = new MySQLProtocolParser(); +$protocol = MySQLProtocolParser->new(); test_protocol_parser( parser => $tcpdump, protocol => $protocol, @@ -1493,7 +1493,7 @@ test_protocol_parser( ], ); -$protocol = new MySQLProtocolParser(); +$protocol = MySQLProtocolParser->new(); test_protocol_parser( parser => $tcpdump, protocol => $protocol, @@ -1576,7 +1576,7 @@ test_protocol_parser( ], ); -$protocol = new MySQLProtocolParser(); +$protocol = MySQLProtocolParser->new(); test_protocol_parser( parser => $tcpdump, protocol => $protocol, @@ -1626,7 +1626,7 @@ test_protocol_parser( # Issue 832: mk-query-digest tcpdump crashes on successive, fragmented # client query # ############################################################################# -$protocol = new MySQLProtocolParser(server => '127.0.0.1',port=>'12345'); +$protocol = MySQLProtocolParser->new(server => '127.0.0.1',port=>'12345'); $e = test_protocol_parser( parser => $tcpdump, protocol => $protocol, @@ -1642,7 +1642,7 @@ like( # ############################################################################# # Issue 670: Make mk-query-digest capture the error message from tcpdump # ############################################################################# -$protocol = new MySQLProtocolParser( +$protocol = MySQLProtocolParser->new( server => '127.0.0.1', port => '3306', ); diff --git a/t/lib/NibbleIterator.t b/t/lib/NibbleIterator.t index 3a74aaa6..c967d77c 100644 --- a/t/lib/NibbleIterator.t +++ b/t/lib/NibbleIterator.t @@ -31,8 +31,8 @@ $Data::Dumper::Indent = 1; $Data::Dumper::Sortkeys = 1; $Data::Dumper::Quotekeys = 0; -my $dp = new DSNParser(opts=>$dsn_opts); -my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp); +my $dp = DSNParser->new(opts=>$dsn_opts); +my $sb = Sandbox->new(basedir => '/tmp', DSNParser => $dp); my $dbh = $sb->get_dbh_for('master'); if ( !$dbh ) { @@ -42,12 +42,12 @@ else { plan tests => 20; } -my $q = new Quoter(); -my $tp = new TableParser(Quoter=>$q); -my $du = new MySQLDump(); -my $nb = new TableNibbler(TableParser=>$tp, Quoter=>$q); -my $o = new OptionParser(description => 'NibbleIterator'); -my $rc = new RowChecksum(OptionParser => $o, Quoter=>$q); +my $q = Quoter->new(); +my $tp = TableParser->new(Quoter=>$q); +my $du = MySQLDump->new(); +my $nb = TableNibbler->new(TableParser=>$tp, Quoter=>$q); +my $o = OptionParser->new(description => 'NibbleIterator'); +my $rc = RowChecksum->new(OptionParser => $o, Quoter=>$q); $o->get_specs("$trunk/bin/pt-table-checksum"); @@ -70,8 +70,8 @@ sub make_nibble_iter { @ARGV = $args{argv} ? @{$args{argv}} : (); $o->get_opts(); - my $schema = new Schema(); - my $si = new SchemaIterator( + my $schema = Schema->new(); + my $si = SchemaIterator->new( dbh => $dbh, keep_ddl => 1, Schema => $schema, @@ -79,7 +79,7 @@ sub make_nibble_iter { ); 1 while $si->next_schema_object(); - my $ni = new NibbleIterator( + my $ni = NibbleIterator->new( dbh => $dbh, tbl => $schema->get_table($args{db}, $args{tbl}), callbacks => $args{callbacks}, diff --git a/t/lib/OSCCaptureSync.t b/t/lib/OSCCaptureSync.t index 829ebaba..0fae5418 100644 --- a/t/lib/OSCCaptureSync.t +++ b/t/lib/OSCCaptureSync.t @@ -21,8 +21,8 @@ $Data::Dumper::Indent = 1; $Data::Dumper::Sortkeys = 1; $Data::Dumper::Quotekeys = 0; -my $dp = new DSNParser(opts=>$dsn_opts); -my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp); +my $dp = DSNParser->new(opts=>$dsn_opts); +my $sb = Sandbox->new(basedir => '/tmp', DSNParser => $dp); my $dbh = $sb->get_dbh_for('master'); if ( !$dbh ) { @@ -36,7 +36,7 @@ else { $sb->load_file("master", "t/lib/samples/osc/tbl001.sql"); $dbh->do("USE osc"); -my $osc = new OSCCaptureSync(); +my $osc = OSCCaptureSync->new(); my $msg = sub { print "$_[0]\n"; }; diff --git a/t/lib/OptionParser.t b/t/lib/OptionParser.t index 0533b166..2ac2cd3a 100644 --- a/t/lib/OptionParser.t +++ b/t/lib/OptionParser.t @@ -15,7 +15,7 @@ use OptionParser; use DSNParser; use PerconaTest; -my $o = new OptionParser( +my $o = OptionParser->new( description => 'OptionParser.t parses command line options.', usage => "$PROGRAM_NAME ", ); @@ -87,7 +87,7 @@ my $dsn_opts = [ copy => 1, }, ]; -my $dp = new DSNParser(opts => $dsn_opts); +my $dp = DSNParser->new(opts => $dsn_opts); # ############################################################################# # Test basic usage. @@ -102,7 +102,7 @@ ok( ); # More exhaustive test of how the standard interface works internally. -$o = new OptionParser( +$o = OptionParser->new( description => 'OptionParser.t parses command line options.', usage => "$PROGRAM_NAME ", ); @@ -450,7 +450,7 @@ like( # ############################################################################# # Test option defaults. # ############################################################################# -$o = new OptionParser( +$o = OptionParser->new( description => 'OptionParser.t parses command line options.', usage => "$PROGRAM_NAME [OPTIONS]", ); @@ -715,7 +715,7 @@ ok( 'Options aligned and custom prompt included' ); -$o = new OptionParser( +$o = OptionParser->new( description => 'OptionParser.t parses command line options.', usage => "$PROGRAM_NAME ", ); @@ -732,7 +732,7 @@ ok( # ############################################################################# # Test _get_participants() # ############################################################################# -$o = new OptionParser( +$o = OptionParser->new( description => 'OptionParser.t parses command line options.', usage => "$PROGRAM_NAME ", ); @@ -757,7 +757,7 @@ is_deeply( # ############################################################################# # Test required options. # ############################################################################# -$o = new OptionParser( +$o = OptionParser->new( description => 'OptionParser.t parses command line options.', usage => "$PROGRAM_NAME ", ); @@ -795,7 +795,7 @@ is( # ############################################################################# # Test option rules. # ############################################################################# -$o = new OptionParser( +$o = OptionParser->new( description => 'OptionParser.t parses command line options.', usage => "$PROGRAM_NAME ", ); @@ -834,7 +834,7 @@ my @ird_specs = ( { spec => 'delete|d', desc => 'Delete' }, ); -$o = new OptionParser( +$o = OptionParser->new( description => 'OptionParser.t parses command line options.', usage => "$PROGRAM_NAME ", ); @@ -850,7 +850,7 @@ is_deeply( 'Error set with long opt name and nice commas when rule violated', ); -$o = new OptionParser( +$o = OptionParser->new( description => 'OptionParser.t parses command line options.', usage => "$PROGRAM_NAME ", ); @@ -866,7 +866,7 @@ like( 'Die on using nonexistent option in one-and-only-one rule' ); -$o = new OptionParser( +$o = OptionParser->new( description => 'OptionParser.t parses command line options.', usage => "$PROGRAM_NAME ", ); @@ -882,7 +882,7 @@ is_deeply( 'Error set with one-and-only-one rule violated', ); -$o = new OptionParser( +$o = OptionParser->new( description => 'OptionParser.t parses command line options.', usage => "$PROGRAM_NAME " ); @@ -898,7 +898,7 @@ is_deeply( 'Error set with one-and-only-one when none specified', ); -$o = new OptionParser( +$o = OptionParser->new( description => 'OptionParser.t parses command line options.', usage => "$PROGRAM_NAME " ); @@ -914,7 +914,7 @@ is_deeply( 'Error set with at-least-one when none specified', ); -$o = new OptionParser( +$o = OptionParser->new( description => 'OptionParser.t parses command line options.', usage => "$PROGRAM_NAME " ); @@ -930,7 +930,7 @@ ok( ); use Data::Dumper; $Data::Dumper::Indent=1; -$o = new OptionParser( +$o = OptionParser->new( description => 'OptionParser.t parses command line options.', usage => "$PROGRAM_NAME " ); @@ -966,7 +966,7 @@ is_deeply( ); # Option can't disable a nonexistent option. -$o = new OptionParser( +$o = OptionParser->new( description => 'OptionParser.t parses command line options.', usage => "$PROGRAM_NAME " ); @@ -983,7 +983,7 @@ like( ); # Option can't 'allowed with' a nonexistent option. -$o = new OptionParser( +$o = OptionParser->new( description => 'OptionParser.t parses command line options.', usage => "$PROGRAM_NAME " ); @@ -1003,7 +1003,7 @@ like( # ############################################################################# # Test default values encoded in description. # ############################################################################# -$o = new OptionParser( +$o = OptionParser->new( description => 'OptionParser.t parses command line options.', usage => "$PROGRAM_NAME " ); @@ -1094,7 +1094,7 @@ is( # ############################################################################# # Test size option type. # ############################################################################# -$o = new OptionParser( +$o = OptionParser->new( description => 'OptionParser.t parses command line options.', usage => "$PROGRAM_NAME " ); @@ -1145,7 +1145,7 @@ is_deeply( # ############################################################################# # Test time option type. # ############################################################################# -$o = new OptionParser( +$o = OptionParser->new( description => 'OptionParser.t parses command line options.', usage => "$PROGRAM_NAME " ); @@ -1194,7 +1194,7 @@ is_deeply( ); # Use shorter, simpler specs to test usage for time blurb. -$o = new OptionParser( +$o = OptionParser->new( description => 'OptionParser.t parses command line options.', usage => "$PROGRAM_NAME ", ); @@ -1219,7 +1219,7 @@ is_deeply( # ############################################################################# # Test DSN option type. # ############################################################################# -$o = new OptionParser( +$o = OptionParser->new( description => 'OptionParser.t parses command line options.', usage => "$PROGRAM_NAME " ); @@ -1272,7 +1272,7 @@ ok( 'DSN stringified with inheritance into post-processed args' ); -$o = new OptionParser( +$o = OptionParser->new( description => 'OptionParser.t parses command line options.', usage => "$PROGRAM_NAME " ); @@ -1304,7 +1304,7 @@ is_deeply( # ############################################################################# # Test [Hh]ash and [Aa]rray option types. # ############################################################################# -$o = new OptionParser( +$o = OptionParser->new( description => 'OptionParser.t parses command line options.', usage => "$PROGRAM_NAME " ); @@ -1368,7 +1368,7 @@ ok( # Test groups. # ############################################################################# -$o = new OptionParser( +$o = OptionParser->new( description => 'OptionParser.t parses command line options.', usage => "$PROGRAM_NAME " ); @@ -1418,7 +1418,7 @@ is_deeply( # ############################################################################# # Test clone(). # ############################################################################# -$o = new OptionParser( +$o = OptionParser->new( description => 'OptionParser.t parses command line options.', usage => "$PROGRAM_NAME " ); @@ -1493,7 +1493,7 @@ is_deeply( 'Reads a config file', ); -$o = new OptionParser( +$o = OptionParser->new( description => 'OptionParser.t parses command line options.', usage => "$PROGRAM_NAME " ); @@ -1513,7 +1513,7 @@ is_deeply( ); ok(!$o->got('config'), 'Did not got --config'); -$o = new OptionParser( +$o = OptionParser->new( description => 'OptionParser.t parses command line options.', usage => "$PROGRAM_NAME " ); @@ -1530,7 +1530,7 @@ ok( ); @ARGV=qw(--config /path/to/config --cat); -$o = new OptionParser( +$o = OptionParser->new( description => 'OptionParser.t parses command line options.', usage => "$PROGRAM_NAME " ); @@ -1552,7 +1552,7 @@ ok( 'Parses special --config option first', ); -$o = new OptionParser( +$o = OptionParser->new( description => 'OptionParser.t parses command line options.', usage => "$PROGRAM_NAME " ); @@ -1575,7 +1575,7 @@ is_deeply( ); # And now we can actually get it to read a config file into the options! -$o = new OptionParser( +$o = OptionParser->new( description => 'OptionParser.t parses command line options.', usage => "$PROGRAM_NAME ", ); @@ -1617,7 +1617,7 @@ is($o->get('verbose'), 2, 'Got --verbose value twice'); # Issue 409: OptionParser modifies second value of # ' -- .*','(\w+): ([^,]+)' for array type opt # ############################################################################# -$o = new OptionParser( +$o = OptionParser->new( description => 'OptionParser.t parses command line options.', usage => "$PROGRAM_NAME " ); @@ -1638,7 +1638,7 @@ is_deeply( # ############################################################################# # Issue 349: Make OptionParser die on unrecognized attributes # ############################################################################# -$o = new OptionParser( +$o = OptionParser->new( description => 'OptionParser.t parses command line options.', usage => "$PROGRAM_NAME " ); @@ -1655,7 +1655,7 @@ like( # ############################################################################# # The problem is actually in how OptionParser handles copying DSN vals. -$o = new OptionParser( +$o = OptionParser->new( description => 'OptionParser.t parses command line options.', usage => "$PROGRAM_NAME " ); @@ -1694,7 +1694,7 @@ is_deeply( # See the 5 cases (i.-v.) at http://groups.google.com/group/maatkit-discuss/browse_thread/thread/f4bf1e659c60f03e # case ii. -$o = new OptionParser( +$o = OptionParser->new( description => 'OptionParser.t parses command line options.', usage => "$PROGRAM_NAME " ); @@ -1765,7 +1765,7 @@ is_deeply( # Issue 617: Command line options do no override config file options # ############################################################################# diag(`echo "iterations=4" > ~/.OptionParser.t.conf`); -$o = new OptionParser( +$o = OptionParser->new( description => 'OptionParser.t parses command line options.', usage => "$PROGRAM_NAME " ); @@ -1784,7 +1784,7 @@ diag(`rm -rf ~/.OptionParser.t.conf`); # ############################################################################# # time type opts need to allow leading +/- -$o = new OptionParser( +$o = OptionParser->new( description => 'OptionParser.t parses command line options.', usage => "$PROGRAM_NAME " ); @@ -1820,7 +1820,7 @@ is( # This happens because --ignore-attributes has a really long default # value like val,val,val. man can't break this line unless that list # has spaces like val, val, val. -$o = new OptionParser( +$o = OptionParser->new( description => 'OptionParser.t parses command line options.', usage => "$PROGRAM_NAME " ); @@ -1839,7 +1839,7 @@ is_deeply( # ############################################################################# # Issue 940: OptionParser cannot resolve option dependencies # ############################################################################# -$o = new OptionParser( +$o = OptionParser->new( description => 'OptionParser.t parses command line options.', usage => "$PROGRAM_NAME " ); @@ -1881,7 +1881,7 @@ is_deeply( ); # Should die on circular dependency, avoid infinite loop. -$o = new OptionParser( +$o = OptionParser->new( description => 'OptionParser.t parses command line options.', usage => "$PROGRAM_NAME " ); @@ -1914,7 +1914,7 @@ throws_ok( # ############################################################################# # Issue 344 # ############################################################################# -$o = new OptionParser( +$o = OptionParser->new( description => 'OptionParser.t parses command line options.', usage => "$PROGRAM_NAME " ); @@ -1932,7 +1932,7 @@ is( # ############################################################################# # Issue 55: Integrate DSN specifications into POD # ############################################################################# -$o = new OptionParser( +$o = OptionParser->new( description => 'OptionParser.t parses command line options.', usage => "$PROGRAM_NAME " ); @@ -1954,7 +1954,7 @@ like( # ############################################################################# # Issue 1123: OptionParser type: string; default: 0 doesn't work # ############################################################################# -$o = new OptionParser( +$o = OptionParser->new( description => 'OptionParser.t parses command line options.', usage => "$PROGRAM_NAME " ); @@ -1971,7 +1971,7 @@ is( # ############################################################################# # Issue 338: Make all of tool's --help output come from POD # ############################################################################# -$o = new OptionParser(file => "$trunk/bin/pt-archiver"); +$o = OptionParser->new(file => "$trunk/bin/pt-archiver"); my %synop = $o->_parse_synopsis(); diff --git a/t/lib/Outfile.t b/t/lib/Outfile.t index 41d8fb18..4733052c 100644 --- a/t/lib/Outfile.t +++ b/t/lib/Outfile.t @@ -18,11 +18,11 @@ use PerconaTest; # This is just for grabbing stuff from fetchrow_arrayref() # instead of writing test rows by hand. -my $dp = new DSNParser(opts=>$dsn_opts); -my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp); +my $dp = DSNParser->new(opts=>$dsn_opts); +my $sb = Sandbox->new(basedir => '/tmp', DSNParser => $dp); my $dbh = $sb->get_dbh_for('master'); -my $outfile = new Outfile(); +my $outfile = Outfile->new(); sub test_outfile { my ( $rows, $expected_output ) = @_; diff --git a/t/lib/PgLogParser.t b/t/lib/PgLogParser.t index d16cb97f..12b6f5d3 100644 --- a/t/lib/PgLogParser.t +++ b/t/lib/PgLogParser.t @@ -15,7 +15,7 @@ use PgLogParser; use SysLogParser; use PerconaTest; -my $p = new PgLogParser; +my $p = PgLogParser->new; # Run some tests of duration_to_secs(). my @duration_tests = ( diff --git a/t/lib/Pipeline.t b/t/lib/Pipeline.t index 720e40ab..3933f146 100644 --- a/t/lib/Pipeline.t +++ b/t/lib/Pipeline.t @@ -26,7 +26,7 @@ my %args = ( # A simple run stopped by a proc returning and exit status. # ############################################################################# -my $pipeline = new Pipeline(); +my $pipeline = Pipeline->new(); $pipeline->add( name => 'proc1', process => sub { @@ -53,7 +53,7 @@ is( $oktorun = 1; my @exit = (undef, 1); -$pipeline = new Pipeline(); +$pipeline = Pipeline->new(); $pipeline->add( name => 'proc1', process => sub { @@ -92,7 +92,7 @@ is( # ############################################################################# $oktorun = 0; -$pipeline = new Pipeline(); +$pipeline = Pipeline->new(); $pipeline->add( name => 'proc1', process => sub { @@ -119,7 +119,7 @@ my $pargs = {}; $args{pipeline_data} = $pargs; $oktorun = 1; -$pipeline = new Pipeline(); +$pipeline = Pipeline->new(); $pipeline->add( name => 'proc1', process => sub { @@ -160,7 +160,7 @@ is( # Instrumentation. # ############################################################################# $oktorun = 1; -$pipeline = new Pipeline(instrument => 1); +$pipeline = Pipeline->new(instrument => 1); $pipeline->add( name => 'proc1', process => sub { @@ -204,7 +204,7 @@ is( # Continue on error. # ############################################################################# $oktorun = 1; -$pipeline = new Pipeline(continue_on_error=>1); +$pipeline = Pipeline->new(continue_on_error=>1); my @die = qw(1 0); $pipeline->add( diff --git a/t/lib/PodParser.t b/t/lib/PodParser.t index c6dffc83..27115e4a 100644 --- a/t/lib/PodParser.t +++ b/t/lib/PodParser.t @@ -19,7 +19,7 @@ $Data::Dumper::Indent = 1; $Data::Dumper::Sortkeys = 1; $Data::Dumper::Quotekeys = 0; -my $p = new PodParser(); +my $p = PodParser->new(); $p->parse_from_file("$trunk/t/lib/samples/pod/pod_sample_mqa.txt"); diff --git a/t/lib/Processlist.t b/t/lib/Processlist.t index e82c0c53..52d2b441 100644 --- a/t/lib/Processlist.t +++ b/t/lib/Processlist.t @@ -23,8 +23,8 @@ $Data::Dumper::Indent = 1; $Data::Dumper::Sortkeys = 1; $Data::Dumper::Quotekeys = 0; -my $ms = new MasterSlave(); -my $rsp = new TextResultSetParser(); +my $ms = MasterSlave->new(); +my $rsp = TextResultSetParser->new(); my $pl; my $procs; my @events; @@ -42,7 +42,7 @@ sub parse_n_times { # A cxn that's connecting should be seen but ignored until it begins # to execute a query. # ########################################################################### -$pl = new Processlist(MasterSlave=>$ms); +$pl = Processlist->new(MasterSlave=>$ms); $procs = [ [ [1, 'unauthenticated user', 'localhost', undef, 'Connect', undef, diff --git a/t/lib/Progress.t b/t/lib/Progress.t index b6f6b1ff..17812101 100644 --- a/t/lib/Progress.t +++ b/t/lib/Progress.t @@ -44,7 +44,7 @@ foreach my $test ( ( throws_ok($test->[0], qr/$test->[1]/, $test->[1]); } -$pr = new Progress ( +$pr = Progress->new ( jobsize => 100, spec => [qw(percentage 15)], ); @@ -56,7 +56,7 @@ is ($pr->{interval}, 15, 'interval is 15'); # Simple percentage-based completion. # ############################################################################# -$pr = new Progress( +$pr = Progress->new( jobsize => 100, report => 'percentage', interval => 5, @@ -112,7 +112,7 @@ is($callbacks_called, 20, 'Callback not called any more times'); # Iteration-based completion. # ############################################################################# -$pr = new Progress( +$pr = Progress->new( jobsize => 500, report => 'iterations', interval => 2, @@ -139,7 +139,7 @@ is($callbacks_called, 26, 'Callback called every 2 iterations'); # Time-based completion. # ############################################################################# -$pr = new Progress( +$pr = Progress->new( jobsize => 600, report => 'time', interval => 10, # Every ten seconds @@ -169,7 +169,7 @@ my $buffer; eval { local *STDERR; open STDERR, '>', \$buffer or die $OS_ERROR; - $pr = new Progress( + $pr = Progress->new( jobsize => 600, report => 'time', interval => 10, # Every ten seconds @@ -185,7 +185,7 @@ $buffer = ''; eval { local *STDERR; open STDERR, '>', \$buffer or die $OS_ERROR; - $pr = new Progress( + $pr = Progress->new( jobsize => 600, report => 'time', interval => 10, # Every ten seconds diff --git a/t/lib/ProtocolParser.t b/t/lib/ProtocolParser.t index a73669e1..95041ffa 100644 --- a/t/lib/ProtocolParser.t +++ b/t/lib/ProtocolParser.t @@ -14,7 +14,7 @@ use Test::More tests => 1; use ProtocolParser; use PerconaTest; -my $protocol = new ProtocolParser(); +my $protocol = ProtocolParser->new(); isa_ok($protocol, 'ProtocolParser'); # ############################################################################# diff --git a/t/lib/QueryAdvisorRules.t b/t/lib/QueryAdvisorRules.t index 4f1bc98b..93bcf267 100644 --- a/t/lib/QueryAdvisorRules.t +++ b/t/lib/QueryAdvisorRules.t @@ -27,8 +27,8 @@ use SQLParser; # store its own rule info. But plugins supplied by users should. # - It has a get_rule_info() method that accepts an ID and returns a hashref: # {ID => 'ID', Severity => 'NOTE|WARN|CRIT', Description => '......'} -my $p = new PodParser(); -my $qar = new QueryAdvisorRules(PodParser => $p); +my $p = PodParser->new(); +my $qar = QueryAdvisorRules->new(PodParser => $p); my @rules = $qar->get_rules(); ok( @@ -469,18 +469,18 @@ my @cases = ( ); # Run the test cases. -$qar = new QueryAdvisorRules(PodParser => $p); +$qar = QueryAdvisorRules->new(PodParser => $p); $qar->load_rule_info( rules => [ $qar->get_rules() ], file => "$trunk/bin/pt-query-advisor", section => 'RULES', ); -my $adv = new Advisor(match_type => "pos"); +my $adv = Advisor->new(match_type => "pos"); $adv->load_rules($qar); $adv->load_rule_info($qar); -my $sp = new SQLParser(); +my $sp = SQLParser->new(); foreach my $test ( @cases ) { my $query_struct = $sp->parse($test->{query}); diff --git a/t/lib/QueryParser.t b/t/lib/QueryParser.t index c4b51f6a..a2b2892b 100644 --- a/t/lib/QueryParser.t +++ b/t/lib/QueryParser.t @@ -17,8 +17,8 @@ use QueryRewriter; use QueryParser; use PerconaTest; -my $qp = new QueryParser; -my $qr = new QueryRewriter( QueryParser => $qp ); +my $qp = QueryParser->new; +my $qr = QueryRewriter->new( QueryParser => $qp ); isa_ok( $qp, 'QueryParser' ); diff --git a/t/lib/QueryReportFormatter.t b/t/lib/QueryReportFormatter.t index 09b86926..4516278f 100644 --- a/t/lib/QueryReportFormatter.t +++ b/t/lib/QueryReportFormatter.t @@ -30,21 +30,21 @@ use ExplainAnalyzer; use Sandbox; use PerconaTest; -my $dp = new DSNParser(opts=>$dsn_opts); -my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp); +my $dp = DSNParser->new(opts=>$dsn_opts); +my $sb = Sandbox->new(basedir => '/tmp', DSNParser => $dp); my $dbh = $sb->get_dbh_for('master', {no_lc=>1}); # for explain sparkline my ($result, $events, $expected); -my $q = new Quoter(); -my $qp = new QueryParser(); -my $qr = new QueryRewriter(QueryParser=>$qp); -my $o = new OptionParser(description=>'qrf'); -my $ex = new ExplainAnalyzer(QueryRewriter => $qr, QueryParser => $qp); +my $q = Quoter->new(); +my $qp = QueryParser->new(); +my $qr = QueryRewriter->new(QueryParser=>$qp); +my $o = OptionParser->new(description=>'qrf'); +my $ex = ExplainAnalyzer->new(QueryRewriter => $qr, QueryParser => $qp); $o->get_specs("$trunk/bin/pt-query-digest"); -my $qrf = new QueryReportFormatter( +my $qrf = QueryReportFormatter->new( OptionParser => $o, QueryRewriter => $qr, QueryParser => $qp, @@ -52,7 +52,7 @@ my $qrf = new QueryReportFormatter( ExplainAnalyzer => $ex, ); -my $ea = new EventAggregator( +my $ea = EventAggregator->new( groupby => 'fingerprint', worst => 'Query_time', attributes => { @@ -204,7 +204,7 @@ ok( SKIP: { skip 'Wider labels not used, not tested', 1; -$qrf = new QueryReportFormatter(label_width => 15); +$qrf = QueryReportFormatter->new(label_width => 15); $result = $qrf->event_report( $ea, @@ -225,13 +225,13 @@ ok( 'Event report with wider label' ); -$qrf = new QueryReportFormatter; +$qrf = QueryReportFormatter->new; }; # ######################################################################## # This one is all about an event that's all zeroes. # ######################################################################## -$ea = new EventAggregator( +$ea = EventAggregator->new( groupby => 'fingerprint', worst => 'Query_time', attributes => { @@ -358,7 +358,7 @@ $events = [ } ]; -$ea = new EventAggregator( +$ea = EventAggregator->new( groupby => 'fingerprint', worst => 'Query_time', ignore_attributes => [qw(arg cmd)], @@ -468,7 +468,7 @@ $events = [ }, ]; -$ea = new EventAggregator( +$ea = EventAggregator->new( groupby => 'fingerprint', worst => 'Query_time', ignore_attributes => [qw(arg cmd)], @@ -522,7 +522,7 @@ $events = [ } ]; -$ea = new EventAggregator( +$ea = EventAggregator->new( groupby => 'fingerprint', worst => 'Query_time', ignore_attributes => [qw(arg cmd)], @@ -553,10 +553,10 @@ ok( # line 3805 # ############################################################################# use SlowLogParser; -my $p = new SlowLogParser(); +my $p = SlowLogParser->new(); sub report_from_file { - my $ea2 = new EventAggregator( + my $ea2 = EventAggregator->new( groupby => 'fingerprint', worst => 'Query_time', ); @@ -634,7 +634,7 @@ $events = [ }, ]; -$ea = new EventAggregator( +$ea = EventAggregator->new( groupby => 'fingerprint', worst => 'Query_time', ignore_attributes => [qw(arg cmd)], @@ -752,7 +752,7 @@ $events = [ } ]; -$ea = new EventAggregator( +$ea = EventAggregator->new( groupby => 'fingerprint', worst => 'Query_time', ignore_attributes => [qw(arg cmd)], @@ -797,7 +797,7 @@ $events = [ }, ]; -$ea = new EventAggregator( +$ea = EventAggregator->new( groupby => 'arg', worst => 'Query_time', ignore_attributes => [qw(arg cmd)], @@ -887,7 +887,7 @@ $events = [ }, ]; -$ea = new EventAggregator( +$ea = EventAggregator->new( groupby => 'arg', worst => 'Query_time', ignore_attributes => [qw(arg cmd)], @@ -928,7 +928,7 @@ $events = [ db => 'foodb', }, ]; -$ea = new EventAggregator( +$ea = EventAggregator->new( groupby => 'fingerprint', worst => 'Query_time', ); @@ -948,7 +948,7 @@ $o->get_opts(); # prepared statements subreport will reuse/reprint stuff from the # profile subreport. And the line width is 82 because that's the new # default to accommodate the EXPLAIN sparkline (issue 1141). -my $report = new ReportFormatter(line_width=>82); +my $report = ReportFormatter->new(line_width=>82); $qrf->set_report_formatter(report=>'profile', formatter=>$report); ok( no_diff( @@ -966,7 +966,7 @@ ok( "print_reports(header, query_report, profile)" ); -$report = new ReportFormatter(line_width=>82); +$report = ReportFormatter->new(line_width=>82); $qrf->set_report_formatter(report=>'profile', formatter=>$report); ok( no_diff( @@ -1009,7 +1009,7 @@ $events = [ Statement_id => 2, }, ]; -$ea = new EventAggregator( +$ea = EventAggregator->new( groupby => 'fingerprint', worst => 'Query_time', type_for => { @@ -1020,7 +1020,7 @@ foreach my $event ( @$events ) { $ea->aggregate($event); } $ea->calculate_statistical_metrics(); -$report = new ReportFormatter( +$report = ReportFormatter->new( line_width => 82, extend_right => 1, ); @@ -1055,7 +1055,7 @@ push @$events, pos_in_log => 100, ts => '091208 09:23:49.637892', }, -$ea = new EventAggregator( +$ea = EventAggregator->new( groupby => 'fingerprint', worst => 'Query_time', ); @@ -1063,7 +1063,7 @@ foreach my $event ( @$events ) { $ea->aggregate($event); } $ea->calculate_statistical_metrics(); -$report = new ReportFormatter( +$report = ReportFormatter->new( line_width => 82, extend_right => 1, ); @@ -1100,7 +1100,7 @@ SKIP: { @ARGV = qw(--explain F=/tmp/12345/my.sandbox.cnf); $o->get_opts(); - my $qrf = new QueryReportFormatter( + my $qrf = QueryReportFormatter->new( OptionParser => $o, QueryRewriter => $qr, QueryParser => $qp, @@ -1135,7 +1135,7 @@ SKIP: { ts => '091208 09:23:49.637394', }, ]; - $ea = new EventAggregator( + $ea = EventAggregator->new( groupby => 'fingerprint', worst => 'Query_time', ); @@ -1157,7 +1157,7 @@ SKIP: { "explain_sparkling() uses db" ); - $report = new ReportFormatter( + $report = ReportFormatter->new( line_width => 82, extend_right => 1, ); @@ -1222,7 +1222,7 @@ $events = [ db => 'foodb', }, ]; -$ea = new EventAggregator( +$ea = EventAggregator->new( groupby => 'fingerprint', worst => 'Query_time', ); @@ -1232,8 +1232,8 @@ foreach my $event ( @$events ) { $ea->calculate_statistical_metrics(); @ARGV = qw(); $o->get_opts(); -$report = new ReportFormatter(line_width=>82); -$qrf = new QueryReportFormatter( +$report = ReportFormatter->new(line_width=>82); +$qrf = QueryReportFormatter->new( OptionParser => $o, QueryRewriter => $qr, QueryParser => $qp, @@ -1296,7 +1296,7 @@ $events = [ pos_in_log => 0, }, ]; -$ea = new EventAggregator( +$ea = EventAggregator->new( groupby => 'fingerprint', worst => 'Query_time', ); @@ -1304,7 +1304,7 @@ foreach my $event ( @$events ) { $ea->aggregate($event); } $ea->calculate_statistical_metrics(); -$report = new ReportFormatter( +$report = ReportFormatter->new( line_width => 82, extend_right => 1, ); @@ -1347,7 +1347,7 @@ sub proc_events { } } - $ea = new EventAggregator( + $ea = EventAggregator->new( groupby => 'fingerprint', worst => 'Query_time', ); @@ -1521,7 +1521,7 @@ $events = [ Statement_id => 1, }, ]; -$ea = new EventAggregator( +$ea = EventAggregator->new( groupby => 'fingerprint', worst => 'Query_time', type_for => { @@ -1532,7 +1532,7 @@ foreach my $event ( @$events ) { $ea->aggregate($event); } $ea->calculate_statistical_metrics(); -$report = new ReportFormatter( +$report = ReportFormatter->new( line_width => 82, extend_right => 1, ); diff --git a/t/lib/QueryReview.t b/t/lib/QueryReview.t index 097cd5a8..28bcbb1e 100644 --- a/t/lib/QueryReview.t +++ b/t/lib/QueryReview.t @@ -23,8 +23,8 @@ use DSNParser; use Sandbox; use PerconaTest; -my $dp = new DSNParser(opts=>$dsn_opts); -my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp); +my $dp = DSNParser->new(opts=>$dsn_opts); +my $sb = Sandbox->new(basedir => '/tmp', DSNParser => $dp); my $dbh = $sb->get_dbh_for('master', {no_lc=>1}); if ( !$dbh ) { @@ -37,16 +37,16 @@ else { $sb->create_dbs($dbh, ['test']); $sb->load_file('master', "t/lib/samples/query_review.sql"); my $output = ""; -my $qr = new QueryRewriter(); -my $lp = new SlowLogParser; -my $q = new Quoter(); -my $tp = new TableParser(Quoter => $q); -my $du = new MySQLDump(); -my $opt_parser = new OptionParser( description => 'hi' ); +my $qr = QueryRewriter->new(); +my $lp = SlowLogParser->new; +my $q = Quoter->new(); +my $tp = TableParser->new(Quoter => $q); +my $du = MySQLDump->new(); +my $opt_parser = OptionParser->new( description => 'hi' ); my $tbl_struct = $tp->parse( $du->get_create_table($dbh, $q, 'test', 'query_review')); -my $qv = new QueryReview( +my $qv = QueryReview->new( dbh => $dbh, db_tbl => '`test`.`query_review`', tbl_struct => $tbl_struct, diff --git a/t/lib/QueryRewriter.t b/t/lib/QueryRewriter.t index c60f6dce..9e92080c 100644 --- a/t/lib/QueryRewriter.t +++ b/t/lib/QueryRewriter.t @@ -16,8 +16,8 @@ use QueryRewriter; use QueryParser; use PerconaTest; -my $qp = new QueryParser(); -my $qr = new QueryRewriter(QueryParser=>$qp); +my $qp = QueryParser->new(); +my $qr = QueryRewriter->new(QueryParser=>$qp); # ############################################################################# # strip_comments() diff --git a/t/lib/Quoter.t b/t/lib/Quoter.t index 5a8983d3..87ca9828 100644 --- a/t/lib/Quoter.t +++ b/t/lib/Quoter.t @@ -14,7 +14,7 @@ use Test::More tests => 31; use Quoter; use PerconaTest; -my $q = new Quoter; +my $q = Quoter->new; is( $q->quote('a'), diff --git a/t/lib/ReportFormatter.t b/t/lib/ReportFormatter.t index 744e85ad..6a278bf5 100644 --- a/t/lib/ReportFormatter.t +++ b/t/lib/ReportFormatter.t @@ -15,7 +15,7 @@ use Transformers; use ReportFormatter; use PerconaTest; -my $rf = new ReportFormatter(); +my $rf = ReportFormatter->new(); isa_ok($rf, 'ReportFormatter'); # ############################################################################# @@ -87,7 +87,7 @@ is( # ############################################################################# # Basic report. # ############################################################################# -$rf = new ReportFormatter(); +$rf = ReportFormatter->new(); $rf->set_title('Checksum differences'); $rf->set_columns( { @@ -119,7 +119,7 @@ is( # ############################################################################# # Header that's too wide. # ############################################################################# -$rf = new ReportFormatter(); +$rf = ReportFormatter->new(); $rf->set_columns( { name => 'We are very long header columns that are going to cause', }, { name => 'this sub to die because together we cannot fit on one line' }, @@ -132,7 +132,7 @@ is( "Full auto-fit columns to line" ); -$rf = new ReportFormatter(); +$rf = ReportFormatter->new(); $rf->set_columns( { name => 'We are very long header columns that are going to cause', @@ -152,7 +152,7 @@ is( "Two fixed percentage-width columsn" ); -$rf = new ReportFormatter(); +$rf = ReportFormatter->new(); $rf->set_columns( { name => 'header1', @@ -172,7 +172,7 @@ is( # ############################################################################# # Test that header underline respects line width. # ############################################################################# -$rf = new ReportFormatter(); +$rf = ReportFormatter->new(); $rf->set_columns( { name => 'col1' }, { name => 'col2' }, @@ -191,7 +191,7 @@ is( # ############################################################################# # Test taht header labels are always left justified. # ############################################################################# -$rf = new ReportFormatter(); +$rf = ReportFormatter->new(); $rf->set_columns( { name => 'Rank', right_justify => 1, }, { name => 'Query ID', }, @@ -215,7 +215,7 @@ is( # ############################################################################# # Respect line width. # ############################################################################# -$rf = new ReportFormatter(); +$rf = ReportFormatter->new(); $rf->set_title('Respect line width'); $rf->set_columns( { name => 'col1' }, @@ -247,7 +247,7 @@ is( # ############################################################################# # extend_right # ############################################################################# -$rf = new ReportFormatter(extend_right=>1); +$rf = ReportFormatter->new(extend_right=>1); $rf->set_title('extend_right'); $rf->set_columns( { name => 'col1' }, @@ -279,7 +279,7 @@ is( # ############################################################################# # Relvative column widths. # ############################################################################# -$rf = new ReportFormatter(); +$rf = ReportFormatter->new(); $rf->set_title('Relative col widths'); $rf->set_columns( { name => 'col1', width_pct=>'20', }, @@ -308,7 +308,7 @@ is( "Relative col widths that fit" ); -$rf = new ReportFormatter(); +$rf = ReportFormatter->new(); $rf->set_title('Relative col widths'); $rf->set_columns( { name => 'col1', width_pct=>'20', }, @@ -343,7 +343,7 @@ is( "Relative columns made smaller to fit" ); -$rf = new ReportFormatter(); +$rf = ReportFormatter->new(); $rf->set_title('Relative col widths'); $rf->set_columns( { name => 'col1', width =>'25', }, @@ -379,7 +379,7 @@ is( ); -$rf = new ReportFormatter(); +$rf = ReportFormatter->new(); $rf->set_title('Short cols'); $rf->set_columns( { name => 'I am column1', }, @@ -402,7 +402,7 @@ is( "Short columsn, blank data" ); -$rf = new ReportFormatter(); +$rf = ReportFormatter->new(); $rf->set_title('Short cols'); $rf->set_columns( { name => 'I am column1', }, @@ -421,7 +421,7 @@ is( "Short columsn, undef data" ); -$rf = new ReportFormatter(); +$rf = ReportFormatter->new(); $rf->set_title('Short cols'); $rf->set_columns( { name => 'I am column1', }, @@ -446,7 +446,7 @@ is( # ############################################################################# # Issue 1196: mk-query-digest --explain is broken # ############################################################################# -$rf = new ReportFormatter( +$rf = ReportFormatter->new( line_width => 82, long_last_column => 1, extend_right => 1, diff --git a/t/lib/Retry.t b/t/lib/Retry.t index 671c6441..a41c754f 100644 --- a/t/lib/Retry.t +++ b/t/lib/Retry.t @@ -21,7 +21,7 @@ my $tryno; my $tries; my $die; -my $rt = new Retry(); +my $rt = Retry->new(); my $try = sub { if ( $die ) { diff --git a/t/lib/RowChecksum.t b/t/lib/RowChecksum.t index 835786f8..9ba0780f 100644 --- a/t/lib/RowChecksum.t +++ b/t/lib/RowChecksum.t @@ -20,8 +20,8 @@ use OptionParser; use Sandbox; use PerconaTest; -my $dp = new DSNParser(opts=>$dsn_opts); -my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp); +my $dp = DSNParser->new(opts=>$dsn_opts); +my $sb = Sandbox->new(basedir => '/tmp', DSNParser => $dp); my $dbh = $sb->get_dbh_for('master'); if ( !$dbh ) { @@ -33,13 +33,13 @@ else { $sb->create_dbs($dbh, ['test']); -my $q = new Quoter(); -my $tp = new TableParser(Quoter => $q); -my $du = new MySQLDump(); -my $o = new OptionParser(description => 'NibbleIterator'); +my $q = Quoter->new(); +my $tp = TableParser->new(Quoter => $q); +my $du = MySQLDump->new(); +my $o = OptionParser->new(description => 'NibbleIterator'); $o->get_specs("$trunk/bin/pt-table-checksum"); -my $c = new RowChecksum( +my $c = RowChecksum->new( OptionParser => $o, Quoter => $q, ); diff --git a/t/lib/RowDiff-custom.t b/t/lib/RowDiff-custom.t index ffd83553..c69315b2 100644 --- a/t/lib/RowDiff-custom.t +++ b/t/lib/RowDiff-custom.t @@ -76,15 +76,15 @@ use TableParser; use MySQLDump; use Quoter; -my $d = new RowDiff(dbh => 1); -my $s = new MockSync(); -my $q = new Quoter(); -my $du = new MySQLDump(); -my $tp = new TableParser(Quoter => $q); -my $dp = new DSNParser(opts=>$dsn_opts); +my $d = RowDiff->new(dbh => 1); +my $s = MockSync->new(); +my $q = Quoter->new(); +my $du = MySQLDump->new(); +my $tp = TableParser->new(Quoter => $q); +my $dp = DSNParser->new(opts=>$dsn_opts); # Connect to sandbox now to make sure it's running. -my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp); +my $sb = Sandbox->new(basedir => '/tmp', DSNParser => $dp); my $master_dbh = $sb->get_dbh_for('master'); my $slave_dbh = $sb->get_dbh_for('slave1'); if ( !$master_dbh ) { @@ -108,7 +108,7 @@ my $left_sth = $master_dbh->prepare('SELECT * FROM test.issue_11'); my $right_sth = $slave_dbh->prepare('SELECT * FROM test.issue_11'); $left_sth->execute(); $right_sth->execute(); -$s = new MockSync(); +$s = MockSync->new(); $d->compare_sets( left => $left_sth, right => $right_sth, @@ -126,7 +126,7 @@ $left_sth = $master_dbh->prepare('SELECT * FROM test.issue_11'); $right_sth = $slave_dbh->prepare('SELECT * FROM test.issue_11'); $left_sth->execute(); $right_sth->execute(); -$s = new MockSync(); +$s = MockSync->new(); $d->compare_sets( left => $left_sth, right => $right_sth, @@ -149,7 +149,7 @@ $left_sth = $master_dbh->prepare('SELECT * FROM test.issue_11'); $right_sth = $slave_dbh->prepare('SELECT * FROM test.issue_11'); $left_sth->execute(); $right_sth->execute(); -$s = new MockSync(); +$s = MockSync->new(); $d->compare_sets( left => $left_sth, right => $right_sth, @@ -170,7 +170,7 @@ $left_sth = $master_dbh->prepare('SELECT * FROM test.issue_11'); $right_sth = $slave_dbh->prepare('SELECT * FROM test.issue_11'); $left_sth->execute(); $right_sth->execute(); -$s = new MockSync(); +$s = MockSync->new(); $d->compare_sets( left => $left_sth, right => $right_sth, diff --git a/t/lib/RowDiff.t b/t/lib/RowDiff.t index ea9a0254..3c8c211c 100644 --- a/t/lib/RowDiff.t +++ b/t/lib/RowDiff.t @@ -23,18 +23,18 @@ use PerconaTest; my ($d, $s); -my $q = new Quoter(); -my $du = new MySQLDump(); -my $tp = new TableParser(Quoter => $q); -my $dp = new DSNParser(opts=>$dsn_opts); +my $q = Quoter->new(); +my $du = MySQLDump->new(); +my $tp = TableParser->new(Quoter => $q); +my $dp = DSNParser->new(opts=>$dsn_opts); # Connect to sandbox now to make sure it's running. -my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp); +my $sb = Sandbox->new(basedir => '/tmp', DSNParser => $dp); my $master_dbh = $sb->get_dbh_for('master'); my $slave_dbh = $sb->get_dbh_for('slave1'); -throws_ok( sub { new RowDiff() }, qr/I need a dbh/, 'DBH required' ); -$d = new RowDiff(dbh => 1); +throws_ok( sub { RowDiff->new() }, qr/I need a dbh/, 'DBH required' ); +$d = RowDiff->new(dbh => 1); # ############################################################################# # Test key_cmp(). @@ -162,10 +162,10 @@ is( # Test compare_sets() using a mock syncer. # ############################################################################# -$s = new MockSync(); +$s = MockSync->new(); $d->compare_sets( - left_sth => new MockSth(), - right_sth => new MockSth(), + left_sth => MockSth->new(), + right_sth => MockSth->new(), syncer => $s, tbl_struct => {}, ); @@ -177,11 +177,11 @@ is_deeply( 'no rows', ); -$s = new MockSync(); +$s = MockSync->new(); $d->compare_sets( - left_sth => new MockSth( + left_sth => MockSth->new( ), - right_sth => new MockSth( + right_sth => MockSth->new( { a => 1, b => 2, c => 3 }, ), syncer => $s, @@ -196,12 +196,12 @@ is_deeply( 'right only', ); -$s = new MockSync(); +$s = MockSync->new(); $d->compare_sets( - left_sth => new MockSth( + left_sth => MockSth->new( { a => 1, b => 2, c => 3 }, ), - right_sth => new MockSth( + right_sth => MockSth->new( ), syncer => $s, tbl_struct => {}, @@ -215,12 +215,12 @@ is_deeply( 'left only', ); -$s = new MockSync(); +$s = MockSync->new(); $d->compare_sets( - left_sth => new MockSth( + left_sth => MockSth->new( { a => 1, b => 2, c => 3 }, ), - right_sth => new MockSth( + right_sth => MockSth->new( { a => 1, b => 2, c => 3 }, ), syncer => $s, @@ -235,15 +235,15 @@ is_deeply( 'one identical row', ); -$s = new MockSync(); +$s = MockSync->new(); $d->compare_sets( - left_sth => new MockSth( + left_sth => MockSth->new( { a => 1, b => 2, c => 3 }, { a => 2, b => 2, c => 3 }, { a => 3, b => 2, c => 3 }, # { a => 4, b => 2, c => 3 }, ), - right_sth => new MockSth( + right_sth => MockSth->new( # { a => 1, b => 2, c => 3 }, { a => 2, b => 2, c => 3 }, { a => 3, b => 2, c => 3 }, @@ -264,12 +264,12 @@ is_deeply( 'differences in basic set of rows', ); -$s = new MockSync(); +$s = MockSync->new(); $d->compare_sets( - left_sth => new MockSth( + left_sth => MockSth->new( { a => 1, b => 2, c => 3 }, ), - right_sth => new MockSth( + right_sth => MockSth->new( { a => 1, b => 2, c => 3 }, ), syncer => $s, @@ -287,13 +287,13 @@ is_deeply( SKIP: { skip 'Cannot connect to sandbox master', 1 unless $master_dbh; - $d = new RowDiff(dbh => $master_dbh); - $s = new MockSync(); + $d = RowDiff->new(dbh => $master_dbh); + $s = MockSync->new(); $d->compare_sets( - left_sth => new MockSth( + left_sth => MockSth->new( { a => 'A', b => 2, c => 3 }, ), - right_sth => new MockSth( + right_sth => MockSth->new( # The difference is the lowercase 'a', which in a _ci collation will # sort the same. So the rows are really identical, from MySQL's point # of view. @@ -329,8 +329,8 @@ my $key_cmp = sub { push @rows, "col $col differs"; }; -$s = new MockSync(); -$d = new RowDiff( +$s = MockSync->new(); +$d = RowDiff->new( dbh => 1, key_cmp => $key_cmp, same_row => $same_row, @@ -339,13 +339,13 @@ $d = new RowDiff( ); @rows = (); $d->compare_sets( - left_sth => new MockSth( + left_sth => MockSth->new( { a => 1, b => 2, c => 3 }, { a => 2, b => 2, c => 3 }, { a => 3, b => 2, c => 3 }, # { a => 4, b => 2, c => 3 }, ), - right_sth => new MockSth( + right_sth => MockSth->new( # { a => 1, b => 2, c => 3 }, { a => 2, b => 2, c => 3 }, { a => 3, b => 2, c => 3 }, @@ -367,7 +367,7 @@ is_deeply( ); my $i = 0; -$d = new RowDiff( +$d = RowDiff->new( dbh => 1, key_cmp => $key_cmp, same_row => $same_row, @@ -377,13 +377,13 @@ $d = new RowDiff( ); @rows = (); $d->compare_sets( - left_sth => new MockSth( + left_sth => MockSth->new( { a => 1, b => 2, c => 3 }, { a => 2, b => 2, c => 3 }, { a => 3, b => 2, c => 3 }, # { a => 4, b => 2, c => 3 }, ), - right_sth => new MockSth( + right_sth => MockSth->new( # { a => 1, b => 2, c => 3 }, { a => 2, b => 2, c => 3 }, { a => 3, b => 2, c => 3 }, @@ -403,7 +403,7 @@ is_deeply( 'done callback' ); -$d = new RowDiff( +$d = RowDiff->new( dbh => 1, key_cmp => $key_cmp, same_row => $same_row, @@ -416,11 +416,11 @@ $d = new RowDiff( ); @rows = (); $d->compare_sets( - left_sth => new MockSth( + left_sth => MockSth->new( { a => 1, b => 2, c => 3 }, { a => 4, b => 5, c => 6 }, ), - right_sth => new MockSth( + right_sth => MockSth->new( { a => 7, b => 8, c => 9 }, { a => 10, b => 11, c => 12 }, ), @@ -444,7 +444,7 @@ SKIP: { skip 'Cannot connect to sandbox master', 4 unless $master_dbh; skip 'Cannot connect to sandbox slave', 4 unless $slave_dbh; - $d = new RowDiff(dbh => $master_dbh); + $d = RowDiff->new(dbh => $master_dbh); diag(`$trunk/sandbox/mk-test-env reset >/dev/null 2>&1`); $sb->create_dbs($master_dbh, [qw(test)]); @@ -469,7 +469,7 @@ SKIP: { my $right_sth = $slave_dbh->prepare('SELECT * FROM test.issue_11'); $left_sth->execute(); $right_sth->execute(); - $s = new MockSync(); + $s = MockSync->new(); $d->compare_sets( left_sth => $left_sth, right_sth => $right_sth, @@ -487,7 +487,7 @@ SKIP: { $right_sth = $slave_dbh->prepare('SELECT * FROM test.issue_11'); $left_sth->execute(); $right_sth->execute(); - $s = new MockSync(); + $s = MockSync->new(); $d->compare_sets( left_sth => $left_sth, right_sth => $right_sth, @@ -510,7 +510,7 @@ SKIP: { $right_sth = $slave_dbh->prepare('SELECT * FROM test.issue_11'); $left_sth->execute(); $right_sth->execute(); - $s = new MockSync(); + $s = MockSync->new(); $d->compare_sets( left_sth => $left_sth, right_sth => $right_sth, @@ -531,7 +531,7 @@ SKIP: { $right_sth = $slave_dbh->prepare('SELECT * FROM test.issue_11'); $left_sth->execute(); $right_sth->execute(); - $s = new MockSync(); + $s = MockSync->new(); $d->compare_sets( left_sth => $left_sth, right_sth => $right_sth, diff --git a/t/lib/Runtime.t b/t/lib/Runtime.t index 5767803c..448b1991 100644 --- a/t/lib/Runtime.t +++ b/t/lib/Runtime.t @@ -18,7 +18,7 @@ use Runtime; # Test a runtime obj with clock time. # ############################################################################# -my $runtime = new Runtime( +my $runtime = Runtime->new( now => sub { return time; }, runtime => 3, ); @@ -89,7 +89,7 @@ is( # Test a runtime obj with clock time running forever. # ############################################################################# -$runtime = new Runtime( +$runtime = Runtime->new( now => sub { return time; }, # runtime => undef, # forever ); @@ -123,7 +123,7 @@ is( # Test start/stop with clock time. # ############################################################################# -$runtime = new Runtime( +$runtime = Runtime->new( now => sub { return time; }, runtime => 3, ); @@ -147,7 +147,7 @@ is( # ############################################################################# my @time = qw(0 3 7 9); -$runtime = new Runtime( +$runtime = Runtime->new( now => sub { return shift @time; }, runtime => 8, ); diff --git a/t/lib/SQLParser.t b/t/lib/SQLParser.t index 40443cc4..edd387e8 100644 --- a/t/lib/SQLParser.t +++ b/t/lib/SQLParser.t @@ -20,7 +20,7 @@ $Data::Dumper::Indent = 1; $Data::Dumper::Sortkeys = 1; $Data::Dumper::Quotekeys = 0; -my $sp = new SQLParser(); +my $sp = SQLParser->new(); # ############################################################################ # Should throw some errors for stuff it can't do. @@ -2304,15 +2304,15 @@ use FileIterator; use Schema; use SchemaIterator; -my $o = new OptionParser(description => 'SchemaIterator'); +my $o = OptionParser->new(description => 'SchemaIterator'); $o->get_specs("$trunk/bin/pt-table-checksum"); -my $q = new Quoter; -my $tp = new TableParser(Quoter => $q); -my $fi = new FileIterator(); +my $q = Quoter->new; +my $tp = TableParser->new(Quoter => $q); +my $fi = FileIterator->new(); my $file_itr = $fi->get_file_itr("$trunk/t/lib/samples/mysqldump-no-data/dump001.txt"); -my $schema = new Schema(); -my $schema_itr = new SchemaIterator( +my $schema = Schema->new(); +my $schema_itr = SchemaIterator->new( file_itr => $file_itr, OptionParser => $o, Quoter => $q, diff --git a/t/lib/Schema.t b/t/lib/Schema.t index 565a323b..3c6dda32 100644 --- a/t/lib/Schema.t +++ b/t/lib/Schema.t @@ -27,18 +27,18 @@ use DSNParser; my $in = "$trunk/t/lib/samples/mysqldump-no-data/"; -my $q = new Quoter; -my $tp = new TableParser(Quoter => $q); -my $fi = new FileIterator(); +my $q = Quoter->new; +my $tp = TableParser->new(Quoter => $q); +my $fi = FileIterator->new(); -my $o = new OptionParser(description => 'SchemaIterator'); +my $o = OptionParser->new(description => 'SchemaIterator'); @ARGV = qw(); $o->get_specs("$trunk/bin/pt-table-checksum"); $o->get_opts(); my $file_itr = $fi->get_file_itr("$in/dump001.txt"); -my $sq = new Schema(); -my $si = new SchemaIterator ( +my $sq = Schema->new(); +my $si = SchemaIterator->new ( file_itr => $file_itr, OptionParser => $o, Quoter => $q, diff --git a/t/lib/SchemaIterator.t b/t/lib/SchemaIterator.t index 72e9814f..73e6671f 100644 --- a/t/lib/SchemaIterator.t +++ b/t/lib/SchemaIterator.t @@ -28,14 +28,14 @@ $Data::Dumper::Indent = 1; $Data::Dumper::Sortkeys = 1; $Data::Dumper::Quotekeys = 0; -my $q = new Quoter(); -my $dp = new DSNParser(opts=>$dsn_opts); -my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp); +my $q = Quoter->new(); +my $dp = DSNParser->new(opts=>$dsn_opts); +my $sb = Sandbox->new(basedir => '/tmp', DSNParser => $dp); my $dbh = $sb->get_dbh_for('master'); my ($du, $tp); -my $fi = new FileIterator(); -my $o = new OptionParser(description => 'SchemaIterator'); +my $fi = FileIterator->new(); +my $o = OptionParser->new(description => 'SchemaIterator'); $o->get_specs("$trunk/bin/pt-table-checksum"); my $in = "$trunk/t/lib/samples/mysqldump-no-data/"; @@ -54,7 +54,7 @@ sub test_so { my $si; if ( $args{files} ) { my $file_itr = $fi->get_file_itr(@{$args{files}}); - $si = new SchemaIterator( + $si = SchemaIterator->new( file_itr => $file_itr, keep_ddl => defined $args{keep_ddl} ? $args{keep_ddl} : 1, OptionParser => $o, @@ -63,7 +63,7 @@ sub test_so { ); } else { - $si = new SchemaIterator( + $si = SchemaIterator->new( dbh => $dbh, keep_ddl => defined $args{keep_ddl} ? $args{keep_ddl} : 1, OptionParser => $o, @@ -287,7 +287,7 @@ SKIP: { # mk-index-usage does not have any of the schema filters with default # values like --engines so when we do --tables that will be the only # filter. - $o = new OptionParser(description => 'SchemaIterator'); + $o = OptionParser->new(description => 'SchemaIterator'); $o->get_specs("$trunk/bin/pt-index-usage"); test_so( @@ -312,7 +312,7 @@ SKIP: { # ######################################################################## # Getting CREATE TALBE (ddl). # ######################################################################## - $du = new MySQLDump(); + $du = MySQLDump->new(); test_so( filters => [qw(-t mysql.user)], result => $sandbox_version eq '5.1' ? "$out/mysql-user-ddl.txt" @@ -375,7 +375,7 @@ is( 'No tbl_struct without TableParser' ); -$tp = new TableParser(Quoter => $q); +$tp = TableParser->new(Quoter => $q); $objs = test_so( files => ["$in/dump001.txt"], diff --git a/t/lib/SimpleTCPDumpParser.t b/t/lib/SimpleTCPDumpParser.t index 10a1629e..52994046 100644 --- a/t/lib/SimpleTCPDumpParser.t +++ b/t/lib/SimpleTCPDumpParser.t @@ -19,7 +19,7 @@ use PerconaTest; my $in = "t/lib/samples/simple-tcpdump/"; -my $p = new SimpleTCPDumpParser(watch => ':3306'); +my $p = SimpleTCPDumpParser->new(watch => ':3306'); # Check that I can parse a log in the default format. test_log_parser( diff --git a/t/lib/SlowLogParser.t b/t/lib/SlowLogParser.t index ce58e7ed..14649b13 100644 --- a/t/lib/SlowLogParser.t +++ b/t/lib/SlowLogParser.t @@ -14,7 +14,7 @@ use Test::More tests => 48; use SlowLogParser; use PerconaTest; -my $p = new SlowLogParser; +my $p = SlowLogParser->new; my $sample = "t/lib/samples/slowlogs/"; # Check that I can parse a slow log in the default slow log format. @@ -653,7 +653,7 @@ test_log_parser( ], ); -$p = new SlowLogParser; +$p = SlowLogParser->new; # Parses commented event lines after uncommented meta-lines test_log_parser( diff --git a/t/lib/SlowLogWriter.t b/t/lib/SlowLogWriter.t index d5910d81..edbaf04b 100644 --- a/t/lib/SlowLogWriter.t +++ b/t/lib/SlowLogWriter.t @@ -15,8 +15,8 @@ use SlowLogParser; use SlowLogWriter; use PerconaTest; -my $p = new SlowLogParser; -my $w = new SlowLogWriter; +my $p = SlowLogParser->new; +my $w = SlowLogWriter->new; sub __no_diff { my ( $filename, $expected ) = @_; diff --git a/t/lib/SysLogParser.t b/t/lib/SysLogParser.t index 612739f6..626e685b 100644 --- a/t/lib/SysLogParser.t +++ b/t/lib/SysLogParser.t @@ -14,7 +14,7 @@ use Test::More tests => 26; use SysLogParser; use PerconaTest; -my $p = new SysLogParser; +my $p = SysLogParser->new; # The final line is broken across two lines in the actual log, but it's one # logical event. diff --git a/t/lib/TCPRequestAggregator.t b/t/lib/TCPRequestAggregator.t index 6402b67d..087dd2e2 100644 --- a/t/lib/TCPRequestAggregator.t +++ b/t/lib/TCPRequestAggregator.t @@ -18,7 +18,7 @@ my $in = "t/lib/samples/simple-tcprequests/"; my $p; # Check that I can parse a simple log and aggregate it into 100ths of a second -$p = new TCPRequestAggregator(interval => '.01', quantile => '.99'); +$p = TCPRequestAggregator->new(interval => '.01', quantile => '.99'); # intervals. test_log_parser( parser => $p, @@ -68,7 +68,7 @@ test_log_parser( # Check that I can parse a log whose first event is ID = 0, and whose events all # fit within one time interval. -$p = new TCPRequestAggregator(interval => '.01', quantile => '.99'); +$p = TCPRequestAggregator->new(interval => '.01', quantile => '.99'); test_log_parser( parser => $p, file => "$in/simpletcp-requests002.txt", diff --git a/t/lib/TableChecksum.t b/t/lib/TableChecksum.t index 5e912b89..795a162d 100644 --- a/t/lib/TableChecksum.t +++ b/t/lib/TableChecksum.t @@ -20,8 +20,8 @@ use DSNParser; use Sandbox; use PerconaTest; -my $dp = new DSNParser(opts=>$dsn_opts); -my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp); +my $dp = DSNParser->new(opts=>$dsn_opts); +my $sb = Sandbox->new(basedir => '/tmp', DSNParser => $dp); my $dbh = $sb->get_dbh_for('master'); if ( !$dbh ) { @@ -33,11 +33,11 @@ else { $sb->create_dbs($dbh, ['test']); -my $q = new Quoter(); -my $tp = new TableParser(Quoter => $q); -my $vp = new VersionParser(); -my $du = new MySQLDump(); -my $c = new TableChecksum(Quoter=>$q, VersionParser=>$vp); +my $q = Quoter->new(); +my $tp = TableParser->new(Quoter => $q); +my $vp = VersionParser->new(); +my $du = MySQLDump->new(); +my $c = TableChecksum->new(Quoter=>$q, VersionParser=>$vp); my $t; diff --git a/t/lib/TableChunker.t b/t/lib/TableChunker.t index 1b5934ff..9c13cda6 100644 --- a/t/lib/TableChunker.t +++ b/t/lib/TableChunker.t @@ -19,8 +19,8 @@ use DSNParser; use Sandbox; use PerconaTest; -my $dp = new DSNParser(opts=>$dsn_opts); -my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp); +my $dp = DSNParser->new(opts=>$dsn_opts); +my $sb = Sandbox->new(basedir => '/tmp', DSNParser => $dp); my $dbh = $sb->get_dbh_for('master'); if ( !$dbh ) { @@ -32,10 +32,10 @@ else { $sb->create_dbs($dbh, ['test']); -my $q = new Quoter(); -my $p = new TableParser(Quoter => $q); -my $du = new MySQLDump(); -my $c = new TableChunker(Quoter => $q, MySQLDump => $du); +my $q = Quoter->new(); +my $p = TableParser->new(Quoter => $q); +my $du = MySQLDump->new(); +my $c = TableChunker->new(Quoter => $q, MySQLDump => $du); my $t; $t = $p->parse( load_file('t/lib/samples/sakila.film.sql') ); diff --git a/t/lib/TableNibbler.t b/t/lib/TableNibbler.t index 670c1da1..34192a07 100644 --- a/t/lib/TableNibbler.t +++ b/t/lib/TableNibbler.t @@ -16,9 +16,9 @@ use TableNibbler; use Quoter; use PerconaTest; -my $q = new Quoter(); -my $tp = new TableParser(Quoter => $q); -my $n = new TableNibbler( +my $q = Quoter->new(); +my $tp = TableParser->new(Quoter => $q); +my $n = TableNibbler->new( TableParser => $tp, Quoter => $q, ); diff --git a/t/lib/TableParser.t b/t/lib/TableParser.t index 984e24f5..768c5713 100644 --- a/t/lib/TableParser.t +++ b/t/lib/TableParser.t @@ -17,11 +17,11 @@ use DSNParser; use Sandbox; use PerconaTest; -my $dp = new DSNParser(opts=>$dsn_opts); -my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp); +my $dp = DSNParser->new(opts=>$dsn_opts); +my $sb = Sandbox->new(basedir => '/tmp', DSNParser => $dp); my $dbh = $sb->get_dbh_for('master'); -my $q = new Quoter(); -my $tp = new TableParser(Quoter=>$q); +my $q = Quoter->new(); +my $tp = TableParser->new(Quoter=>$q); my $tbl; my $sample = "t/lib/samples/tables/"; diff --git a/t/lib/TableSyncChunk.t b/t/lib/TableSyncChunk.t index 5d9aa49a..9897be37 100644 --- a/t/lib/TableSyncChunk.t +++ b/t/lib/TableSyncChunk.t @@ -16,8 +16,8 @@ use DSNParser; use Sandbox; use PerconaTest; -my $dp = new DSNParser(opts=>$dsn_opts); -my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp); +my $dp = DSNParser->new(opts=>$dsn_opts); +my $sb = Sandbox->new(basedir => '/tmp', DSNParser => $dp); my $dbh = $sb->get_dbh_for('master'); if ( $dbh ) { @@ -45,15 +45,15 @@ my $mysql = $sb->_use_for('master'); diag(`$mysql < $trunk/t/lib/samples/before-TableSyncChunk.sql`); -my $q = new Quoter(); -my $tp = new TableParser(Quoter => $q); -my $du = new MySQLDump(); -my $vp = new VersionParser(); -my $ms = new MasterSlave(); -my $rr = new Retry(); -my $chunker = new TableChunker( Quoter => $q, MySQLDump => $du ); -my $checksum = new TableChecksum( Quoter => $q, VersionParser => $vp ); -my $syncer = new TableSyncer( +my $q = Quoter->new(); +my $tp = TableParser->new(Quoter => $q); +my $du = MySQLDump->new(); +my $vp = VersionParser->new(); +my $ms = MasterSlave->new(); +my $rr = Retry->new(); +my $chunker = TableChunker->new( Quoter => $q, MySQLDump => $du ); +my $checksum = TableChecksum->new( Quoter => $q, VersionParser => $vp ); +my $syncer = TableSyncer->new( MasterSlave => $ms, TableChecksum => $checksum, Quoter => $q, @@ -76,8 +76,8 @@ my $dst = { dbh => $dbh, }; -my $ch = new ChangeHandler( - Quoter => new Quoter(), +my $ch = ChangeHandler->new( + Quoter => Quoter->new(), right_db => 'test', right_tbl => 'test1', left_db => 'test', @@ -87,7 +87,7 @@ my $ch = new ChangeHandler( queue => 0, ); -my $t = new TableSyncChunk( +my $t = TableSyncChunk->new( TableChunker => $chunker, Quoter => $q, ); diff --git a/t/lib/TableSyncGroupBy.t b/t/lib/TableSyncGroupBy.t index 408ec028..d8ab55f8 100644 --- a/t/lib/TableSyncGroupBy.t +++ b/t/lib/TableSyncGroupBy.t @@ -18,20 +18,20 @@ use RowDiff; use ChangeHandler; use PerconaTest; -my $q = new Quoter(); +my $q = Quoter->new(); my $tbl_struct = { is_col => {} }; # fake tbl_struct my @rows; throws_ok( - sub { new TableSyncGroupBy() }, + sub { TableSyncGroupBy->new() }, qr/I need a Quoter/, 'Quoter required' ); -my $t = new TableSyncGroupBy( +my $t = TableSyncGroupBy->new( Quoter => $q, ); -my $ch = new ChangeHandler( +my $ch = ChangeHandler->new( Quoter => $q, right_db => 'test', right_tbl => 'foo', @@ -78,15 +78,15 @@ is( # Changed from undef to 0 due to r4802. is( $t->done, 0, 'Not done yet' ); -my $d = new RowDiff( dbh => 1 ); +my $d = RowDiff->new( dbh => 1 ); $d->compare_sets( - left_sth => new MockSth( + left_sth => MockSth->new( { a => 1, b => 2, c => 3, __maatkit_count => 4 }, { a => 2, b => 2, c => 3, __maatkit_count => 4 }, { a => 3, b => 2, c => 3, __maatkit_count => 2 }, # { a => 4, b => 2, c => 3, __maatkit_count => 2 }, ), - right_sth => new MockSth( + right_sth => MockSth->new( { a => 1, b => 2, c => 3, __maatkit_count => 3 }, { a => 2, b => 2, c => 3, __maatkit_count => 6 }, # { a => 3, b => 2, c => 3, __maatkit_count => 2 }, diff --git a/t/lib/TableSyncNibble.t b/t/lib/TableSyncNibble.t index 764c3959..156ad04d 100644 --- a/t/lib/TableSyncNibble.t +++ b/t/lib/TableSyncNibble.t @@ -27,8 +27,8 @@ use Retry; use TableSyncer; use PerconaTest; -my $dp = new DSNParser(opts=>$dsn_opts); -my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp); +my $dp = DSNParser->new(opts=>$dsn_opts); +my $sb = Sandbox->new(basedir => '/tmp', DSNParser => $dp); my $dbh = $sb->get_dbh_for('master'); if ( !$dbh ) { @@ -40,26 +40,26 @@ else { my $mysql = $sb->_use_for('master'); -my $q = new Quoter(); -my $ms = new MasterSlave(); -my $tp = new TableParser(Quoter=>$q); -my $du = new MySQLDump(); -my $vp = new VersionParser(); -my $rr = new Retry(); +my $q = Quoter->new(); +my $ms = MasterSlave->new(); +my $tp = TableParser->new(Quoter=>$q); +my $du = MySQLDump->new(); +my $vp = VersionParser->new(); +my $rr = Retry->new(); -my $nibbler = new TableNibbler( +my $nibbler = TableNibbler->new( TableParser => $tp, Quoter => $q, ); -my $checksum = new TableChecksum( +my $checksum = TableChecksum->new( Quoter => $q, VersionParser => $vp, ); -my $chunker = new TableChunker( +my $chunker = TableChunker->new( MySQLDump => $du, Quoter => $q ); -my $t = new TableSyncNibble( +my $t = TableSyncNibble->new( TableNibbler => $nibbler, TableParser => $tp, TableChunker => $chunker, @@ -68,7 +68,7 @@ my $t = new TableSyncNibble( ); my @rows; -my $ch = new ChangeHandler( +my $ch = ChangeHandler->new( Quoter => $q, right_db => 'test', right_tbl => 'test1', @@ -79,7 +79,7 @@ my $ch = new ChangeHandler( queue => 0, ); -my $syncer = new TableSyncer( +my $syncer = TableSyncer->new( MasterSlave => $ms, TableChecksum => $checksum, Quoter => $q, diff --git a/t/lib/TableSyncStream.t b/t/lib/TableSyncStream.t index 4c06d7e5..d770003b 100644 --- a/t/lib/TableSyncStream.t +++ b/t/lib/TableSyncStream.t @@ -18,19 +18,19 @@ use RowDiff; use ChangeHandler; use PerconaTest; -my $q = new Quoter(); +my $q = Quoter->new(); my @rows; throws_ok( - sub { new TableSyncStream() }, + sub { TableSyncStream->new() }, qr/I need a Quoter/, 'Quoter required' ); -my $t = new TableSyncStream( +my $t = TableSyncStream->new( Quoter => $q, ); -my $ch = new ChangeHandler( +my $ch = ChangeHandler->new( Quoter => $q, right_db => 'test', right_tbl => 'foo', @@ -74,15 +74,15 @@ is( # Changed from undef to 0 due to r4802. is( $t->done, 0, 'Not done yet' ); -my $d = new RowDiff( dbh => 1 ); +my $d = RowDiff->new( dbh => 1 ); $d->compare_sets( - left_sth => new MockSth( + left_sth => MockSth->new( { a => 1, b => 2, c => 3 }, { a => 2, b => 2, c => 3 }, { a => 3, b => 2, c => 3 }, # { a => 4, b => 2, c => 3 }, ), - right_sth => new MockSth( + right_sth => MockSth->new( # { a => 1, b => 2, c => 3 }, { a => 2, b => 2, c => 3 }, { a => 3, b => 2, c => 3 }, diff --git a/t/lib/TableSyncer.t b/t/lib/TableSyncer.t index 63d3295d..4f9a90a5 100644 --- a/t/lib/TableSyncer.t +++ b/t/lib/TableSyncer.t @@ -38,8 +38,8 @@ use PerconaTest; use constant MKDEBUG => $ENV{MKDEBUG} || 0; -my $dp = new DSNParser(opts=>$dsn_opts); -my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp); +my $dp = DSNParser->new(opts=>$dsn_opts); +my $sb = Sandbox->new(basedir => '/tmp', DSNParser => $dp); my $dbh = $sb->get_dbh_for('master'); my $src_dbh = $sb->get_dbh_for('master'); my $dst_dbh = $sb->get_dbh_for('slave1'); @@ -57,43 +57,43 @@ else { $sb->create_dbs($dbh, ['test']); $sb->load_file('master', 't/lib/samples/before-TableSyncChunk.sql'); -my $q = new Quoter(); -my $tp = new TableParser(Quoter=>$q); -my $du = new MySQLDump( cache => 0 ); +my $q = Quoter->new(); +my $tp = TableParser->new(Quoter=>$q); +my $du = MySQLDump->new( cache => 0 ); # ########################################################################### # Make a TableSyncer object. # ########################################################################### throws_ok( - sub { new TableSyncer() }, + sub { TableSyncer->new() }, qr/I need a MasterSlave/, 'MasterSlave required' ); throws_ok( - sub { new TableSyncer(MasterSlave=>1) }, + sub { TableSyncer->new(MasterSlave=>1) }, qr/I need a Quoter/, 'Quoter required' ); throws_ok( - sub { new TableSyncer(MasterSlave=>1, Quoter=>1) }, + sub { TableSyncer->new(MasterSlave=>1, Quoter=>1) }, qr/I need a VersionParser/, 'VersionParser required' ); throws_ok( - sub { new TableSyncer(MasterSlave=>1, Quoter=>1, VersionParser=>1) }, + sub { TableSyncer->new(MasterSlave=>1, Quoter=>1, VersionParser=>1) }, qr/I need a TableChecksum/, 'TableChecksum required' ); -my $rd = new RowDiff(dbh=>$src_dbh); -my $ms = new MasterSlave(); -my $vp = new VersionParser(); -my $rt = new Retry(); -my $checksum = new TableChecksum( +my $rd = RowDiff->new(dbh=>$src_dbh); +my $ms = MasterSlave->new(); +my $vp = VersionParser->new(); +my $rt = Retry->new(); +my $checksum = TableChecksum->new( Quoter => $q, VersionParser => $vp, ); -my $syncer = new TableSyncer( +my $syncer = TableSyncer->new( MasterSlave => $ms, Quoter => $q, TableChecksum => $checksum, @@ -103,8 +103,8 @@ my $syncer = new TableSyncer( ); isa_ok($syncer, 'TableSyncer'); -my $chunker = new TableChunker( Quoter => $q, MySQLDump => $du ); -my $nibbler = new TableNibbler( TableParser => $tp, Quoter => $q ); +my $chunker = TableChunker->new( Quoter => $q, MySQLDump => $du ); +my $nibbler = TableNibbler->new( TableParser => $tp, Quoter => $q ); # Global vars used/set by the subs below and accessed throughout the tests. my $src; @@ -117,18 +117,18 @@ my $plugins = []; # Call this func to re-make/reset the plugins. sub make_plugins { - $sync_chunk = new TableSyncChunk( + $sync_chunk = TableSyncChunk->new( TableChunker => $chunker, Quoter => $q, ); - $sync_nibble = new TableSyncNibble( + $sync_nibble = TableSyncNibble->new( TableNibbler => $nibbler, TableChunker => $chunker, TableParser => $tp, Quoter => $q, ); - $sync_groupby = new TableSyncGroupBy( Quoter => $q ); - $sync_stream = new TableSyncStream( Quoter => $q ); + $sync_groupby = TableSyncGroupBy->new( Quoter => $q ); + $sync_stream = TableSyncStream->new( Quoter => $q ); $plugins = [$sync_chunk, $sync_nibble, $sync_groupby, $sync_stream]; @@ -137,7 +137,7 @@ sub make_plugins { sub new_ch { my ( $dbh, $queue ) = @_; - return new ChangeHandler( + return ChangeHandler->new( Quoter => $q, left_db => $src->{db}, left_tbl => $src->{tbl}, diff --git a/t/lib/TcpdumpParser.t b/t/lib/TcpdumpParser.t index 304b30ea..a0a1b378 100644 --- a/t/lib/TcpdumpParser.t +++ b/t/lib/TcpdumpParser.t @@ -15,7 +15,7 @@ use TcpdumpParser; use PerconaTest; my $sample = "t/lib/samples/tcpdump/"; -my $p = new TcpdumpParser(); +my $p = TcpdumpParser->new(); # First, parse the TCP and IP packet... my $contents = <new(); isa_ok($r, 'TextResultSetParser'); throws_ok( @@ -153,7 +153,7 @@ is( # ############################################################################# # Parse with NAME_lc for lowercase key/col names. # ############################################################################# -$r = new TextResultSetParser(NAME_lc => 1); +$r = TextResultSetParser->new(NAME_lc => 1); $recset = $r->parse(load_file('t/lib/samples/show-variables/vars001.txt')); $got_var = grep { $_->{variable_name} eq 'warning_count' } @$recset; diff --git a/t/lib/TimeSeriesTrender.t b/t/lib/TimeSeriesTrender.t index 605c9380..35f51a71 100644 --- a/t/lib/TimeSeriesTrender.t +++ b/t/lib/TimeSeriesTrender.t @@ -15,7 +15,7 @@ use TimeSeriesTrender; use PerconaTest; my $result; -my $tst = new TimeSeriesTrender( +my $tst = TimeSeriesTrender->new( callback => sub { $result = $_[0]; }, ); diff --git a/t/lib/Transformers.t b/t/lib/Transformers.t index 30a1f81b..d9ce408c 100644 --- a/t/lib/Transformers.t +++ b/t/lib/Transformers.t @@ -164,8 +164,8 @@ is( use DSNParser; use Sandbox; -my $dp = new DSNParser(opts=>$dsn_opts); -my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp); +my $dp = DSNParser->new(opts=>$dsn_opts); +my $sb = Sandbox->new(basedir => '/tmp', DSNParser => $dp); my $dbh = $sb->get_dbh_for('master'); SKIP: { skip 'Cannot connect to sandbox master', 1 unless $dbh; diff --git a/t/lib/UpgradeReportFormatter.t b/t/lib/UpgradeReportFormatter.t index dbffc497..469b3e24 100644 --- a/t/lib/UpgradeReportFormatter.t +++ b/t/lib/UpgradeReportFormatter.t @@ -22,8 +22,8 @@ my $result; my $expected; my ($meta_events, $events1, $events2, $meta_ea, $ea1, $ea2); -my $qr = new QueryRewriter(); -my $urf = new UpgradeReportFormatter(); +my $qr = QueryRewriter->new(); +my $urf = UpgradeReportFormatter->new(); sub aggregate { foreach my $event (@$meta_events) { @@ -42,15 +42,15 @@ sub aggregate { $ea2->calculate_statistical_metrics(); } -$meta_ea = new EventAggregator( +$meta_ea = EventAggregator->new( groupby => 'fingerprint', worst => 'differences', ); -$ea1 = new EventAggregator( +$ea1 = EventAggregator->new( groupby => 'fingerprint', worst => 'Query_time', ); -$ea2 = new EventAggregator( +$ea2 = EventAggregator->new( groupby => 'fingerprint', worst => 'Query_time', ); diff --git a/t/lib/VariableAdvisorRules.t b/t/lib/VariableAdvisorRules.t index 4147ef78..c97d587d 100644 --- a/t/lib/VariableAdvisorRules.t +++ b/t/lib/VariableAdvisorRules.t @@ -17,8 +17,8 @@ use VariableAdvisorRules; use Advisor; use PerconaTest; -my $p = new PodParser(); -my $var = new VariableAdvisorRules(PodParser => $p); +my $p = PodParser->new(); +my $var = VariableAdvisorRules->new(PodParser => $p); isa_ok($var, 'VariableAdvisorRules'); @@ -357,7 +357,7 @@ my @cases = ( ); -my $adv = new Advisor(match_type => "bool"); +my $adv = Advisor->new(match_type => "bool"); $adv->load_rules($var); foreach my $test ( @cases ) { diff --git a/t/lib/VersionParser.t b/t/lib/VersionParser.t index f54f0556..de64f46f 100644 --- a/t/lib/VersionParser.t +++ b/t/lib/VersionParser.t @@ -14,7 +14,7 @@ use Test::More tests => 3; use VersionParser; use PerconaTest; -my $vp = new VersionParser; +my $vp = VersionParser->new; is( $vp->parse('5.0.38-Ubuntu_0ubuntu1.1-log'), @@ -25,8 +25,8 @@ is( # Open a connection to MySQL, or skip the rest of the tests. use DSNParser; use Sandbox; -my $dp = new DSNParser(opts=>$dsn_opts); -my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp); +my $dp = DSNParser->new(opts=>$dsn_opts); +my $sb = Sandbox->new(basedir => '/tmp', DSNParser => $dp); my $dbh = $sb->get_dbh_for('master'); SKIP: { skip 'Cannot connect to MySQL', 2 unless $dbh;