init
This commit is contained in:
38
wcmtools/lib/MySQL-BinLog/experiments/cpptokenizer.pl
Executable file
38
wcmtools/lib/MySQL-BinLog/experiments/cpptokenizer.pl
Executable file
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/perl -w
|
||||
#
|
||||
# Learning Text::CPP... conclusion: not what I need.
|
||||
#
|
||||
#
|
||||
|
||||
package cpptokenizer;
|
||||
|
||||
use Text::CPP;
|
||||
use Data::Dumper;
|
||||
|
||||
$Data::Dumper::TERSE = 1;
|
||||
$Data::Dumper::INDENT = 1;
|
||||
|
||||
my $reader = new Text::CPP ( Language => "GNUC99" );
|
||||
|
||||
my ( $text, $type, $prettytype, $flags );
|
||||
|
||||
foreach my $file ( @ARGV ) {
|
||||
print "File: $file\n", '-' x 70, "\n";
|
||||
|
||||
$reader->read( $file );
|
||||
|
||||
#print join("\n", $reader->tokens);
|
||||
|
||||
while ( ($text, $type, $flags) = $reader->token ) {
|
||||
$prettytype = $reader->type( $type );
|
||||
chomp( $text );
|
||||
#print "$prettytype: $text ($type) +$flags\n";
|
||||
print Data::Dumper->Dumpxs( [$text,$type,$flags,$prettytype],
|
||||
[qw{text type flags prettytype}] ), "\n";
|
||||
print "---\n";
|
||||
}
|
||||
|
||||
print "\n\n";
|
||||
}
|
||||
|
||||
|
||||
34
wcmtools/lib/MySQL-BinLog/experiments/try.pl
Executable file
34
wcmtools/lib/MySQL-BinLog/experiments/try.pl
Executable file
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/perl -w
|
||||
package try;
|
||||
use strict;
|
||||
|
||||
BEGIN {
|
||||
use lib qw{lib};
|
||||
use MySQL::BinLog;
|
||||
}
|
||||
|
||||
my %connect_params = (
|
||||
hostname => 'whitaker.lj',
|
||||
database => 'livejournal',
|
||||
user => 'slave',
|
||||
password => 'm&s',
|
||||
port => 3337,
|
||||
debug => 1,
|
||||
|
||||
log_slave_id => 512,
|
||||
);
|
||||
|
||||
sub handler {
|
||||
my $ev = shift;
|
||||
print( ('-' x 70), "\n",
|
||||
">>> QUERY: ", $ev->query_data, "\n",
|
||||
('-' x 70), "\n" );
|
||||
}
|
||||
|
||||
my $filename = shift @ARGV;
|
||||
|
||||
my $log = MySQL::BinLog->open( $filename );
|
||||
#my $log = MySQL::BinLog->connect( %connect_params );
|
||||
|
||||
my @res = $log->handle_events( \&handler, MySQL::QUERY_EVENT );
|
||||
|
||||
Reference in New Issue
Block a user