Enclose all packages blocks and add Package devel docu.

This commit is contained in:
Daniel Nichter
2011-06-28 17:50:02 -06:00
parent b4b6376be1
commit 82931ec399
35 changed files with 142 additions and 106 deletions

View File

@@ -26,7 +26,7 @@ our $DISTRIB = '@DISTRIB@';
our $SVN_REV = sprintf("%d", (q$Revision: 7531 $ =~ m/(\d+)/g, 0));
# ###########################################################################
# OptionParser package 7102
# OptionParser package (revision 7102)
# This package is a copy without comments from the original. The original
# with comments and its test file can be found in the SVN repository at,
# trunk/common/OptionParser.pm
@@ -3500,7 +3500,7 @@ sub _d {
# Check at the end of this package for the call to main() which actually runs
# the program.
# ###########################################################################
package mk_archiver;
package pt_archiver;
use English qw(-no_match_vars);
use List::Util qw(max);

View File

@@ -14,7 +14,6 @@
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place, Suite 330, Boston, MA 02111-1307 USA.
# ###########################################################################
# EventTimeline package $Revision: 6590 $
# ###########################################################################

View File

@@ -17,27 +17,27 @@
# ###########################################################################
# MemcachedEvent package $Revision: 7096 $
# ###########################################################################
package MemcachedEvent;
# This package creates events suitable for mk-query-digest
# from psuedo-events created by MemcachedProtocolParser.
# Package: MemcachedEvent
# MemcachedEvent creates events from <MemcachedProtocolParser> data.
# Since memcached is not strictly MySQL stuff, we have to
# fabricate MySQL-like query events from memcached.
#
# See http://code.sixapart.com/svn/memcached/trunk/server/doc/protocol.txt
# for information about the memcached protocol.
{
package MemcachedEvent;
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use constant MKDEBUG => $ENV{MKDEBUG} || 0;
use Data::Dumper;
$Data::Dumper::Indent = 1;
$Data::Dumper::Sortkeys = 1;
$Data::Dumper::Quotekeys = 0;
use constant MKDEBUG => $ENV{MKDEBUG} || 0;
# cmds that we know how to handle.
my %cmds = map { $_ => 1 } qw(
set
@@ -211,7 +211,7 @@ sub _d {
}
1;
}
# ###########################################################################
# End MemcachedEvent package
# ###########################################################################

View File

@@ -17,6 +17,10 @@
# ###########################################################################
# MemcachedProtocolParser package $Revision: 7521 $
# ###########################################################################
# Package: MemcachedProtocolParser
# MemcachedProtocolParser parses memcached events from tcpdump files.
{
package MemcachedProtocolParser;
use strict;
@@ -415,7 +419,7 @@ sub timestamp_diff {
}
1;
}
# ###########################################################################
# End MemcachedProtocolParser package
# ###########################################################################

View File

@@ -15,15 +15,15 @@
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place, Suite 330, Boston, MA 02111-1307 USA.
# ###########################################################################
# MockSth package $Revision: 5266 $
# ###########################################################################
# Package: MockSth
# MockSth simulates a DBI statement handle without a database connection.
{
package MockSth;
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use constant MKDEBUG => $ENV{MKDEBUG} || 0;
sub new {
@@ -79,7 +79,4 @@ sub _d {
}
1;
# ###########################################################################
# End MockSth package
# ###########################################################################
}

View File

@@ -16,11 +16,15 @@
# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place, Suite 330, Boston, MA 02111-1307 USA.
# A package to mock up a syncer. Used by RowDiff.t.
# Package: MockSync
# MockSync simulates a table syncer module. It's used by RowDiff.t.
{
package MockSync;
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use constant MKDEBUG => $ENV{MKDEBUG} || 0;
sub new {
return bless [], shift;
@@ -52,3 +56,4 @@ sub key_cols {
}
1;
}

View File

@@ -14,23 +14,20 @@
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place, Suite 330, Boston, MA 02111-1307 USA.
# ###########################################################################
# MockSyncStream package $Revision: 5697 $
# ###########################################################################
package MockSyncStream;
# This package implements a special, mock version of TableSyncStream.
# Package: MockSyncStream
# MockSyncStream simulates a <TableSyncStream> module.
# It's used by mk-upgrade to quickly compare result sets for any differences.
# If any are found, mk-upgrade writes all remaining rows to an outfile.
# This causes RowDiff::compare_sets() to terminate early. So we don't actually
# sync anything. Unlike TableSyncStream, we're not working with a table but an
# arbitrary query executed on two servers.
{
package MockSyncStream;
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use constant MKDEBUG => $ENV{MKDEBUG} || 0;
sub new {
@@ -146,7 +143,4 @@ sub _d {
}
1;
# ###########################################################################
# End MockSyncStream package
# ###########################################################################
}

View File

@@ -33,13 +33,12 @@
#
# Only variables present in the input are saved in the MySQLConfig object.
# So if <has()> returns false, then the variable did not appear in the input.
{
package MySQLConfig;
{ # package scope
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use constant MKDEBUG => $ENV{MKDEBUG} || 0;
my %can_be_duplicate = (
@@ -531,9 +530,8 @@ sub _d {
print STDERR "# $package:$line $PID ", join(' ', @_), "\n";
}
} # package scope
1;
}
# ###########################################################################
# End MySQLConfig package
# ###########################################################################

View File

@@ -20,17 +20,12 @@
# Package: MySQLConfigComparer
# MySQLConfigComparer compares and diffs C<MySQLConfig> objects.
{
package MySQLConfigComparer;
{ # package scope
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Data::Dumper;
$Data::Dumper::Indent = 1;
$Data::Dumper::Sortkeys = 1;
$Data::Dumper::Quotekeys = 0;
use constant MKDEBUG => $ENV{MKDEBUG} || 0;
# Alternate values because a config file can have var=ON and then be shown
@@ -330,9 +325,8 @@ sub _d {
print STDERR "# $package:$line $PID ", join(' ', @_), "\n";
}
} # package scope
1;
}
# ###########################################################################
# End MySQLConfigComparer package
# ###########################################################################

View File

@@ -18,13 +18,15 @@
# ###########################################################################
# MySQLDump package $Revision: 6345 $
# ###########################################################################
# Package: MySQLDump
# MySQLDump gets CREATE TABLE defs from MySQL.
{
package MySQLDump;
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use constant MKDEBUG => $ENV{MKDEBUG} || 0;
( our $before = <<'EOF') =~ s/^ //gm;
@@ -316,7 +318,7 @@ sub _d {
}
1;
}
# ###########################################################################
# End MySQLDump package
# ###########################################################################

View File

@@ -17,9 +17,9 @@
# ###########################################################################
# MySQLProtocolParser package $Revision: 7522 $
# ###########################################################################
package MySQLProtocolParser;
# This creates events suitable for mk-query-digest from raw MySQL packets.
# Package: MySQLProtocolParser
# MySQLProtocolParser parses MySQL events from tcpdump files.
# The packets come from TcpdumpParser. MySQLProtocolParse::parse_packet()
# should be first in the callback chain because it creates events for
# subsequent callbacks. So the sequence is:
@@ -34,10 +34,13 @@ package MySQLProtocolParser;
# At times MySQLProtocolParser::parse_packet() will not return an event
# because it usually takes a few packets to create one event. In such
# cases, TcpdumpParser::parse_event() will not call the other callbacks.
{
package MySQLProtocolParser;
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use constant MKDEBUG => $ENV{MKDEBUG} || 0;
eval {
require IO::Uncompress::Inflate;
@@ -63,7 +66,6 @@ our @EXPORT_OK = qw(
parse_flags
);
use constant MKDEBUG => $ENV{MKDEBUG} || 0;
use constant {
COM_SLEEP => '00',
COM_QUIT => '01',
@@ -1552,7 +1554,7 @@ sub _d {
}
1;
}
# ###########################################################################
# End MySQLProtocolParser package
# ###########################################################################

View File

@@ -21,6 +21,7 @@
# Package: OSCCaptureSync
# OSCCaptureSync implements the capture and sync phases of an online schema
# change.
{
package OSCCaptureSync;
use strict;
@@ -132,7 +133,7 @@ sub _d {
}
1;
}
# ###########################################################################
# End OSCCaptureSync package
# ###########################################################################

View File

@@ -58,14 +58,15 @@
# The option's full name is given as the "=item". The next, optional para
# is the option's attributes. And the next, required para is the option's
# description (the first period-terminated sentence).
{
package OptionParser;
use strict;
use warnings FATAL => 'all';
use List::Util qw(max);
use English qw(-no_match_vars);
use constant MKDEBUG => $ENV{MKDEBUG} || 0;
use List::Util qw(max);
use Getopt::Long;
my $POD_link_re = '[LC]<"?([^">]+)"?>';
@@ -1337,7 +1338,7 @@ sub _d {
}
1;
}
# ###########################################################################
# End OptionParser package
# ###########################################################################

View File

@@ -17,14 +17,15 @@
# ###########################################################################
# Outfile package $Revision: 5266 $
# ###########################################################################
# Package: Outfile
# Outfile writes rows to a file in SELECT INTO OUTFILE format.
{
package Outfile;
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use List::Util qw(min);
use constant MKDEBUG => $ENV{MKDEBUG} || 0;
sub new {
@@ -64,6 +65,7 @@ sub _d {
}
1;
}
# ###########################################################################
# End Outfile package
# ###########################################################################

View File

@@ -18,15 +18,22 @@
# ###########################################################################
# PgLogParser package $Revision: 5835 $
# ###########################################################################
# Package: PgLogParser
# PgLogParser parses Postgres logs.
{
package PgLogParser;
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Data::Dumper;
use constant MKDEBUG => $ENV{MKDEBUG} || 0;
use Data::Dumper;
$Data::Dumper::Indent = 1;
$Data::Dumper::Sortkeys = 1;
$Data::Dumper::Quotekeys = 0;
# This regex is partially inspired by one from pgfouine. But there is no
# documentation on the last capture in that regex, so I omit that. (TODO: that
# actually seems to be for CSV logging.)
@@ -658,7 +665,7 @@ sub _d {
}
1;
}
# ###########################################################################
# End PgLogParser package
# ###########################################################################

View File

@@ -20,6 +20,7 @@
# Package: Pipeline
# Pipeline executes and controls a list of pipeline processes.
{
package Pipeline;
use strict;
@@ -194,7 +195,7 @@ sub _d {
}
1;
}
# ###########################################################################
# End Pipeline package
# ###########################################################################

View File

@@ -17,16 +17,18 @@
# ###########################################################################
# PodParser package $Revision: 7053 $
# ###########################################################################
package PodParser;
# Package: PodParser
# PodParser parses sections of a POD.
# This package wants to subclasses Pod::Parser but because some people
# still run ancient systems on which even "core" modules are missing,
# we have to roll our own pod parser.
{
package PodParser;
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use constant MKDEBUG => $ENV{MKDEBUG} || 0;
# List =item from these head1 sections will be parsed into a hash
@@ -222,7 +224,7 @@ sub _d {
}
1;
}
# ###########################################################################
# End PodParser package
# ###########################################################################

View File

@@ -21,6 +21,7 @@
# Package: Processlist
# Processlist makes events when used to poll SHOW FULL PROCESSLIST.
{
package Processlist;
use strict;
@@ -571,7 +572,7 @@ sub _d {
}
1;
}
# ###########################################################################
# End Processlist package
# ###########################################################################

View File

@@ -17,12 +17,15 @@
# ###########################################################################
# ProcesslistAggregator package $Revision: 6590 $
# ###########################################################################
# Package: ProcesslistAggregator
# ProcesslistAggregator aggregates PROCESSLIST entires.
{
package ProcesslistAggregator;
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use constant MKDEBUG => $ENV{MKDEBUG} || 0;
sub new {
@@ -76,7 +79,7 @@ sub _d {
}
1;
}
# ###########################################################################
# End ProcesslistAggregator package
# ###########################################################################

View File

@@ -17,17 +17,15 @@
# ###########################################################################
# Progress package $Revision: 7096 $
# ###########################################################################
# Package: Progress
# Progress encapsulates a progress report.
{
package Progress;
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Data::Dumper;
$Data::Dumper::Indent = 1;
$Data::Dumper::Sortkeys = 1;
$Data::Dumper::Quotekeys = 0;
use constant MKDEBUG => $ENV{MKDEBUG} || 0;
# This module encapsulates a progress report. To create a new object, pass in
@@ -203,7 +201,7 @@ sub _d {
}
1;
}
# ###########################################################################
# End Progress package
# ###########################################################################

View File

@@ -17,11 +17,16 @@
# ###########################################################################
# ProtocolParser package $Revision: 7522 $
# ###########################################################################
# Package: ProtocolParser
# ProtocolParser is a parent class for protocol-specific parsers.
{
package ProtocolParser;
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use constant MKDEBUG => $ENV{MKDEBUG} || 0;
eval {
require IO::Uncompress::Inflate;
@@ -33,8 +38,6 @@ $Data::Dumper::Indent = 1;
$Data::Dumper::Sortkeys = 1;
$Data::Dumper::Quotekeys = 0;
use constant MKDEBUG => $ENV{MKDEBUG} || 0;
sub new {
my ( $class, %args ) = @_;
@@ -335,7 +338,7 @@ sub _d {
}
1;
}
# ###########################################################################
# End ProtocolParser package
# ###########################################################################

View File

@@ -17,6 +17,10 @@
# ###########################################################################
# QueryAdvisorRules package $Revision: 7473 $
# ###########################################################################
# Package: QueryAdvisorRules
# QueryAdvisorRules encapsulates rules for checking queries.
{
package QueryAdvisorRules;
use base 'AdvisorRules';
@@ -664,7 +668,7 @@ sub _d {
}
1;
}
# ###########################################################################
# End QueryAdvisorRules package
# ###########################################################################

View File

@@ -23,13 +23,14 @@
# This package differs from SQLParser because it only extracts from a query
# what is needed and only when that can be accomplished rather simply. By
# contrast, SQLParser parses the entire SQL statement no matter the complexity.
{
package QueryParser;
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use constant MKDEBUG => $ENV{MKDEBUG} || 0;
our $tbl_ident = qr/(?:`[^`]+`|\w+)(?:\.(?:`[^`]+`|\w+))?/;
# This regex finds things that look like database.table identifiers, based on
# their proximity to keywords. (?<!KEY\s) is a workaround for ON DUPLICATE KEY
@@ -521,7 +522,7 @@ sub _d {
}
1;
}
# ###########################################################################
# End QueryParser package
# ###########################################################################

View File

@@ -27,6 +27,7 @@
# fully aggregated and $ea->calculate_statistical_metrics() already called.
# Subreports "profile" and "prepared" require the ReportFormatter module,
# which is also in mk-query-digest.
{
package QueryReportFormatter;
use strict;
@@ -1410,7 +1411,7 @@ sub _d {
}
1;
}
# ###########################################################################
# End QueryReportFormatter package
# ###########################################################################

View File

@@ -18,21 +18,21 @@
# QueryReview package $Revision: 7342 $
# ###########################################################################
package QueryReview;
# Package: QueryReview
# QueryReview is an API to a query review table.
# This module is an interface to a "query review table" in which certain
# historical information about classes of queries is stored. See the docs on
# mk-query-digest for context.
{
package QueryReview;
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
Transformers->import(qw(make_checksum parse_timestamp));
use Data::Dumper;
use constant MKDEBUG => $ENV{MKDEBUG} || 0;
Transformers->import(qw(make_checksum parse_timestamp));
# These columns are the minimal set of columns for every review table. TODO:
# maybe it's possible to specify this in the tool's POD and pass it in so it's
# not hardcoded here and liable to get out of sync.
@@ -222,6 +222,7 @@ sub _d {
}
1;
}
# ###########################################################################
# End QueryReview package
# ###########################################################################

View File

@@ -18,13 +18,15 @@
# ###########################################################################
# QueryRewriter package $Revision: 7473 $
# ###########################################################################
use strict;
use warnings FATAL => 'all';
# Package: QueryRewriter
# QueryRewriter rewrites and transforms queries.
{
package QueryRewriter;
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use constant MKDEBUG => $ENV{MKDEBUG} || 0;
# A list of verbs that can appear in queries. I know this is incomplete -- it
@@ -494,7 +496,7 @@ sub _d {
}
1;
}
# ###########################################################################
# End QueryRewriter package
# ###########################################################################

View File

@@ -21,12 +21,12 @@
# Package: Quoter
# Quoter handles value quoting, unquoting, escaping, etc.
{
package Quoter;
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use constant MKDEBUG => $ENV{MKDEBUG} || 0;
# Sub: new
@@ -147,7 +147,7 @@ sub join_quote {
}
1;
}
# ###########################################################################
# End Quoter package
# ###########################################################################

View File

@@ -17,7 +17,6 @@
# ###########################################################################
# ReportFormatter package $Revision: 7473 $
# ###########################################################################
package ReportFormatter;
# Package: ReportFormatter
# ReportFormatter makes columnized reports given variable-width data lines.
@@ -55,18 +54,20 @@ package ReportFormatter;
# After these adjustments, get_report() calls _truncate_headers() and
# _truncate_line_values(). These truncate output to the columns' final,
# calculated widths.
{
package ReportFormatter;
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use constant MKDEBUG => $ENV{MKDEBUG} || 0;
use List::Util qw(min max);
use POSIX qw(ceil);
eval { require Term::ReadKey };
my $have_term = $EVAL_ERROR ? 0 : 1;
use constant MKDEBUG => $ENV{MKDEBUG} || 0;
# Arguments:
# * underline_header bool: underline headers with =
# * line_prefix scalar: prefix every line with this string
@@ -435,7 +436,7 @@ sub _d {
}
1;
}
# ###########################################################################
# End ReportFormatter package
# ###########################################################################

View File

@@ -17,6 +17,10 @@
# ###########################################################################
# Retry package $Revision: 7473 $
# ###########################################################################
# Package: Retry
# Retry retries code until a condition succeeds.
{
package Retry;
use strict;
@@ -101,7 +105,7 @@ sub _d {
}
1;
}
# ###########################################################################
# End Retry package
# ###########################################################################

View File

@@ -18,12 +18,15 @@
# ###########################################################################
# RowDiff package $Revision: 5697 $
# ###########################################################################
# Package: RowDiff
# RowDiff compares two sets of rows to find ones that are different.
{
package RowDiff;
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use constant MKDEBUG => $ENV{MKDEBUG} || 0;
# Required args:
@@ -248,7 +251,7 @@ sub _d {
}
1;
}
# ###########################################################################
# End RowDiff package
# ###########################################################################

View File

@@ -25,6 +25,7 @@
# now() comes from a clock, a log timestamp, or wherever. The creator of
# Runtime object determines how, or from where, time is gotten so that the
# caller of the object can simply ask, "What time is it?".
{
package Runtime;
use strict;
@@ -205,7 +206,7 @@ sub _d {
}
1;
}
# ###########################################################################
# End Runtime package
# ###########################################################################

View File

@@ -14,8 +14,10 @@
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place, Suite 330, Boston, MA 02111-1307 USA.
# ###########################################################################
# SQLParser package $Revision: 7565 $
# ###########################################################################
{
# Package: SQLParser
# SQLParser parses common MySQL SQL statements into data structures.
# This parser is MySQL-specific and intentionally meant to handle only
@@ -34,6 +36,7 @@
# This package differs from QueryParser because here we parse the entire SQL
# statement (thus giving access to all its parts), whereas QueryParser extracts
# just needed parts (and ignores all the rest).
{
package SQLParser;
use strict;
@@ -1326,9 +1329,8 @@ sub _d {
print STDERR "# $package:$line $PID ", join(' ', @_), "\n";
}
}; # package scope
1;
}
# ###########################################################################
# End SQLParser package
# ###########################################################################

View File

@@ -17,6 +17,10 @@
# ###########################################################################
# Sandbox package $Revision: 7140 $
# ###########################################################################
# Package: Sandbox
# Sandbox is an API for the test suite to access and control sandbox servers.
{
package Sandbox;
BEGIN {
@@ -28,7 +32,6 @@ BEGIN {
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use constant MKDEBUG => $ENV{MKDEBUG} || 0;
my $trunk = $ENV{PERCONA_TOOLKIT_BRANCH};
@@ -168,7 +171,7 @@ sub _d {
}
1;
}
# ###########################################################################
# End Sandbox package
# ###########################################################################

View File

@@ -18,7 +18,7 @@
# SchemaIterator package $Revision: 7547 $
# ###########################################################################
# SchemaIterator
# Package: SchemaIterator
# SchemaIterator iterates schema objects.
{
package SchemaIterator;

View File

@@ -14,7 +14,6 @@
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place, Suite 330, Boston, MA 02111-1307 USA.
# ###########################################################################
# UpgradeReportFormatter package $Revision: 7193 $
# ###########################################################################