Commits

Anonymous committed bd93019

perltidy

Comments (0)

Files changed (2)

lib/Hg/Lib/Server.pm

 Hg::Lib::Server::Pipe->shadow_attrs;
 
 has server => (
-    is => 'ro',
+    is       => 'ro',
     lazy     => 1,
     init_arg => undef,
     handles  => [qw[ get_chunk write writeblock ]],
     default  => sub {
-        Hg::Lib::Server::Pipe->new( Hg::Lib::Server::Pipe->xtract_attrs($_[0]) );
+        Hg::Lib::Server::Pipe->new(
+            Hg::Lib::Server::Pipe->xtract_attrs( $_[0] ) );
     },
 );
 
     my $self = shift;
 
     my $buf;
-    my $ch = $self->get_chunk($buf);
+    my $ch = $self->get_chunk( $buf );
 
-    croak("corrupt or incomplete hello message from server\n")
+    croak( "corrupt or incomplete hello message from server\n" )
       unless $ch eq 'o' && length $buf;
 
     for my $item ( split( "\n", $buf ) ) {
 
         elsif ( $field eq 'encoding' ) {
 
-            $self->_set_encoding($value);
+            $self->_set_encoding( $value );
 
         }
 
     }
 
     # make sure hello message meets minimum standards
-    croak("server did not provide capabilities?\n")
+    croak( "server did not provide capabilities?\n" )
       unless $self->has_capabilities;
 
-    croak("server is missing runcommand capability\n")
+    croak( "server is missing runcommand capability\n" )
       unless exists $self->capabilities->{runcommand};
 
-    croak("server did not provide encoding?\n")
+    croak( "server did not provide encoding?\n" )
       unless $self->has_encoding;
 
     return;
     my ( $ch, $len ) = $self->get_chunk( $buffer );
 
     croak( "unexpected return message for getencoding on channel $ch\n" )
-      unless $ch eq 'r' && length($buffer);
+      unless $ch eq 'r' && length( $buffer );
 
     return $buffer;
 
     my $opts = validate(
         @_,
         {
-            inchannels  => { type => HASHREF, default => {} },
-            outchannels => { type => HASHREF, default => {} },
-            args        => { type => ARRAYREF, default => {} },
+            inchannels => {
+                type    => HASHREF,
+                default => {}
+            },
+            outchannels => {
+                type    => HASHREF,
+                default => {}
+            },
+            args => {
+                type    => ARRAYREF,
+                default => {}
+            },
         } );
 
     $self->write( "runcommand\n" );
 
             when ( 'r' ) {
 
-		state $length_exp = length( pack( 'l>', 0 ) );
-		croak( sprintf
-		       "incorrect message length (got %d, expected %d)",
-			length($buffer), $length_exp )
-		  if length($buffer) != $length_exp;
+                state $length_exp = length( pack( 'l>', 0 ) );
+                croak( sprintf "incorrect message length (got %d, expected %d)",
+                    length( $buffer ), $length_exp )
+                  if length( $buffer ) != $length_exp;
 
                 return unpack( 'l>', $buffer );
             }

lib/Hg/Lib/Server/Pipe.pm

 # attempt to make things work on Windows, which doesn't define
 # WUNTRACED
 BEGIN {
-    my $have_WUNTRACED = eval { POSIX::WUNTRACED() | 1 ;};
+    my $have_WUNTRACED = eval { POSIX::WUNTRACED() | 1; };
 
     *WUNTRACED = $have_WUNTRACED ? \&POSIX::WUNTRACED : sub () { 0 };
 }
 
-use constant forceArray =>
-    sub { 'ARRAY' eq ref $_[0] ? $_[0] : [ $_[0] ] };
+use constant forceArray => sub { 'ARRAY' eq ref $_[0] ? $_[0] : [ $_[0] ] };
 
 with 'MooX::Attributes::Shadow::Role';
 
     clearer   => 1,
     init_arg  => undef
 );
-has _write => ( is => 'rwp', init_arg => undef );
-has _read  => ( is => 'rwp', init_arg => undef );
-has _error => ( is => 'rwp', init_arg => undef );
+has _write => (
+    is       => 'rwp',
+    init_arg => undef
+);
+has _read => (
+    is       => 'rwp',
+    init_arg => undef
+);
+has _error => (
+    is       => 'rwp',
+    init_arg => undef
+);
 
 # path to hg executable
 has hg => (
         $pid = open2( $read, $write, @{ $self->cmd } );
         #        $pid = open3( $write, $read, $error, @{ $self->cmd } );
 
-	# there's probably not enough time elapsed between starting
-	# the child process and checking for its existence, but this
-	# doesn't cost much
-	_check_on_child( $pid, status => 'alive' );
+        # there's probably not enough time elapsed between starting
+        # the child process and checking for its existence, but this
+        # doesn't cost much
+        _check_on_child( $pid, status => 'alive' );
 
     }
     catch {
 
     if ( $ch =~ /IL/ ) {
 
-	croak( "get_chunk called incorrectly called in scalar context for channel $ch\n" )
-	  unless wantarray();
+        croak(
+            "get_chunk called incorrectly called in scalar context for channel $ch\n"
+        ) unless wantarray();
 
         return $ch, $len;
     }
 
         $self->_write->close;
 
-	_check_on_child( $self->_pid, status => 'exit', wait => 1 );
+        _check_on_child(
+            $self->_pid,
+            status => 'exit',
+            wait   => 1
+        );
 
         $self->_clear_pid;
     }
     # anything else is not ok.
     if ( $pid == $status ) {
 
-        die( "unexpected exit of child with status ",
-            WEXITSTATUS( $? ), "\n" )
+        die( "unexpected exit of child with status ", WEXITSTATUS( $? ), "\n" )
           if WIFEXITED( $? ) && WEXITSTATUS( $? ) != 0;
 
-        die( "unexpected exit of child with signal ",
-            WTERMSIG( $? ), "\n" )
+        die( "unexpected exit of child with signal ", WTERMSIG( $? ), "\n" )
           if WIFSIGNALED( $? );
 
     }
 
     if ( $opt{status} eq 'alive' ) {
 
-	die( "unexpected exit of child\n" )
-	    if $pid == $status || -1 == $status;
+        die( "unexpected exit of child\n" )
+          if $pid == $status || -1 == $status;
 
     }
 
     elsif ( $opt{status} eq 'exit' ) {
 
-	# is the child still alive
-	die( "child still alive\n" )
-	     unless $pid == $status  || -1 == $status;
+        # is the child still alive
+        die( "child still alive\n" )
+          unless $pid == $status || -1 == $status;
 
     }
 
     else {
 
-	die( "internal error: unknown child status requested\n" );
+        die( "internal error: unknown child status requested\n" );
 
     }