Changeset 611

Show
Ignore:
Timestamp:
04/25/02 20:29:47
Author:
miyagawa
Message:

--dump option

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • htdiff/trunk/Changes

    r610 r611  
    11Revision history for Perl extension htdiff 
     2 
     30.03  Thu Apr 25 20:24:37 JST 2002 
     4        * Add --dump option 
    25 
    360.02  Thu Apr 25 18:09:38 JST 2002 
  • htdiff/trunk/htdiff

    r610 r611  
    22use strict; 
    33use vars qw($VERSION); 
    4 $VERSION = 0.02
     4$VERSION = 0.03
    55 
    66=head1 NAME 
     
    1111 
    1212  htdiff file1 file2 
     13  htdiff --dump file 
    1314 
    1415=head1 DESCRIPTION 
     
    5455 
    5556sub new { 
    56     my($class, @files) = @_; 
    57     bless { files => \@files }, $class; 
     57    my($class, %p) = @_; 
     58    bless \%p, $class; 
    5859} 
    5960 
    6061sub run { 
    6162    my $self = shift; 
    62     my @tokens = map $self->make_tokens($_), @{$self->{files}}; 
    63     $self->check_directives(@tokens); 
     63    if ($self->{dump}) { 
     64        $self->dump_structure; 
     65    } else { 
     66        my @tokens = map $self->make_tokens($_), @{$self->{files}}; 
     67        $self->check_directives(@tokens); 
     68    } 
     69
     70 
     71sub dump_structure { 
     72    my $self = shift; 
     73    my $structure = $self->make_tokens($self->{dump}); 
     74    print $structure; 
    6475} 
    6576 
     
    188199sub usage { 
    189200    (my $me = $0) =~ s@.*/@@; 
    190     warn "Usage: $me file1 file2\n"; 
     201    warn "Usage: $me file1 file2 / $me --dump file\n"; 
    191202} 
    192203 
    193204@ARGV == 2 or usage(), exit; 
    194  
    195 my $app = HtdiffApp->new(@ARGV); 
     205my $app = $ARGV[0] eq '--dump' 
     206    ? HtdiffApp->new(dump => $ARGV[1]) 
     207    : HtdiffApp->new(files => \@ARGV); 
    196208$app->run; 
     209 
  • ttdiff/trunk/Changes

    r605 r611  
    11Revision history for Perl extension ttdiff 
     2 
     30.02  Thu Apr 25 20:24:37 JST 2002 
     4        * Add --dump option 
    25 
    360.01  Wed Apr 24 20:43:32 2002 
  • ttdiff/trunk/ttdiff

    r605 r611  
    22use strict; 
    33use vars qw($VERSION); 
    4 $VERSION = 0.01
     4$VERSION = 0.02
    55 
    66=head1 NAME 
     
    1111 
    1212  ttdiff file1 file2 
     13  ttdiff --dump file 
    1314 
    1415=head1 DESCRIPTION 
     
    5455 
    5556sub new { 
    56     my($class, @files) = @_; 
    57     bless { files => \@files }, $class; 
     57    my($class, %p) = @_; 
     58    bless \%p, $class; 
    5859} 
    5960 
    6061sub run { 
    6162    my $self = shift; 
    62     my @tokens = map $self->make_tokens($_), @{$self->{files}}; 
    63     $self->check_directives(@tokens); 
     63    if ($self->{dump}) { 
     64        $self->dump_structure; 
     65    } else { 
     66        my @tokens = map $self->make_tokens($_), @{$self->{files}}; 
     67        $self->check_directives(@tokens); 
     68    } 
     69
     70 
     71sub dump_structure { 
     72    my $self = shift; 
     73    my $structure = $self->make_bone($self->make_tokens($self->{dump})); 
     74    print $structure; 
    6475} 
    6576 
     
    95106sub usage { 
    96107    (my $me = $0) =~ s@.*/@@; 
    97     warn "Usage: $me file1 file2\n"; 
     108    warn "Usage: $me file1 file2 / $me --dump file\n"; 
    98109} 
    99110 
    100111@ARGV == 2 or usage(), exit; 
     112my $app = $ARGV[0] eq '--dump' 
     113    ? TTDiffApp->new(dump => $ARGV[1]) 
     114    : TTDiffApp->new(files => \@ARGV); 
     115$app->run; 
    101116 
    102 my $app = TTDiffApp->new(@ARGV); 
    103 $app->run; 
     117