6 |
my $out_dir; |
my $out_dir; |
7 |
my $file_pattern; |
my $file_pattern; |
8 |
my $domtest2perl = 'domtest2perl.pl'; |
my $domtest2perl = 'domtest2perl.pl'; |
9 |
|
my %Opt = ( |
10 |
|
test2perl_option => [], |
11 |
|
); |
12 |
GetOptions ( |
GetOptions ( |
13 |
|
'domtest2perl-option=s' => sub { |
14 |
|
shift; |
15 |
|
push @{$Opt{test2perl_option}}, shift; |
16 |
|
}, |
17 |
'domtest2perl-path=s' => \$domtest2perl, |
'domtest2perl-path=s' => \$domtest2perl, |
18 |
'test-directory=s' => \$dir, |
'test-directory=s' => \$dir, |
19 |
'test-file-pattern=s' => \$file_pattern, |
'test-file-pattern=s' => \$file_pattern, |
28 |
my $in_file = $dir.'/'.$_; |
my $in_file = $dir.'/'.$_; |
29 |
my $out_file = $out_dir.'/'.$_.'.pl'; |
my $out_file = $out_dir.'/'.$_.'.pl'; |
30 |
if (-e $out_file and -C $in_file >= -C $out_file) { |
if (-e $out_file and -C $in_file >= -C $out_file) { |
31 |
warn "$0: $_.pl: Skipped; it is newer than $_"; |
warn "$_.pl: Skipped - it is newer than source\n"; |
32 |
next; |
next; |
33 |
} |
} |
34 |
my @cmd = ('perl', map ({"-I$_"} @INC), |
my @cmd = ('perl', map ({"-I$_"} @INC), |
35 |
$domtest2perl, $in_file, |
$domtest2perl, $in_file, |
36 |
'--output-file' => $out_file); |
'--output-file-name' => $out_file, |
37 |
|
@{$Opt{test2perl_option}}); |
38 |
print STDERR join " ", @cmd, "\n"; |
print STDERR join " ", @cmd, "\n"; |
39 |
|
print STDERR $in_file, "\n"; |
40 |
|
print STDERR '-> ' . $out_file, "\n"; |
41 |
system @cmd and die "$0: $domtest2perl: $@"; |
system @cmd and die "$0: $domtest2perl: $@"; |
42 |
system 'perl', map ({"-I$_"} @INC), '-c', $out_file |
system 'perl', map ({"-I$_"} @INC), '-c', $out_file |
43 |
and die "$0: $out_file: $@"; |
and die "$0: $out_file: $@"; |
44 |
} |
} |
45 |
|
|
46 |
|
1; |
47 |
|
|
48 |
|
__END__ |
49 |
|
|
50 |
|
=head1 NAME |
51 |
|
|
52 |
|
domts2perl - Generates Perl Test Code from DOM Test Suite |
53 |
|
|
54 |
|
=head1 SYNOPSIS |
55 |
|
|
56 |
|
perl path/to/domts2perl.pl --test-directory=path/to/source/xml/directory/ \ |
57 |
|
--output-directory=path/to/result/pl/directory/ \ |
58 |
|
--domtest2perl=path/to/domts2perl/pl |
59 |
|
|
60 |
|
=head1 OPTIONS |
61 |
|
|
62 |
|
=over 4 |
63 |
|
|
64 |
|
=item --domtest2perl=I<path> |
65 |
|
|
66 |
|
Path to the F<domtest2perl.pl> to convert each XMl file to Perl code. |
67 |
|
|
68 |
|
=item --output-directory=I<path> |
69 |
|
|
70 |
|
Path to result Perl code directory. |
71 |
|
|
72 |
|
=item --test-directory=I<path> |
73 |
|
|
74 |
|
Path to source XML files in the package of the DOM Test Suite. |
75 |
|
|
76 |
|
=back |
77 |
|
|
78 |
|
=head1 SEE ALSO |
79 |
|
|
80 |
|
I<Document Object Model (DOM) Conformance Test Suites>, |
81 |
|
<http://www.w3.org/DOM/Test/>. |
82 |
|
|
83 |
|
F<domtest2perl.pl> |
84 |
|
|
85 |
|
=head1 LICENSE |
86 |
|
|
87 |
|
Copyright 2004-2005 Wakaba <w@suika.fam.cx>. All rights reserved. |
88 |
|
|
89 |
|
This program is free software; you can redistribute it and/or |
90 |
|
modify it under the same terms as Perl itself. |
91 |
|
|
92 |
|
=cut |
93 |
|
|