/[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 161 by dpavlin, Fri Oct 30 14:52:34 2009 UTC revision 162 by dpavlin, Fri Oct 30 14:53:22 2009 UTC
# Line 86  sub new { Line 86  sub new {
86    
87  }  }
88    
   
 our $rec;  
 our $out;  
   
89  sub view {  sub view {
90          my ( $self, $code ) = @_;          my ( $self, $code ) = @_;
91    
         undef $out;  
   
92          my $affected = 0;          my $affected = 0;
93          my $start_t = time;          my $start_t = time;
94    
95          my $coderef = eval "sub { $code }";          my $out;
96    
97            my $coderef = eval "sub { my \$rec = \$_[0]; $code }";
98          if ( $@ ) {          if ( $@ ) {
99                  warn "ABORT code: $@";                  warn "ABORT code: $@";
100                  return;                  return;
# Line 106  sub view { Line 102  sub view {
102    
103    
104          foreach my $pos ( 0 .. $#{ $self->{data} } ) {          foreach my $pos ( 0 .. $#{ $self->{data} } ) {
105                  $rec = $self->{data}->[$pos];                  if ( ! defined $self->{data}->[$pos] ) {
                 if ( ! $rec ) {  
106                          print STDERR "END @ $pos";                          print STDERR "END @ $pos";
107                          last;                          last;
108                  }                  }
109    
110                  eval { $coderef->() };                  eval { $coderef->( $self->{data}->[$pos] ) };
111    
112                  if ( $@ ) {                  if ( $@ ) {
113                          warn "ABORT $pos $@\n";                          warn "ABORT $pos $@\n";
114                          last;                          last;
# Line 130  sub view { Line 126  sub view {
126    
127          push @{ $self->{reports} }, "$affected in ${dt}s";          push @{ $self->{reports} }, "$affected in ${dt}s";
128    
129  #       warn "# out ", dump( $out );          warn "[$self->{port}] out ", dump( $out ),$/ if $self->{debug};
130    
131          return {          return {
132                  out => $out,                  out => $out,

Legend:
Removed from v.161  
changed lines
  Added in v.162

  ViewVC Help
Powered by ViewVC 1.1.26