/[Sack]/trunk/lib/Sack/View.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/lib/Sack/View.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 130 by dpavlin, Wed Oct 7 17:17:07 2009 UTC revision 142 by dpavlin, Wed Oct 7 20:44:07 2009 UTC
# Line 13  use Time::HiRes qw(time); Line 13  use Time::HiRes qw(time);
13  use lib 'lib';  use lib 'lib';
14  use base qw(Sack::Pid);  use base qw(Sack::Pid);
15  use Sack::Color;  use Sack::Color;
16    use Sack;
 our $VERSION = '0.09';  
17    
18  sub new {  sub new {
19          my $class = shift;          my $class = shift;
# Line 36  sub new { Line 35  sub new {
35          while ( 1 ) {          while ( 1 ) {
36    
37                  if ( ! $client ) {                  if ( ! $client ) {
38                          warn "[$port] accept $VERSION\n";                          warn "[$port] accept $Sack::VERSION\n";
39                          $client = $sock->accept();                          $client = $sock->accept();
40                          warn "[$port] connect from ", $client->peerhost, $/;                          warn "[$port] connect from ", $client->peerhost, $/;
41                  }                  }
42    
43                  my $data = eval { Storable::fd_retrieve( $client ) };                  my $data = Storable::fd_retrieve( $client );
                 if ( $@ ) {  
                         warn "[$port] ERROR $@\n";  
                         exec "$0 $port";  
                         warn "[$port] after exec";  
                 }  
44    
45                  if ( defined $data->{data} ) {                  if ( defined $data->{data} ) {
46                          warn "# [$port] <<<< data\n";                          warn "# [$port] <<<< data\n" if $self->{debug};
47                  } else {                  } else {
48                          warn "# [$port] <<<< ", dump( $data ), $/;                          warn "# [$port] <<<< ", dump( $data ), $/ if $self->{debug};
49                  }                  }
50    
51                  my $result;                  my $result;
# Line 71  sub new { Line 65  sub new {
65                          exec "$0 $port";                          exec "$0 $port";
66                  } elsif ( $data->{info} ) {                  } elsif ( $data->{info} ) {
67                          $result = {                          $result = {
68                                  version => $VERSION,                                  version => $Sack::VERSION,
69                                  size => $#{ $self->{data} } + 1,                                  size => $#{ $self->{data} } + 1,
70                                  reports => $self->{reports},                                  reports => $self->{reports},
71                          };                          };
72                  } elsif ( my $sh = delete $data->{sh} ) {                  } elsif ( my $sh = delete $data->{sh} ) {
73                          $result = { sh => scalar `$sh` };                          $result = { sh => scalar `$sh` };
74                    } elsif ( defined $data->{debug} ) {
75                            $self->{debug} = $data->{debug};
76                  } else {                  } else {
77                          warn "[$port] UNKNOWN ", dump( $data ), $/;                          warn "[$port] UNKNOWN ", dump( $data ), $/;
78                          $result = { 'error' => $data };                          $result = { 'error' => $data };
# Line 136  sub view { Line 132  sub view {
132    
133          return {          return {
134                  out => $out,                  out => $out,
                 report => $report,  
135          };          };
136  }  }
137    

Legend:
Removed from v.130  
changed lines
  Added in v.142

  ViewVC Help
Powered by ViewVC 1.1.26