/[Frey]/branches/no-pager/lib/Frey/Class/Refactor/Modify.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 /branches/no-pager/lib/Frey/Class/Refactor/Modify.pm

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

revision 749 by dpavlin, Sun Dec 7 01:33:37 2008 UTC revision 750 by dpavlin, Mon Dec 8 18:19:35 2008 UTC
# Line 3  use Moose; Line 3  use Moose;
3    
4  extends 'Frey';  extends 'Frey';
5  with 'Frey::Web';  with 'Frey::Web';
6    with 'Frey::File';
7    
8    has from => (
9            is => 'rw',
10            isa => 'Str',
11            required => 1,
12    );
13    
14  has selected => (  has selected => (
15          is => 'rw',          is => 'rw',
# Line 33  sub as_markup { Line 40  sub as_markup {
40    
41          my $dump;          my $dump;
42          $dump->{$_} = $self->$_ foreach ( qw/selected path line modification/ );          $dump->{$_} = $self->$_ foreach ( qw/selected path line modification/ );
43            my $html = $self->html_dump( $dump );
44    
45            my @content;
46            my $content_path;
47    
48            $html .= qq|<ul>|;
49    
50            foreach my $selected ( @{ $self->selected } ) {
51                    warn "# selected ", $self->dump( $selected );
52                    my $path = $self->path->[$selected] || die "no $selected path in ", $self->dump( $self->path );
53                    if ( $path ne $content_path ) {
54                            $content_path = $path;
55                            @content = $self->read_file( $content_path );
56                            warn "# got $#content lines from ", $self->path_size( $content_path );
57                    }
58                    my $line = $self->line->[$selected] - 1;
59                    my $from = $self->from;
60                    my $to = $self->modification->[$selected];
61    
62                    $content[ $line ] =~ s{\Q$from\E}{$to}s;
63                    $self->write_file( $content_path, @content );
64            
65                    $html .= qq|<li>$line $from -&gt; $to <tt>| . $self->html_escape( $content[$line] ) . qq|</tt></li>|;
66            }
67    
68            $html .= qq|</ul>|;
69    
70          return $self->html_dump( $dump );          $html;
71  }  }
72    
73  1;  1;

Legend:
Removed from v.749  
changed lines
  Added in v.750

  ViewVC Help
Powered by ViewVC 1.1.26