Permalink
Browse files

global overhaul: 2 SPACEs before postfix if,unless,or,and

  • Loading branch information...
1 parent 96786a5 commit 7516fce3bb3472ac1e34e0fc2fbf8cad0a88e226 @marschap marschap committed Dec 28, 2012
View
@@ -24,9 +24,9 @@ my $init_failed = $@ ? $@ : undef;
sub request {
my($self, $request, $proxy, $arg, $size, $timeout) = @_;
- $size = 4096 unless $size;
+ $size = 4096 unless $size;
- LWP::Debug::trace('()') if defined &LWP::Debug::trace;
+ LWP::Debug::trace('()') if defined &LWP::Debug::trace;
# check proxy
if (defined $proxy) {
@@ -185,15 +185,15 @@ sub request {
my $j = 0;
foreach my $val (@$vals) {
- $val = qq!<a href="$val">$val</a>! if $val =~ /^https?:/;
- $val = qq!<a href="mailto:$val">$val</a>! if $val =~ /^[-\w]+\@[-.\w]+$/;
- $content .= "<tr>" if $j++;
+ $val = qq!<a href="$val">$val</a>! if $val =~ /^https?:/;
+ $val = qq!<a href="mailto:$val">$val</a>! if $val =~ /^[-\w]+\@[-.\w]+$/;
+ $content .= "<tr>" if $j++;
$content .= "<td>" . $val . "</td></tr>\n";
}
}
}
- $content .= "</table>" if $index;
+ $content .= "</table>" if $index;
$content .= "<hr>";
$content .= $index ? sprintf("%s Match%s found", $index, $index>1 ? "es" : "")
: "<b>No Matches found</b>";
View
@@ -53,7 +53,7 @@ sub _options {
my $once = 0;
for my $v (grep { /^-/ } keys %ret) {
require Carp;
- $once++ or Carp::carp("deprecated use of leading - for options");
+ $once++ or Carp::carp("deprecated use of leading - for options");
$ret{substr($v, 1)} = $ret{$v};
}
@@ -68,21 +68,21 @@ sub _options {
}
sub _dn_options {
- unshift @_, 'dn' if @_ & 1;
+ unshift @_, 'dn' if @_ & 1;
&_options;
}
sub _err_msg {
my $mesg = shift;
my $errstr = $mesg->dn || '';
- $errstr .= ": " if $errstr;
+ $errstr .= ": " if $errstr;
$errstr . $mesg->error;
}
my %onerror = (
die => sub { require Carp; Carp::croak(_err_msg(@_)) },
warn => sub { require Carp; Carp::carp(_err_msg(@_)); $_[0] },
- undef => sub { require Carp; Carp::carp(_err_msg(@_)) if $^W; undef },
+ undef => sub { require Carp; Carp::carp(_err_msg(@_)) if $^W; undef },
);
sub _error {
@@ -97,7 +97,7 @@ sub _error {
sub new {
my $self = shift;
my $type = ref($self) || $self;
- my $host = shift if @_ % 2;
+ my $host = shift if @_ % 2;
my $arg = &_options;
my $obj = bless {}, $type;
@@ -109,23 +109,23 @@ sub new {
$h =~ s,/.*,,; # remove path part
$h =~ s/%([A-Fa-f0-9]{2})/chr(hex($1))/eg; # unescape
}
- my $meth = $obj->can("connect_$scheme") or next;
+ my $meth = $obj->can("connect_$scheme") or next;
if (&$meth($obj, $h, $arg)) {
$obj->{net_ldap_uri} = $uri;
$obj->{net_ldap_scheme} = $scheme;
last;
}
}
- return undef unless $obj->{net_ldap_socket};
+ return undef unless $obj->{net_ldap_socket};
$obj->{net_ldap_resp} = {};
$obj->{net_ldap_version} = $arg->{version} || $LDAP_VERSION;
$obj->{net_ldap_async} = $arg->{async} ? 1 : 0;
$obj->{raw} = $arg->{raw} if ($arg->{raw});
if (defined(my $onerr = $arg->{onerror})) {
- $onerr = $onerror{$onerr} if exists $onerror{$onerr};
+ $onerr = $onerror{$onerr} if exists $onerror{$onerr};
$obj->{net_ldap_onerror} = $onerr;
}
@@ -302,7 +302,7 @@ sub async {
sub debug {
my $ldap = shift;
- require Convert::ASN1::Debug if $_[0];
+ require Convert::ASN1::Debug if $_[0];
@_
? ($ldap->{net_ldap_debug}, $ldap->{net_ldap_debug} = shift)[0]
@@ -357,7 +357,7 @@ sub unbind {
sub ldapbind {
require Carp;
- Carp::carp("->ldapbind deprecated, use ->bind") if $^W;
+ Carp::carp("->ldapbind deprecated, use ->bind") if $^W;
goto &bind;
}
@@ -601,7 +601,7 @@ sub modify {
}
else {
foreach my $op (qw(add delete replace increment)) {
- next unless exists $arg->{$op};
+ next unless exists $arg->{$op};
my $opt = $arg->{$op};
my $opcode = $opcode{$op};
@@ -649,8 +649,7 @@ sub modify {
modification => \@ops
},
controls => $control
- )
- or return _error($ldap, $mesg, LDAP_ENCODING_ERROR, "$@");
+ ) or return _error($ldap, $mesg, LDAP_ENCODING_ERROR, "$@");
$ldap->_sendmesg($mesg);
}
@@ -752,7 +751,7 @@ sub compare {
sub abandon {
my $ldap = shift;
- unshift @_, 'id' if @_ & 1;
+ unshift @_, 'id' if @_ & 1;
my $arg = &_options;
my $id = $arg->{id};
@@ -798,11 +797,11 @@ sub sync {
my $table = $ldap->{net_ldap_mesg};
my $err = LDAP_SUCCESS;
- return $err unless defined $table;
+ return $err unless defined $table;
- $mid = $mid->mesg_id if ref($mid);
+ $mid = $mid->mesg_id if ref($mid);
while (defined($mid) ? exists $table->{$mid} : %$table) {
- last if $err = $ldap->process($mid);
+ last if $err = $ldap->process($mid);
}
$err;
@@ -830,7 +829,7 @@ sub _sendmesg {
}
my $socket = $ldap->socket
- or return _error($ldap, $mesg, LDAP_SERVER_DOWN, "$!");
+ or return _error($ldap, $mesg, LDAP_SERVER_DOWN, "$!");
# send packets in sizes that IO::Socket::SSL can chew
# originally it was:
@@ -856,7 +855,7 @@ sub _sendmesg {
if ($sync) {
my $err = $ldap->sync($mid);
- return _error($ldap, $mesg, $err, $@) if $err;
+ return _error($ldap, $mesg, $err, $@) if $err;
}
}
@@ -868,7 +867,7 @@ sub _sendmesg {
sub process {
my $ldap = shift;
my $what = shift;
- my $sock = $ldap->socket or return LDAP_SERVER_DOWN;
+ my $sock = $ldap->socket or return LDAP_SERVER_DOWN;
my $sel = IO::Select->new($sock);
my $ready;
@@ -903,14 +902,14 @@ sub process {
}
}
- print STDERR "Unexpected PDU, ignored\n" if $debug & 10;
+ print STDERR "Unexpected PDU, ignored\n" if $debug & 10;
next;
}
- $mesg->decode($result) or
- return $mesg->code;
+ $mesg->decode($result)
+ or return $mesg->code;
- last if defined $what && $what == $mid;
+ last if defined $what && $what == $mid;
}
# FIXME: in CLDAP here we need to check if any message has timed out
@@ -925,11 +924,11 @@ sub _drop_conn {
my ($self, $err, $etxt) = @_;
my $sock = delete $self->{net_ldap_socket};
- close($sock) if $sock;
+ close($sock) if $sock;
if (my $msgs = delete $self->{net_ldap_mesg}) {
foreach my $mesg (values %$msgs) {
- next unless (defined $mesg);
+ next unless (defined $mesg);
$mesg->set_error($err, $etxt);
}
}
@@ -1018,7 +1017,7 @@ sub root_dse {
)];
my $root = $arg{attrs} && $ldap->{net_ldap_root_dse};
- return $root if $root;
+ return $root if $root;
my $mesg = $ldap->search(
base => '',
@@ -1029,9 +1028,9 @@ sub root_dse {
require Net::LDAP::RootDSE;
$root = $mesg->entry;
- bless $root, 'Net::LDAP::RootDSE' if $root; # Naughty, but there you go :-)
+ bless $root, 'Net::LDAP::RootDSE' if $root; # Naughty, but there you go :-)
- $ldap->{net_ldap_root_dse} = $root unless $arg{attrs};
+ $ldap->{net_ldap_root_dse} = $root unless $arg{attrs};
return $root;
}
@@ -1065,8 +1064,8 @@ sub start_tls {
delete $ldap->{net_ldap_root_dse};
- $arg->{sslversion} = 'tlsv1' unless defined $arg->{sslversion};
- $arg->{sslserver} = $ldap->{net_ldap_host} unless defined $arg->{sslserver};
+ $arg->{sslversion} = 'tlsv1' unless defined $arg->{sslversion};
+ $arg->{sslserver} = $ldap->{net_ldap_host} unless defined $arg->{sslserver};
IO::Socket::SSL::context_init( { _SSL_context_init_args($arg) } );
my $sock_class = ref($sock);
@@ -1109,7 +1108,7 @@ sub version {
sub outer {
my $self = shift;
- return $self if tied(%$self);
+ return $self if tied(%$self);
my %outer;
tie %outer, ref($self), $self;
++$self->{net_ldap_refcnt};
@@ -1126,7 +1125,7 @@ sub TIEHASH {
sub DESTROY {
my $ldap = shift;
- my $inner = tied(%$ldap) or return;
+ my $inner = tied(%$ldap) or return;
_drop_conn($inner, LDAP_UNAVAILABLE, "Implicit disconnect")
unless --$inner->{net_ldap_refcnt};
}
View
@@ -12,13 +12,13 @@ my @err2name;
local $_;
while (<DATA>) {
- last if /^=cut/;
+ last if /^=cut/;
my $protocol_const = /^=head2 Protocol Constants/ ... /^=head2/;
- next unless /^=item\s+(LDAP_\S+)\s+\((.*)\)/;
+ next unless /^=item\s+(LDAP_\S+)\s+\((.*)\)/;
my ($name, $value) = ($1, $2);
*{$name} = sub () { $value };
push @EXPORT_OK, $name;
- $err2name[$value] = $name if $protocol_const;
+ $err2name[$value] = $name if $protocol_const;
}
@@ -42,12 +42,12 @@ sub Net::LDAP::Util::ldap_error_text {
local $_;
my $n = -1;
while (<DATA>) {
- last if /^=head2/ and ++$n;
- last if /^=cut/;
- next if $n;
+ last if /^=head2/ and ++$n;
+ last if /^=cut/;
+ next if $n;
if (/^=item\s+(LDAP_\S+)\s+\((\d+)\)/) {
- last if defined $text;
- $text = '' if $2 == $code;
+ last if defined $text;
+ $text = '' if $2 == $code;
}
elsif (defined $text) {
$text .= $_;
@@ -61,7 +61,7 @@ sub Net::LDAP::Util::ldap_error_text {
$text =~ s/^=(over\s*\d*|back)//msg;
$text =~ s/ +\n//g;
$text =~ s/\n\n+/\n\n/g;
- $text =~ s/\n+\Z/\n/ if defined $text;
+ $text =~ s/\n+\Z/\n/ if defined $text;
}
return $text;
View
@@ -94,7 +94,7 @@ sub new {
if ($pkg eq __PACKAGE__ and exists $Type2Pkg{$args{type}}) {
$pkg = $Type2Pkg{$args{type}};
- eval "require $pkg" or die $@;
+ eval "require $pkg" or die $@;
}
delete $args{error};
@@ -110,7 +110,7 @@ sub from_asn {
if ($class eq __PACKAGE__ and exists $Type2Pkg{$asn->{type}}) {
$class = $Type2Pkg{$asn->{type}};
- eval "require $class" or die $@;
+ eval "require $class" or die $@;
}
delete $asn->{error};
@@ -121,19 +121,19 @@ sub from_asn {
sub to_asn {
my $self = shift;
$self->value; # Ensure value is there
- delete $self->{critical} unless $self->{critical};
+ delete $self->{critical} unless $self->{critical};
$self;
}
sub critical {
my $self = shift;
- $self->{critical} = shift if @_;
+ $self->{critical} = shift if @_;
$self->{critical} || 0;
}
sub value {
my $self = shift;
- $self->{value} = shift if @_;
+ $self->{value} = shift if @_;
$self->{value} || undef
}
@@ -86,10 +86,10 @@ Net::LDAP::Control::Paged - LDAPv3 Paged results control object
my $mesg = $ldap->search( @args );
# Only continue on LDAP_SUCCESS
- $mesg->code and last;
+ $mesg->code and last;
# Get cookie from paged control
- my($resp) = $mesg->control( LDAP_CONTROL_PAGED ) or last;
+ my($resp) = $mesg->control( LDAP_CONTROL_PAGED ) or last;
$cookie = $resp->cookie or last;
# Set cookie in paged control
@@ -85,10 +85,10 @@ sub pp_error {
sub value {
my $self = shift;
- return $self->{value} if exists $self->{value};
+ return $self->{value} if exists $self->{value};
my $asn = $self->{asn};
# Return undef if all optional values are missing
- return undef unless $asn and (defined $asn->{error} or $asn->{warning});
+ return undef unless $asn and (defined $asn->{error} or $asn->{warning});
$self->{value} = $ppControlResponse->encode($self->{asn});
}
@@ -119,9 +119,9 @@ Net::LDAP::Control::PasswordPolicy - LDAPv3 Password Policy control object
if (defined($resp)) {
my $v = $resp->pp_error;
- print "Password policy error $v\n" if defined $v;
+ print "Password policy error $v\n" if defined $v;
$v = $resp->time_before_expiration;
- print "Password expires in $v second(s)\n" if defined $v;
+ print "Password expires in $v second(s)\n" if defined $v;
}
=head1 DESCRIPTION
Oops, something went wrong.

0 comments on commit 7516fce

Please sign in to comment.