~frank-cizmich/percona-toolkit/percona-toolkit

« back to all changes in this revision

Viewing changes to bin/pt-query-digest

  • Committer: Daniel Nichter
  • Date: 2014-02-20 03:00:02 UTC
  • Revision ID: daniel@percona.com-20140220030002-gsj22qr101mb2fbp
Remove version check bin type.  Update all tools.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12628
12628
   perl_version        => \&get_perl_version,
12629
12629
   perl_module_version => \&get_perl_module_version,
12630
12630
   mysql_variable      => \&get_mysql_variable,
12631
 
   bin_version         => \&get_bin_version,
12632
12631
);
12633
12632
 
12634
12633
sub valid_item {
12811
12810
   return \%version_for;
12812
12811
}
12813
12812
 
12814
 
sub get_bin_version {
12815
 
   my (%args) = @_;
12816
 
   my $item = $args{item};
12817
 
   my $cmd  = $item->{item};
12818
 
   return unless $cmd;
12819
 
 
12820
 
   my $sanitized_command = File::Basename::basename($cmd);
12821
 
   PTDEBUG && _d('cmd:', $cmd, 'sanitized:', $sanitized_command);
12822
 
   return if $sanitized_command !~ /\A[a-zA-Z0-9_-]+\z/;
12823
 
 
12824
 
   my $output = `$sanitized_command --version 2>&1`;
12825
 
   PTDEBUG && _d('output:', $output);
12826
 
 
12827
 
   my ($version) = $output =~ /v?([0-9]+\.[0-9]+(?:\.[\w-]+)?)/;
12828
 
 
12829
 
   PTDEBUG && _d('Version for', $sanitized_command, '=', $version);
12830
 
   return $version;
12831
 
}
12832
 
 
12833
12813
sub _d {
12834
12814
   my ($package, undef, $line) = caller 0;
12835
12815
   @_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }