#!/usr/bin/perl -w # -*- perl -*- # # tt2inst (bin/tt2inst) # # This script installs the optional Template Toolkit components from the # 'docs', 'examples', 'images' and 'templates' distribution directories # into the corresponding installation directories. The root directory # for the installation should be specified as an argument to the # script, e.g. 'tt2inst /usr/local/tt2' # use strict; use Getopt::Std; use File::Find; use File::Path; use File::Copy; use File::Spec; use Cwd; my $PROGRAM = 'tt2inst'; my @INSTDIRS = qw( docs examples images templates ); my $args = { }; getopts('vh', $args); usage() if $args->{ h }; my $verbose = $args->{ v }; my $tt2inst = shift || usage(); my $tt2dist = getcwd; die <catfile($tt2inst, $f); mkpath($dir) unless -d $dir; return; } my $dest = File::Spec->catfile($tt2inst, $f); copy($_, $dest) || die "$dest: $!\n"; } #------------------------------------------------------------------------ # usage #------------------------------------------------------------------------ sub usage { print STDERR <