]> mj.ucw.cz Git - temple.git/blobdiff - temple
temple -e
[temple.git] / temple
diff --git a/temple b/temple
index 370535f98acf94619530edabb0c2397c6f9b0793..b1301a6055e71718322e120bb6b5ee2fe80eb14e 100755 (executable)
--- a/temple
+++ b/temple
@@ -1,22 +1,27 @@
-#!/usr/bin/perl
+#!/usr/bin/perl -CSA
 # A really simple template engine
 # (c) 2004 Martin Mares <mj@ucw.cz>
 
 use strict;
 use warnings;
+use lib '.';
 
 use Getopt::Long;
 use UCW::Temple;
 
 my $out;
+my @execs = ();
 
-GetOptions('out|o=s' => \$out) or die "Usage: temple [-o <out>] <in> ...";
+GetOptions('out|o=s' => \$out, 'exec|e=s' => \@execs) or die "Usage: temple [-o <out>] [-e <string>] <in> ...";
 if (defined $out) {
        close STDOUT;
-       open STDOUT, ">$out" or die "Cannot open $out: $!";
+       open STDOUT, '>:utf8', $out or die "Cannot open $out: $!";
 }
 if (!@ARGV) { push @ARGV, "-"; }
-UCW::Temple::start(undef);
+UCW::Temple::start();
+foreach (@execs) {
+       UCW::Temple::parse_string($_, "-e");
+}
 foreach (@ARGV) {
        UCW::Temple::parse_file($_);
 }