From: Matthias Bethke Date: Tue, 22 Nov 2016 16:22:19 +0000 (+0700) Subject: fix indentation (consistently use tabs) X-Git-Tag: collectd-5.7.0~28^2~5 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=2fa2acea8c203c2bc1838a5b14164fea4cfe7365;p=collectd.git fix indentation (consistently use tabs) --- diff --git a/bindings/perl/lib/Collectd/Unixsock.pm b/bindings/perl/lib/Collectd/Unixsock.pm index 304bbbc3..ca21d405 100644 --- a/bindings/perl/lib/Collectd/Unixsock.pm +++ b/bindings/perl/lib/Collectd/Unixsock.pm @@ -137,7 +137,7 @@ sub _parse_identifier sub _escape_argument { - my $arg = shift; + my $arg = shift; return $arg if $arg =~ /^\w+$/; @@ -153,19 +153,19 @@ sub _socket_command { my $fh = $self->{sock} or confess ('object has no filehandle'); - if($args) { - my $identifier = _create_identifier ($args) or return; - $command .= ' ' . _escape_argument ($identifier) . "\n"; - } else { - $command .= "\n"; - } + if($args) { + my $identifier = _create_identifier ($args) or return; + $command .= ' ' . _escape_argument ($identifier) . "\n"; + } else { + $command .= "\n"; + } _debug "-> $command"; $fh->print($command); my $response = $fh->getline; chomp $response; _debug "<- $response\n"; - return $response; + return $response; } # Read any remaining results from a socket and pass them to @@ -188,7 +188,7 @@ sub _socket_chat my $entry = $fh->getline; chomp $entry; _debug "<- $entry\n"; - $callback->($entry, $cbdata); + $callback->($entry, $cbdata); } return $cbdata; } @@ -260,14 +260,14 @@ sub getval # {{{ my %args = @_; my $ret = {}; - my $msg = $self->_socket_command('GETVAL', \%args) or return; - $self->_socket_chat($msg, sub { - local $_ = shift; - my $ret = shift; - /^(\w+)=NaN$/ and $ret->{$1} = undef, return; - /^(\w+)=(.*)$/ and looks_like_number($2) and $ret->{$1} = 0 + $2, return; - }, $ret - ); + my $msg = $self->_socket_command('GETVAL', \%args) or return; + $self->_socket_chat($msg, sub { + local $_ = shift; + my $ret = shift; + /^(\w+)=NaN$/ and $ret->{$1} = undef, return; + /^(\w+)=(.*)$/ and looks_like_number($2) and $ret->{$1} = 0 + $2, return; + }, $ret + ); return $ret; } # }}} sub getval @@ -284,17 +284,17 @@ sub getthreshold # {{{ my %args = @_; my $ret = {}; - my $msg = $self->_socket_command('GETTHRESHOLD', \%args) or return; - $self->_socket_chat($msg, sub { - local $_ = shift; - my $ret = shift; - my ( $key, $val ); - ( $key, $val ) = /^\s*([^:]+):\s*(.*)/ and do { - $key =~ s/\s*$//; - $ret->{$key} = $val; - }; - }, $ret - ); + my $msg = $self->_socket_command('GETTHRESHOLD', \%args) or return; + $self->_socket_chat($msg, sub { + local $_ = shift; + my $ret = shift; + my ( $key, $val ); + ( $key, $val ) = /^\s*([^:]+):\s*(.*)/ and do { + $key =~ s/\s*$//; + $ret->{$key} = $val; + }; + }, $ret + ); return $ret; } # }}} sub getthreshold @@ -319,7 +319,7 @@ sub putval my $fh = $self->{sock} or confess; my $interval = defined $args{interval} ? - ' interval=' . _escape_argument ($args{interval}) : ''; + ' interval=' . _escape_argument ($args{interval}) : ''; $identifier = _create_identifier (\%args) or return; if (!$args{values}) @@ -372,23 +372,23 @@ The returned data is in the same format as from C. sub listval_filter { my $self = shift; - my %args = @_; + my %args = @_; my @ret; my $nresults; my $fh = $self->{sock} or confess; - my $pattern = - (exists $args{host} ? "$args{host}" : '[^/]+') . - (exists $args{plugin} ? "/$args{plugin}" : '/[^/-]+') . + my $pattern = + (exists $args{host} ? "$args{host}" : '[^/]+') . + (exists $args{plugin} ? "/$args{plugin}" : '/[^/-]+') . (exists $args{plugin_instance} ? "-$args{plugin_instance}" : '(?:-[^/]+)?') . (exists $args{type} ? "/$args{type}" : '/[^/-]+') . (exists $args{type_instance} ? "-$args{type_instance}" : '(?:-[^/]+)?'); - $pattern = qr/^\d+ $pattern$/; + $pattern = qr/^\d+ $pattern$/; - my $msg = $self->_socket_command('LISTVAL') or return; + my $msg = $self->_socket_command('LISTVAL') or return; ($nresults, $msg) = split / /, $msg, 2; - # This could use _socket_chat() but doesn't for speed reasons + # This could use _socket_chat() but doesn't for speed reasons if ($nresults < 0) { $self->{error} = $msg; @@ -427,10 +427,10 @@ sub listval my @ret; my $fh = $self->{sock} or confess; - my $msg = $self->_socket_command('LISTVAL') or return; + my $msg = $self->_socket_command('LISTVAL') or return; ($nresults, $msg) = split / /, $msg, 2; - # This could use _socket_chat() but doesn't for speed reasons + # This could use _socket_chat() but doesn't for speed reasons if ($nresults < 0) { $self->{error} = $msg; @@ -497,10 +497,10 @@ sub putnotif my $msg; # message sent to the socket - for my $arg (qw( message severity )) - { - cluck ("Need argument `$arg'"), return unless $args{$arg}; - } + for my $arg (qw( message severity )) + { + cluck ("Need argument `$arg'"), return unless $args{$arg}; + } $args{severity} = lc $args{severity}; if (($args{severity} ne 'failure') && ($args{severity} ne 'warning') @@ -554,9 +554,9 @@ sub flush my $fh = $self->{sock} or confess; - my $msg = "FLUSH"; + my $msg = "FLUSH"; - $msg .= " timeout=$args{timeout}" if defined $args{timeout}; + $msg .= " timeout=$args{timeout}" if defined $args{timeout}; if ($args{plugins}) { @@ -587,11 +587,11 @@ sub flush $self->_send_message($msg) or return; $msg = $pre; } - + $msg .= $ident_str; } } - + return $self->_send_message($msg); } @@ -637,4 +637,4 @@ Florian octo Forster Eocto@collectd.orgE =cut 1; -# vim: set fdm=marker : +# vim: set fdm=marker noexpandtab: