Skip to content
This repository was archived by the owner on Nov 16, 2020. It is now read-only.

Commit a3b3dc7

Browse files
committed
add output filename option to script; expand README
1 parent 965b89e commit a3b3dc7

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

README

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,9 @@ The idea is to have a concise and easy-to-write source file which contains the
77
data, and a script that converts this information into a format that is easy
88
to read, like a colored HTML table or so.
99

10+
A first version of that script is process.pl, which needs perl 5.10 or
11+
newer and HTML::Template::Compiled from CPAN. It writes the xhtml output
12+
to standard output, or to the filename specified on the command line.
13+
1014
Your contribution is very welcome. Please join our discussions in #perl6,
1115
http://perl6.org/community/irc

process.pl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,5 +95,12 @@ sub write_html {
9595
}
9696
}
9797
$t->param(rows => \@rows);
98-
say $t->output;
98+
if (@ARGV) {
99+
my $filename = shift @ARGV;
100+
open my $out, '>:encoding(UTF-8)', $filename;
101+
print { $out } $t->output;
102+
close $out;
103+
} else {
104+
print $t->output;
105+
}
99106
}

0 commit comments

Comments
 (0)