use strict;
use warnings;
-use Text::Template;
+
+use Getopt::Std;
+
+# Because we know that Text::Template isn't a core Perl module, we use
+# a fallback in case it's not installed on the system
+use File::Basename;
+use File::Spec::Functions;
+use lib catdir(dirname(__FILE__));
+use with_fallback qw(Text::Template);
# We actually expect to get the following hash tables from configdata:
#
undef;
}
+# Check options ######################################################
+
+my %opts = ();
+
+# -o ORIGINATOR
+# declares ORIGINATOR as the originating script.
+getopt('o', \%opts);
+
+my @autowarntext = ("WARNING: do not edit!",
+ "Generated"
+ . (defined($opts{o}) ? " by ".$opts{o} : "")
+ . (scalar(@ARGV) > 0 ? " from ".join(", ",@ARGV) : ""));
+
# Template reading ###################################################
# Read in all the templates into $text, while keeping track of each
my $prev_linecount = 0;
my $text =
@ARGV
- ? join("", map { my $x = my $y = Text::Template::_load_text($_);
+ ? join("", map { my $x = Text::Template::_load_text($_);
my $linecount = $x =~ tr/\n//;
$prev_linecount = ($linecount += $prev_linecount);
$lines{$linecount} = $_;
$template->fill_in(OUTPUT => \*STDOUT,
HASH => { config => \%config,
target => \%target,
+ withargs => \%withargs,
+ autowarntext => \@autowarntext,
quotify1 => \"ify1,
quotify_l => \"ify_l },
DELIMITERS => [ "{-", "-}" ],