Skip to content
Browse files

2.04b

git-svn-id: svn://svn.tt2.org/tt/Template2/trunk@146 d5a88997-0a34-4036-9ed2-92fb5d660d91
  • Loading branch information...
1 parent 82ca450 commit a4123f87ee874a49083259dfd7313cd3f29503be @abw committed
Showing with 988 additions and 574 deletions.
  1. +50 −1 Changes
  2. +2 −0 MANIFEST
  3. +3 −0 MANIFEST.SKIP
  4. +480 −269 Makefile.PL
  5. +9 −9 README
  6. +1 −1 TODO
  7. +1 −1 bin/release
  8. +2 −2 bin/tpage
  9. +2 −2 bin/ttree
  10. +2 −2 docs/src/FAQ/FAQ.html
  11. +2 −2 docs/src/Library/HTML.html
  12. +2 −2 docs/src/Library/PostScript.html
  13. +2 −2 docs/src/Library/Splash.html
  14. +1 −1 docs/src/Manual/Config.html
  15. +1 −1 docs/src/Manual/Credits.html
  16. +1 −1 docs/src/Manual/Directives.html
  17. +1 −1 docs/src/Manual/Filters.html
  18. +1 −1 docs/src/Manual/Internals.html
  19. +1 −1 docs/src/Manual/Intro.html
  20. +1 −1 docs/src/Manual/Plugins.html
  21. +1 −1 docs/src/Manual/Refs.html
  22. +1 −1 docs/src/Manual/Syntax.html
  23. +1 −1 docs/src/Manual/Variables.html
  24. +1 −1 docs/src/Manual/Views.html
  25. +1 −1 docs/src/Modules/Template.html
  26. +2 −2 docs/src/Modules/Template/Base.html
  27. +2 −2 docs/src/Modules/Template/Config.html
  28. +2 −2 docs/src/Modules/Template/Constants.html
  29. +2 −2 docs/src/Modules/Template/Context.html
  30. +2 −2 docs/src/Modules/Template/Document.html
  31. +2 −2 docs/src/Modules/Template/Exception.html
  32. +2 −2 docs/src/Modules/Template/Filters.html
  33. +2 −2 docs/src/Modules/Template/Iterator.html
  34. +2 −2 docs/src/Modules/Template/Parser.html
  35. +2 −2 docs/src/Modules/Template/Plugin.html
  36. +2 −2 docs/src/Modules/Template/Plugin/Autoformat.html
  37. +2 −2 docs/src/Modules/Template/Plugin/CGI.html
  38. +1 −1 docs/src/Modules/Template/Plugin/DBI.html
  39. +2 −2 docs/src/Modules/Template/Plugin/Datafile.html
  40. +2 −2 docs/src/Modules/Template/Plugin/Date.html
  41. +2 −2 docs/src/Modules/Template/Plugin/Directory.html
  42. +2 −2 docs/src/Modules/Template/Plugin/Dumper.html
  43. +2 −2 docs/src/Modules/Template/Plugin/File.html
  44. +2 −2 docs/src/Modules/Template/Plugin/Format.html
  45. +2 −2 docs/src/Modules/Template/Plugin/Iterator.html
  46. +2 −2 docs/src/Modules/Template/Plugin/Pod.html
  47. +2 −2 docs/src/Modules/Template/Plugin/Table.html
  48. +2 −2 docs/src/Modules/Template/Plugin/URL.html
  49. +2 −2 docs/src/Modules/Template/Plugin/View.html
  50. +2 −2 docs/src/Modules/Template/Plugin/Wrap.html
  51. +1 −1 docs/src/Modules/Template/Plugin/XML/DOM.html
  52. +2 −2 docs/src/Modules/Template/Plugin/XML/RSS.html
  53. +2 −2 docs/src/Modules/Template/Plugin/XML/Simple.html
  54. +2 −2 docs/src/Modules/Template/Plugin/XML/XPath.html
  55. +2 −2 docs/src/Modules/Template/Plugins.html
  56. +2 −2 docs/src/Modules/Template/Provider.html
  57. +2 −2 docs/src/Modules/Template/Service.html
  58. +2 −2 docs/src/Modules/Template/Stash.html
  59. +2 −2 docs/src/Modules/Template/Test.html
  60. +50 −1 docs/src/Release/Changes.html
  61. +9 −9 docs/src/Release/README.html
  62. +1 −1 docs/src/Release/TODO.html
  63. +2 −2 docs/src/Tools/tpage.html
  64. +2 −2 docs/src/Tools/ttree.html
  65. +1 −1 docs/src/Tutorial/Datafile.html
  66. +1 −1 docs/src/Tutorial/Web.html
  67. +28 −1 docsrc/src/Release/Changes.tt2
  68. BIN images/splash/black/horz.gif
  69. +2 −2 lib/Template.pm
  70. +2 −2 lib/Template/Base.pm
  71. +2 −2 lib/Template/Config.pm
  72. +2 −2 lib/Template/Constants.pm
  73. +2 −2 lib/Template/Context.pm
  74. +5 −4 lib/Template/Document.pm
  75. +2 −2 lib/Template/Exception.pm
  76. +3 −3 lib/Template/FAQ.pod
  77. +2 −2 lib/Template/Filters.pm
  78. +2 −2 lib/Template/Iterator.pm
  79. +3 −3 lib/Template/Library/HTML.pod
  80. +3 −3 lib/Template/Library/PostScript.pod
  81. +3 −3 lib/Template/Library/Splash.pod
  82. +1 −1 lib/Template/Manual.pod
  83. +1 −1 lib/Template/Manual/Config.pod
  84. +1 −1 lib/Template/Manual/Credits.pod
  85. +1 −1 lib/Template/Manual/Directives.pod
  86. +1 −1 lib/Template/Manual/Filters.pod
  87. +1 −1 lib/Template/Manual/Internals.pod
  88. +1 −1 lib/Template/Manual/Intro.pod
  89. +1 −1 lib/Template/Manual/Plugins.pod
  90. +1 −1 lib/Template/Manual/Refs.pod
  91. +1 −1 lib/Template/Manual/Syntax.pod
  92. +1 −1 lib/Template/Manual/Variables.pod
  93. +1 −1 lib/Template/Manual/Views.pod
  94. +1 −1 lib/Template/Modules.pod
  95. +3 −4 lib/Template/Parser.pm
  96. +2 −2 lib/Template/Plugin.pm
  97. +2 −2 lib/Template/Plugin/Autoformat.pm
  98. +2 −2 lib/Template/Plugin/CGI.pm
  99. +1 −1 lib/Template/Plugin/DBI.pm
  100. +2 −2 lib/Template/Plugin/Datafile.pm
  101. +2 −2 lib/Template/Plugin/Date.pm
  102. +2 −2 lib/Template/Plugin/Directory.pm
  103. +2 −2 lib/Template/Plugin/Dumper.pm
  104. +2 −2 lib/Template/Plugin/File.pm
  105. +2 −2 lib/Template/Plugin/Format.pm
  106. +2 −2 lib/Template/Plugin/GD/Constants.pm
  107. +2 −2 lib/Template/Plugin/GD/Graph/area.pm
  108. +2 −2 lib/Template/Plugin/GD/Graph/bars.pm
  109. +2 −2 lib/Template/Plugin/GD/Graph/bars3d.pm
  110. +2 −2 lib/Template/Plugin/GD/Graph/lines.pm
  111. +2 −2 lib/Template/Plugin/GD/Graph/lines3d.pm
  112. +2 −2 lib/Template/Plugin/GD/Graph/linespoints.pm
  113. +2 −2 lib/Template/Plugin/GD/Graph/mixed.pm
  114. +2 −2 lib/Template/Plugin/GD/Graph/pie.pm
  115. +2 −2 lib/Template/Plugin/GD/Graph/pie3d.pm
  116. +2 −2 lib/Template/Plugin/GD/Graph/points.pm
  117. +2 −2 lib/Template/Plugin/GD/Image.pm
  118. +2 −2 lib/Template/Plugin/GD/Polygon.pm
  119. +2 −2 lib/Template/Plugin/GD/Text.pm
  120. +2 −2 lib/Template/Plugin/GD/Text/Align.pm
  121. +2 −2 lib/Template/Plugin/GD/Text/Wrap.pm
  122. +2 −2 lib/Template/Plugin/HTML.pm
  123. +2 −2 lib/Template/Plugin/Iterator.pm
  124. +2 −2 lib/Template/Plugin/Pod.pm
  125. +2 −2 lib/Template/Plugin/Table.pm
  126. +2 −2 lib/Template/Plugin/URL.pm
  127. +2 −2 lib/Template/Plugin/View.pm
  128. +2 −2 lib/Template/Plugin/Wrap.pm
  129. +1 −1 lib/Template/Plugin/XML/DOM.pm
  130. +2 −2 lib/Template/Plugin/XML/RSS.pm
  131. +2 −2 lib/Template/Plugin/XML/Simple.pm
  132. +2 −2 lib/Template/Plugin/XML/XPath.pm
  133. +2 −2 lib/Template/Plugins.pm
  134. +83 −41 lib/Template/Provider.pm
  135. +2 −2 lib/Template/Service.pm
  136. +2 −2 lib/Template/Stash.pm
  137. +2 −2 lib/Template/Stash/Context.pm
  138. +2 −2 lib/Template/Test.pm
  139. +2 −2 lib/Template/Tools/tpage.pod
  140. +2 −2 lib/Template/Tools/ttree.pod
  141. +1 −1 lib/Template/Tutorial.pod
  142. +1 −1 lib/Template/Tutorial/Datafile.pod
  143. +1 −1 lib/Template/Tutorial/Web.pod
  144. +1 −1 t/compile3.t
  145. +6 −1 t/compile4.t
  146. +22 −4 t/compile5.t
  147. +7 −0 t/html.t
  148. +1 −0 t/test/src/blam
View
51 Changes
@@ -3,7 +3,7 @@
# Changes
#
# DESCRIPTION
-# Revision history for the Template Toolkit version 2.04, detailing
+# Revision history for the Template Toolkit version 2.04b, detailing
# significant changes between versions, most recent first. Some
# way down the file you'll find a section detailing major changes from
# version 1.* to 2.* and a list of "Gotchas!" that you might have to
@@ -17,6 +17,55 @@
#========================================================================
#------------------------------------------------------------------------
+# Version 2.04b - 04 Aug 2001 ## DEVELOPER RELEASE ##
+#------------------------------------------------------------------------
+
+* Fixed a bug in the Makefile.PL which prevented the correct targets
+ from being added to the generated Makefile to install additional
+ components, build HTML docs, etc.
+
+* Applied a patch from Chris Nandor to fix a bug introduced by the taint
+ checks in 2.04 which barfed on ';' in filenames. Also changes open()
+ to sysopen() in Template::Document for additional security. See
+ http://www.tt2.org/pipermail/templates/2001-August/001348.html
+
+* Another part of the same pudge patch adds FACTORY as a default value
+ to Template::Parser to allow Template::Directive factory class to
+ be replaced.
+
+
+#------------------------------------------------------------------------
+# Version 2.04a - 5th July 2001 ## DEVELOPER RELEASE ##
+#------------------------------------------------------------------------
+
+* Changed GD plugin and tests to require GD version 1.20. See
+ http://www.tt2.org/pipermail/templates/2001-July/001212.html
+
+* Applied Craig's fix for the DBI plugin to correctly destroy a
+ statement handle to ensure that finish() gets called on it even if the
+ iterator doesn't complete. See:
+ http://www.tt2.org/pipermail/templates/2001-July/001216.html
+
+* Further to Craig's points in the above post, I added get_all() and
+ get() to the DBI iterator so that you can now do this:
+
+ [% people = DBI.query(...) %]
+ [% person = people.get %] # first person
+ [% person = people.get %] # second person
+ [% FOREACH person = people.get_all %]
+ # third to nth person(s)
+ [% END %]
+
+* Fixed Template::Provider which wasn't saving compiled templates to
+ disk when specified with an absolute path, as reported by Merlyn. See
+ http://www.template-toolkit.org/pipermail/templates/2001-July/001213.html
+
+* Updated Makefile.PL to accept various command line args including
+ TT_ACCEPT to automatically accept all default values and TT_QUIET to
+ shut the file up with all those yackety yack, yack messages.
+
+
+#------------------------------------------------------------------------
# Version 2.04 - 29th June 2001
#------------------------------------------------------------------------
View
2 MANIFEST
@@ -333,6 +333,7 @@ images/splash/black/brhair.gif
images/splash/black/diamond.gif
images/splash/black/dot.gif
images/splash/black/down.gif
+images/splash/black/horz.gif
images/splash/black/left.gif
images/splash/black/minus.gif
images/splash/black/negbox.gif
@@ -532,6 +533,7 @@ t/test/src/bar/baz
t/test/src/bar/baz.txt
t/test/src/baz
t/test/src/benchmark
+t/test/src/blam
t/test/src/complex
t/test/src/evalperl
t/test/src/foo
View
3 MANIFEST.SKIP
@@ -15,6 +15,8 @@
^todo/
^junk/
^lib/Template/Stash/Shout
+^lib/Template/Stash/Faster
+^lib/Template/Docset
^lib/Template/Plugin/XML/View
^pm_to_blib$
^bin/prep
@@ -32,4 +34,5 @@
^examples/html/(?!README)
^t/dbi_test.cfg
^t/shout.t
+^t/docset.t
^t/test/src/complex.org
View
749 Makefile.PL
@@ -1,23 +1,88 @@
-use ExtUtils::MakeMaker; # -*-perl-*-
+#!/usr/bin/perl -w # -*- perl -*-
+
+use strict;
+
+use lib qw( ./lib );
+use Template;
+use ExtUtils::MakeMaker;
use Cwd;
select STDERR;
$| = 1;
select STDOUT;
-use vars qw( $TT_INST_ROOT $TT_IMAGES $TT_RUN_DBI
+use vars qw( $TT_VERSION $TT_PREFIX $TT_IMAGES $TT_RUN_DBI
$TT_BUILD_DOCS $TT_SPLASH_DOCS $TT_EXAMPLES
- $TT_LATEX_PATH $TT_PDFLATEX_PATH $TT_DVIPS_PATH $TT_LATEX_ENABLE
- $TT_SPLASH_THEME );
+ $TT_LATEX_ENABLE $TT_LATEX_PATH $TT_PDFLATEX_PATH $TT_DVIPS_PATH
+ $TT_SPLASH_THEME $TT_QUIET $TT_ACCEPT $TT_YES );
+
+# check O/S to set sensible defaults
+my ($WIN32, $FLAVOUR, $PREFIX, $MAKE);
+if ($^O =~ /win/i) {
+ $WIN32 = 1;
+ $FLAVOUR = 'Win32';
+ $PREFIX = 'C:/Program Files/Template Toolkit 2';
+ $MAKE = 'nmake';
+}
+else {
+ $WIN32 = 0;
+ $FLAVOUR = 'Unix';
+ $PREFIX = '/usr/local/tt2';
+ $MAKE = 'make';
+}
+
+# read command line args
+my (%config, %ttconfig);
+while ($_ = shift) {
+ my ($k, $v) = split(/=/);
+ if ($k =~ /^TT/) {
+ $ttconfig{ $k } = $v || 0;
+ }
+ else {
+ $config{ $k } = $v || 0;
+ }
+};
+
+if (exists $ttconfig{ TT_HELP }) {
+ print <<EOF;
+The following options can be specified as command line
+arguments to 'perl Makefile.PL'. e.g.
+
+ perl Makefile.PL TT_PREFIX=/my/tt2/dir TT_ACCEPT=y
+
+ TT_PREFIX installation prefix ($PREFIX)
+ TT_IMAGES images URL (/tt2/images)
+ TT_DOCS build HTML docs (y)
+ TT_SPLASH use Splash! for docs (y)
+ TT_THEME Splash! theme (default)
+ TT_EXAMPLES build HTML examples (y)
+ TT_DBI run DBI tests (y if DBI installed)
+ TT_LATEX install LaTeX filter (y if LaTeX found)
+ TT_QUIET no messages (n)
+ TT_ACCEPT accept defaults (n)
+
+By default, the Makefile.PL runs in interactive mode,
+prompting for confirmation of the various configuration
+options. Setting the TT_ACCEPT option causes the default
+value (possibly modified by other command line options)
+to be accepted. The TT_QUIET option can also be set to
+suppress the prompt messages.
+
+EOF
+ exit(0);
+}
-$TT_INST_ROOT = '/usr/local/tt2';
+$TT_VERSION = $Template::VERSION;
+$TT_PREFIX = $PREFIX;
$TT_IMAGES = '/tt2/images';
$TT_RUN_DBI = 'y';
$TT_BUILD_DOCS = 'y';
$TT_SPLASH_DOCS = 'y';
$TT_EXAMPLES = 'y';
$TT_SPLASH_THEME = 'default';
-$TT_LATEX_ENABLE = '';
+$TT_LATEX_ENABLE = 'y';
+$TT_QUIET = 'n';
+$TT_ACCEPT = 'n';
my $TT_SPLASH_FG = '';
my $TT_SPLASH_BG = '';
@@ -26,22 +91,31 @@ my $DEFAULTS_FILE = '.defaults.cfg';
my $DBI_CONFIG_FILE = 't/dbi_test.cfg';
my $TT_DOCS_CFG = 'docs/ttree.cfg';
my $TT_EXAMPLE_CFG = 'examples/ttree.cfg';
-my $MAKE = 'make';
-
-my $WIN32 = ($^O =~ /win/i);
-my $FLAVOUR = $WIN32 ? 'Win32' : 'Unix';
my $DEFAULTS = '';
-if ($WIN32) {
- $TT_INST_ROOT = 'C:/Program Files/Template Toolkit 2';
- $MAKE = 'nmake';
-}
-
if (-f $DEFAULTS_FILE) {
require $DEFAULTS_FILE;
$DEFAULTS = " read from '$DEFAULTS_FILE'";
}
+$TT_PREFIX = $ttconfig{ TT_PREFIX } if defined $ttconfig{ TT_PREFIX };
+$TT_IMAGES = $ttconfig{ TT_IMAGES } if defined $ttconfig{ TT_IMAGES };
+$TT_RUN_DBI = $ttconfig{ TT_DBI } if defined $ttconfig{ TT_DBI };
+$TT_BUILD_DOCS = $ttconfig{ TT_DOCS } if defined $ttconfig{ TT_DOCS };
+$TT_SPLASH_DOCS = $ttconfig{ TT_SPLASH } if defined $ttconfig{ TT_SPLASH };
+$TT_EXAMPLES = $ttconfig{ TT_EXAMPLES } if defined $ttconfig{ TT_EXAMPLES };
+$TT_SPLASH_THEME = $ttconfig{ TT_THEME } if defined $ttconfig{ TT_THEME };
+$TT_LATEX_ENABLE = $ttconfig{ TT_LATEX } if defined $ttconfig{ TT_LATEX };
+$TT_QUIET = $ttconfig{ TT_QUIET } if defined $ttconfig{ TT_QUIET };
+$TT_ACCEPT = $ttconfig{ TT_ACCEPT } if defined $ttconfig{ TT_ACCEPT };
+
+foreach ($TT_RUN_DBI, $TT_BUILD_DOCS, $TT_SPLASH_DOCS, $TT_EXAMPLES, $TT_LATEX_ENABLE) {
+ $_ = 'n' if ! $_;
+}
+$TT_ACCEPT = 0 if $TT_ACCEPT eq 'n';
+$TT_QUIET = 0 if $TT_QUIET eq 'n';
+$TT_QUIET = 0 unless $TT_ACCEPT;
+
my $SPLASH_STYLES = {
default => [ 'lilac', 'mauve' ],
aqua => [ 'aqua', 'marine' ],
@@ -49,27 +123,158 @@ my $SPLASH_STYLES = {
blue => [ 'grey75', 'blue75' ],
red => [ 'grey75', 'red75' ],
green => [ 'grey75', 'green75' ],
-# weedz => [ 'bud', 'leaf' ],
};
-print <<EOF;
- Template Toolkit Version 2.03
+#========================================================================
+
+welcome_message();
+version_check();
+mandatory_modules();
+optional_modules();
+optional_latex();
+optional_extras();
+splash_images();
+html_docs();
+html_docstyle();
+html_examples();
+write_defaults();
+
+print "\n";
+
+
+#------------------------------------------------------------------------
+# build options and write Makefile
+#------------------------------------------------------------------------
+
+package MY;
+
+sub postamble {
+ return '' unless $main::TT_PREFIX;
+ my $amble =<<'EOF';
+tt2_install ::
+ @$(PERL) bin/tt2inst -v "$(TT_PREFIX)"
+
+tt2_splash ::
+ @$(PERL) -I lib bin/gifsplash -v
+
+EOF
+ $amble .=<<EOF if $main::TT_BUILD_DOCS;
+tt2_html_docs ::
+ \@\$(PERL) bin/ttree -v -f "\$(TT_PREFIX)/$TT_DOCS_CFG"
+
+EOF
+ $amble .=<<EOF if $main::TT_EXAMPLES;
+tt2_examples ::
+ \@\$(PERL) bin/ttree -v -f "\$(TT_PREFIX)/$TT_EXAMPLE_CFG"
+
+EOF
+ return $amble;
+}
+
+sub install {
+ my $class = shift;
+ my $basic = $class->SUPER::install(@_);
+ my $add = 'tt2_install tt2_splash';
+ $add .= ' tt2_html_docs' if $main::TT_BUILD_DOCS;
+ $add .= ' tt2_examples' if $main::TT_EXAMPLES;
+ $basic =~ s/^(install\s+::\s+.*)$/$1 $add/m
+ if $main::TT_PREFIX;
+ $basic;
+}
+
+sub constants {
+ my $class = shift;
+ my $basic = $class->SUPER::constants(@_);
+ $basic = "TT_PREFIX = $main::TT_PREFIX\n$basic"
+ if $main::TT_PREFIX;
+ $basic;
+}
+
+package main;
+
+my %opts = (
+ %config,
+ 'NAME' => 'Template',
+ 'DISTNAME' => 'Template-Toolkit',
+ 'VERSION_FROM' => 'lib/Template.pm',
+ 'EXE_FILES' => [ 'bin/tpage', 'bin/ttree' ],
+ 'PMLIBDIRS' => [ 'lib' ],
+ 'PREREQ_PM' => { 'AppConfig' => 1.52 },
+ 'dist' => {
+ 'COMPRESS' => 'gzip',
+ 'SUFFIX' => 'gz',
+# 'PREOP' => build_docs(),
+ },
+);
+
+if ($ExtUtils::MakeMaker::VERSION >= 5.43) {
+ $opts{ AUTHOR } = 'Andy Wardley <abw@kfs.org>';
+ $opts{ ABSTRACT } =
+ 'a fast, flexible and extensible template processing system',
+}
+
+
+WriteMakefile( %opts );
+
+if ($WIN32) {
+ print <<EOF;
+
+Configuration complete. You should now run '$MAKE', '$MAKE test' and
+then '$MAKE install'. See the README file for further information.
+EOF
+}
+
+message(<<EOF) if $TT_BUILD_DOCS;
+
+Please note that the installation of the optional components and
+building of the HTML documentation is performed at the "make install"
+stage as the effective user at that time. This implies that this user
+must have sufficient permission to install into the specified
+directory and that all created directories and files will be owned by
+them.
+
+EOF
+
+#========================================================================
+
+
+
+#------------------------------------------------------------------------
+# welcome_message()
+#
+# Print opening banner.
+#------------------------------------------------------------------------
+
+sub welcome_message {
+ print(<<EOF);
+
+ Template Toolkit Version $TT_VERSION
=============================
Using $FLAVOUR defaults$DEFAULTS.
EOF
+ print "Messages suppressed (TT_QUIET). " if $TT_QUIET;
+ print "Accepting defaults automatically (TT_ACCEPT)." if $TT_ACCEPT;
+ print "\nRun 'perl Makefile.PL TT_HELP' for further info.\n"
+ if $TT_QUIET || $TT_ACCEPT;
+}
+
+
#------------------------------------------------------------------------
-# check for pre-version 2.00 installation and issue warning
+# version_check()
+#
+# Check for pre-version 2.00 installation and issue warning
#------------------------------------------------------------------------
-eval "use Template";
-unless ($@ or $Template::VERSION =~ /^2/) {
- warn(<<EOF);
+sub version_check {
+ eval "use Template";
+ unless ($@ or $Template::VERSION =~ /^2/) {
+ warn(<<EOF) unless $TT_QUIET;
IMPORTANT NOTE:
----------------
+
You have version $Template::VERSION of the Template Toolkit installed.
There are some minor incompatabilities between version 1 and 2
@@ -84,16 +289,21 @@ IMPORTANT NOTE:
painless.
EOF
- exit unless prompt("Do you want to continue?", 'y') =~ /y/i;
+ exit unless ttprompt("Do you want to continue?", 'y') =~ /y/i;
+ }
}
+
#------------------------------------------------------------------------
-# detect mandatory module
+# mandatory_modules()
+#
+# Detect mandatory module
#------------------------------------------------------------------------
-eval "use AppConfig";
-if ($@ or $AppConfig::VERSION < 1.52) {
- die(<<EOF);
+sub mandatory_modules {
+ eval "use AppConfig";
+ if ($@ or $AppConfig::VERSION < 1.52) {
+ die(<<EOF);
The Template Toolkit requires that the AppConfig module (version 1.52
or later) first be installed. This is used by the 'ttree' program for
@@ -103,11 +313,11 @@ from CPAN:
http://www.cpan.org/authors/Andy_Wardley/
EOF
-}
+ }
-eval "use File::Spec";
-if ($@ or $File::Spec::VERSION < 0.6) {
- die(<<EOF);
+ eval "use File::Spec";
+ if ($@ or $File::Spec::VERSION < 0.6) {
+ die(<<EOF);
The Template Toolkit requires that the File::Spec module (version 0.6
or later) first be installed. This is used by the File plugin. It is
@@ -116,14 +326,19 @@ available from CPAN:
http://search.cpan.org/search?dist=File-Spec
EOF
+ }
}
+
#------------------------------------------------------------------------
-# detect additional modules required by plugins (just for fun)
+# optional_modules()
+#
+# Detect additional modules required by plugins (just for fun)
#------------------------------------------------------------------------
-print <<EOF;
+sub optional_modules {
+ message(<<EOF);
The Template Toolkit includes a number of plugin modules, some of
which interface to external Perl modules available from CPAN. All the
@@ -134,41 +349,50 @@ available on your system.
EOF
-foreach my $mods ( [ Text::Autoformat => \&check_taf ],
- [ GD => undef ],
- [ GD::Text => undef ],
- [ GD::Graph => undef ],
- [ GD::Graph3d => undef ],
- [ Date::Calc => undef ],
- [ XML::DOM => \&check_dom ],
- [ XML::RSS => \&check_rss ],
- [ XML::XPath => \&check_xpath ],
- [ DBI => \&dbi_config ] ) {
- my ($module, $code) = ref $mods ? @$mods : ($mods, 0);
-
- printf(" %-16s ", $module);
- eval "use $module";
- if ($@) {
- nope("module not installed");
- }
- elsif ($code) {
- &$code;
- }
- else {
- no strict qw( refs );
- my $ver = ${"$module\::VERSION"};
- yep("version $ver installed");
+ foreach my $mods ( [ 'Text::Autoformat' => \&check_taf ],
+ [ 'GD' => undef ],
+ [ 'GD::Text' => undef ],
+ [ 'GD::Graph' => undef ],
+ [ 'GD::Graph3d' => undef ],
+ [ 'Date::Calc' => undef ],
+ [ 'XML::DOM' => \&check_dom ],
+ [ 'XML::RSS' => \&check_rss ],
+ [ 'XML::XPath' => \&check_xpath ],
+ [ 'DBI' => \&dbi_config ] ) {
+ my ($module, $code) = ref $mods ? @$mods : ($mods, 0);
+
+ printf(" %-16s ", $module) unless $TT_QUIET;
+ eval "use $module";
+ if ($@) {
+ nope("module not installed");
+ }
+ elsif ($code) {
+ &$code;
+ }
+ else {
+ no strict qw( refs );
+ my $ver = ${"$module\::VERSION"};
+ yep("version $ver installed");
+ }
}
}
+
+
#------------------------------------------------------------------------
-# prompt for installation of latex filter
+# optional_latex()
+#
+# Prompt for installation of latex filter
#------------------------------------------------------------------------
-$TT_LATEX_PATH ||= findProgram($ENV{PATH}, "latex") || '';
-$TT_PDFLATEX_PATH ||= findProgram($ENV{PATH}, "pdflatex") || '';
-$TT_DVIPS_PATH ||= findProgram($ENV{PATH}, "dvips") || '';
-print <<EOF;
+sub optional_latex {
+ return if ! $TT_LATEX_ENABLE || $TT_LATEX_ENABLE eq 'n';
+
+ $TT_LATEX_PATH ||= findProgram($ENV{PATH}, "latex") || '';
+ $TT_PDFLATEX_PATH ||= findProgram($ENV{PATH}, "pdflatex") || '';
+ $TT_DVIPS_PATH ||= findProgram($ENV{PATH}, "dvips") || '';
+
+ message(<<EOF);
TT2 supports PDF, DVI and PostScript output using the latex filter,
implemented with the programs pdflatex, latex and dvips.
@@ -187,36 +411,42 @@ I found the following locations for pdflatex, latex and dvips:
EOF
-if ( $TT_LATEX_PATH eq "" || $TT_PDFLATEX_PATH eq "" || $TT_DVIPS_PATH eq "" ) {
- $TT_LATEX_ENABLE = 'n';
-}
-$TT_LATEX_ENABLE ||= 'y';
-$TT_LATEX_ENABLE = (
- prompt('Do you want to enable the latex filter?',
- $TT_LATEX_ENABLE) =~ /^y/i
-);
-if ( $TT_LATEX_ENABLE ) {
- if (prompt('Are the pdflatex, latex and dvips paths ok?', 'y') !~ /^y/i) {
- $TT_PDFLATEX_PATH = prompt('pdflatex path', $TT_PDFLATEX_PATH);
- $TT_LATEX_PATH = prompt('latex path', $TT_LATEX_PATH);
- $TT_DVIPS_PATH = prompt('dvips path', $TT_DVIPS_PATH);
+ if ( $TT_LATEX_PATH eq "" || $TT_PDFLATEX_PATH eq "" || $TT_DVIPS_PATH eq "" ) {
+ $TT_LATEX_ENABLE = 'n';
+ }
+ $TT_LATEX_ENABLE ||= 'y';
+ $TT_LATEX_ENABLE = (
+ ttprompt('Do you want to enable the latex filter?',
+ $TT_LATEX_ENABLE) =~ /^y/i
+ );
+ if ( $TT_LATEX_ENABLE ) {
+ if (ttprompt('Are the pdflatex, latex and dvips paths ok?', 'y') !~ /^y/i) {
+ $TT_PDFLATEX_PATH = ttprompt('pdflatex path', $TT_PDFLATEX_PATH);
+ $TT_LATEX_PATH = ttprompt('latex path', $TT_LATEX_PATH);
+ $TT_DVIPS_PATH = ttprompt('dvips path', $TT_DVIPS_PATH);
+ }
+ } else {
+ #
+ # Empty paths will cause the latex filter to throw an error
+ #
+ $TT_PDFLATEX_PATH = $TT_LATEX_PATH = $TT_DVIPS_PATH = "";
}
-} else {
- #
- # Empty paths will cause the latex filter to throw an error
- #
- $TT_PDFLATEX_PATH = $TT_LATEX_PATH = $TT_DVIPS_PATH = "";
+
+ fix_file('lib/Template/Config.pm', '$PDFLATEX_PATH', $TT_PDFLATEX_PATH);
+ fix_file('lib/Template/Config.pm', '$LATEX_PATH', $TT_LATEX_PATH);
+ fix_file('lib/Template/Config.pm', '$DVIPS_PATH', $TT_DVIPS_PATH);
}
-fix_file('lib/Template/Config.pm', '$PDFLATEX_PATH', $TT_PDFLATEX_PATH);
-fix_file('lib/Template/Config.pm', '$LATEX_PATH', $TT_LATEX_PATH);
-fix_file('lib/Template/Config.pm', '$DVIPS_PATH', $TT_DVIPS_PATH);
+
#------------------------------------------------------------------------
-# prompt for installation of optional libraries and other components
+# optional_extras()
+#
+# Prompt for installation of optional libraries and other components
#------------------------------------------------------------------------
-print <<EOF;
+sub optional_extras {
+ message(<<EOF);
In additional to the Perl modules and POD documentation installed in
the usual way, the Template Toolkit distribution also contains a
@@ -237,8 +467,8 @@ specify a separate directory for them.
EOF
-if (prompt('Do you want to install these components?', 'y') =~ /^y/i) {
- print <<EOF;
+ if (ttprompt('Do you want to install these components?', 'y') =~ /^y/i) {
+ message(<<EOF);
You can chose any directory for the installation of the additional
Template Toolkit components. The proposed default assumes a $FLAVOUR
@@ -246,37 +476,41 @@ flavour to your operating system (suggestions for suitable defaults
for other platforms welcome).
EOF
- $TT_INST_ROOT = prompt('Installation directory',
- $TT_INST_ROOT);
-}
-else {
- $TT_INST_ROOT = '';
+ $TT_PREFIX = ttprompt('Installation directory', $TT_PREFIX);
+ }
+ else {
+ $TT_PREFIX = '';
+ }
+
+ fix_file('lib/Template/Config.pm', '$INSTDIR', $TT_PREFIX);
}
-fix_file('lib/Template/Config.pm', '$INSTDIR', $TT_INST_ROOT);
#------------------------------------------------------------------------
-# prompt for Splash! image URL
+# splash_images()
+#
+# Prompt for Splash! image URL
#------------------------------------------------------------------------
-if ($TT_INST_ROOT) {
+sub splash_images {
+ return unless $TT_PREFIX;
- print <<EOF;
+ message(<<EOF);
The Splash! template library uses a number of (very) small images to
build user interface components. These will be installed into the
directory:
- $TT_INST_ROOT/images
+ $TT_PREFIX/images
EOF
if ($WIN32) {
# default images value for Win32 to browse via file system
- $TT_IMAGES = "$TT_INST_ROOT/images";
-
- print <<EOF;
-
+ $TT_IMAGES = "$TT_PREFIX/images";
+
+ message(<<EOF);
+
If you want to use the Splash! library then you'll need to make sure
you can access these images via your browser. If you want to deliver
pages via a web server then you'll need to specify the URL that can be
@@ -286,7 +520,7 @@ default and access the images via the filesystem.
EOF
}
else {
- print <<EOF;
+ message(<<EOF);
If you want to use the Splash! library then you'll need to copy these
images, define an alias (e.g. in the httpd.conf) or create a symbolic
@@ -304,21 +538,26 @@ manpage at your leisure to find out more).
EOF
}
- $TT_IMAGES = prompt('URL base for TT2 images?', $TT_IMAGES);
+ $TT_IMAGES = ttprompt('URL base for TT2 images?', $TT_IMAGES);
$TT_IMAGES =~ s[/$][]g; # just in case
fix_file('templates/splash/config', 'images', "$TT_IMAGES/splash");
}
-if ($TT_INST_ROOT) {
+#------------------------------------------------------------------------
+# html_docs()
+#
+# Prompt for HTML documentation build
+#--------------------------------------------------------------------
+
+sub html_docs {
+ return unless $TT_PREFIX;
+
my $style = 'plain';
my $style_cfg = '';
- #--------------------------------------------------------------------
- # prompt for HTML documentation build
- #--------------------------------------------------------------------
- print <<EOF;
+ message(<<EOF);
The modules comprising the Template Toolkit contain comprehensive POD
documentation which can be browsed using 'perldoc' or 'man' (if your
@@ -327,7 +566,7 @@ set of source templates and style elements for generating the same
documentation in HTML format. These will be installed in the
directory:
- $TT_INST_ROOT/docs
+ $TT_PREFIX/docs
The HTML documentation can be built for you at "make install" time in
a plain and simple HTML format or using the Splash! library. You can
@@ -339,16 +578,26 @@ online at:
EOF
$TT_BUILD_DOCS = (
- prompt('Do you want to build the HTML documentation?',
+ ttprompt('Do you want to build the HTML documentation?',
$TT_BUILD_DOCS) =~ /^y/i
);
- #--------------------------------------------------------------------
- # prompt for docs style: plain or splash
- #--------------------------------------------------------------------
+}
+
+
+#--------------------------------------------------------------------
+# html_docstyle()
+#
+# prompt for docs style: plain or splash
+#--------------------------------------------------------------------
+
+sub html_docstyle {
+ return unless $TT_PREFIX && $TT_BUILD_DOCS;
+
+ my $style = 'plain';
+ my $style_cfg = '';
- if ($TT_BUILD_DOCS) {
- print <<EOF;
+ message(<<EOF);
If you want to build the HTML documentation using the Splash! library
then you'll need to make sure you correctly defined the URL for the
@@ -356,19 +605,19 @@ Splash! images above. Otherwise, answer 'n' to the next question to
use plain HTML.
EOF
- $TT_SPLASH_DOCS = (
- prompt('Do you want to use the Splash! library?',
- $TT_SPLASH_DOCS) =~ /^y/i
- );
+ $TT_SPLASH_DOCS = (
+ ttprompt('Do you want to use the Splash! library?', $TT_SPLASH_DOCS) =~ /^y/i
+ );
- if ($TT_SPLASH_DOCS) {
- my $splash_style = '';
- print <<EOF;
+ if ($TT_SPLASH_DOCS) {
+ my $splash_style = '';
+ message(<<EOF);
Which Splash! colour scheme would you like to use to build the
documentation? Acceptable values are:
EOF
+ unless ($TT_QUIET) {
print " Name Colours\n -------------------------\n";
foreach my $t ('default',
grep { ! /^default$/ } sort keys %$SPLASH_STYLES) {
@@ -379,8 +628,8 @@ EOF
print "\n";
while (! $splash_style) {
- $TT_SPLASH_THEME = prompt("Enter name of colour scheme: ", $TT_SPLASH_THEME);
- print("! No such scheme\n"), $TT_SPLASH_THEME = 'default'
+ $TT_SPLASH_THEME = ttprompt("Enter name of colour scheme: ", $TT_SPLASH_THEME);
+ message("! No such scheme\n"), $TT_SPLASH_THEME = 'default'
unless ($splash_style = $SPLASH_STYLES->{ $TT_SPLASH_THEME });
}
($TT_SPLASH_BG, $TT_SPLASH_FG) = @$splash_style;
@@ -405,11 +654,11 @@ EOF
# the Makefile.PL installation script. Feel free to edit it
# but be warned that re-installing the Template Toolkit will
# overwrite your changes.
-src = $TT_INST_ROOT/docs/src
-dest = $TT_INST_ROOT/docs/html
-lib = $TT_INST_ROOT/docs/style/$style
-lib = $TT_INST_ROOT/docs/lib
-lib = $TT_INST_ROOT/templates
+src = $TT_PREFIX/docs/src
+dest = $TT_PREFIX/docs/html
+lib = $TT_PREFIX/docs/style/$style
+lib = $TT_PREFIX/docs/lib
+lib = $TT_PREFIX/templates
$style_cfg
pre_process = config
pre_process = header
@@ -418,17 +667,26 @@ recurse
verbose
EOF
close(FP);
+}
- #--------------------------------------------------------------------
- # prompt for building examples
- #--------------------------------------------------------------------
- print <<EOF;
+
+
+#--------------------------------------------------------------------
+# html_examples()
+#
+# Prompt for building examples
+#--------------------------------------------------------------------
+
+sub html_examples {
+ return unless $TT_PREFIX;
+
+ message(<<EOF);
A number of examples showing use of the HTML, Splash! and PostScript
libraries will be installed into:
- $TT_INST_ROOT/examples
+ $TT_PREFIX/examples
As with the documentation, the examples are provided in template form
and can be automatically built into HTML pages during the "make
@@ -438,7 +696,7 @@ images URL to be correctly defined for correct viewing.
EOF
$TT_EXAMPLES = (
- prompt('Do you want to build the HTML example pages?',
+ ttprompt('Do you want to build the HTML example pages?',
$TT_EXAMPLES) =~ /^y/i
);
@@ -453,10 +711,10 @@ EOF
# but be warned that re-installing the Template Toolkit will
# overwrite your changes.
-src = $TT_INST_ROOT/examples/src
-dest = $TT_INST_ROOT/examples/html
-lib = $TT_INST_ROOT/examples/lib
-lib = $TT_INST_ROOT/templates
+src = $TT_PREFIX/examples/src
+dest = $TT_PREFIX/examples/html
+lib = $TT_PREFIX/examples/lib
+lib = $TT_PREFIX/templates
define splash_fg = '$TT_SPLASH_FG'
define splash_bg = '$TT_SPLASH_BG'
pre_process = config
@@ -466,15 +724,20 @@ EOF
close(FP);
}
- #--------------------------------------------------------------------
- # write configuration defaults to file
- #--------------------------------------------------------------------
+
+
+#--------------------------------------------------------------------
+# write_defaults()
+#
+# write configuration defaults to file
+#--------------------------------------------------------------------
+
+sub write_defaults {
open(FP, "> $DEFAULTS_FILE") || die "$DEFAULTS_FILE: $!\n";
my ($ttdbi, $ttdocs, $ttsplash, $ttex, $ttlatex) = map { $_ ? 'y' : 'n' }
- ( $TT_RUN_DBI, $TT_BUILD_DOCS, $TT_SPLASH_DOCS, $TT_EXAMPLES,
- $TT_LATEX_ENABLE );
+ ( $TT_RUN_DBI, $TT_BUILD_DOCS, $TT_SPLASH_DOCS, $TT_EXAMPLES, $TT_LATEX_ENABLE );
print FP <<EOF;
-\$TT_INST_ROOT = '$TT_INST_ROOT';
+\$TT_PREFIX = '$TT_PREFIX';
\$TT_IMAGES = '$TT_IMAGES';
\$TT_RUN_DBI = '$ttdbi';
\$TT_BUILD_DOCS = '$ttdocs';
@@ -485,107 +748,13 @@ EOF
\$TT_LATEX_PATH = '$TT_LATEX_PATH';
\$TT_PDFLATEX_PATH = '$TT_PDFLATEX_PATH';
\$TT_DVIPS_PATH = '$TT_DVIPS_PATH';
+\$TT_ACCEPT = '$TT_ACCEPT';
+\$TT_QUIET = '$TT_QUIET';
1;
EOF
close(FP);
-
-print "\n";
-
-
-#------------------------------------------------------------------------
-# build options and write Makefile
-#------------------------------------------------------------------------
-
-package MY;
-
-sub postamble {
- return '' unless $main::TT_INST_ROOT;
- my $amble =<<'EOF';
-tt2_install ::
- @$(PERL) bin/tt2inst -v "$(TT_INST_ROOT)"
-
-tt2_splash ::
- @$(PERL) -I lib bin/gifsplash -v
-
-EOF
- $amble .=<<EOF if $main::TT_BUILD_DOCS;
-tt2_html_docs ::
- \@\$(PERL) bin/ttree -v -f "\$(TT_INST_ROOT)/$TT_DOCS_CFG"
-
-EOF
- $amble .=<<EOF if $main::TT_EXAMPLES;
-tt2_examples ::
- \@\$(PERL) bin/ttree -v -f "\$(TT_INST_ROOT)/$TT_EXAMPLE_CFG"
-
-EOF
- return $amble;
-}
-
-sub install {
- my $class = shift;
- my $basic = $class->SUPER::install(@_);
- my $add = 'tt2_install tt2_splash';
- $add .= ' tt2_html_docs' if $main::TT_BUILD_DOCS;
- $add .= ' tt2_examples' if $main::TT_EXAMPLES;
- $basic =~ s/^(install\s+::\s+.*)$/$1 $add/m
- if $main::TT_INST_ROOT;
- $basic;
}
-sub constants {
- my $class = shift;
- my $basic = $class->SUPER::constants(@_);
- $basic = "TT_INST_ROOT = $main::TT_INST_ROOT\n$basic"
- if $main::TT_INST_ROOT;
- $basic;
-}
-
-package main;
-
-my %opts = (
- 'NAME' => 'Template',
- 'DISTNAME' => 'Template-Toolkit',
- 'VERSION_FROM' => 'lib/Template.pm',
- 'EXE_FILES' => [ 'bin/tpage', 'bin/ttree' ],
- 'PMLIBDIRS' => [ 'lib' ],
- 'PREREQ_PM' => { 'AppConfig' => 1.52 },
- 'dist' => {
- 'COMPRESS' => 'gzip',
- 'SUFFIX' => 'gz',
-# 'PREOP' => build_docs(),
- },
-);
-
-if ($ExtUtils::MakeMaker::VERSION >= 5.43) {
- $opts{ AUTHOR } = 'Andy Wardley <abw@kfs.org>';
- $opts{ ABSTRACT } =
- 'a fast, flexible and extensible template processing system',
-}
-
-
-WriteMakefile( %opts );
-
-if ($WIN32) {
- print <<EOF;
-
-Configuration complete. You should now run '$MAKE', '$MAKE test' and
-then '$MAKE install'. See the README file for further information.
-EOF
-}
-
-print <<EOF if $TT_BUILD_DOCS;
-
-Please note that the installation of the optional components and
-building of the HTML documentation is performed at the "make install"
-stage as the effective user at that time. This implies that this user
-must have sufficient permission to install into the specified
-directory and that all created directories and files will be owned by
-them.
-
-EOF
-
-#========================================================================
-
#------------------------------------------------------------------------
# build_docs()
@@ -602,19 +771,6 @@ EOF
}
-#------------------------------------------------------------------------
-# yep($text)
-# nope($text)
-#------------------------------------------------------------------------
-
-sub yep {
- print '[X] ', shift, "\n";
-}
-
-sub nope {
- print '[ ] ', shift, "\n";
-}
-
#------------------------------------------------------------------------
# check_taf()
@@ -671,6 +827,7 @@ sub check_rss {
}
}
+
#------------------------------------------------------------------------
# check_xpath()
#
@@ -695,11 +852,11 @@ sub check_xpath {
#------------------------------------------------------------------------
sub dbi_config {
- my ($dsn, $user, $pass);
+ my ($dsn, $user, $pass) = ('') x 3;
- print "[X] version $DBI::VERSION installed, configuring tests\n\n";
+ message("[X] version $DBI::VERSION installed, configuring tests\n\n");
- if (prompt("Do you want to run the DBI tests?\n" .
+ if (ttprompt("Do you want to run the DBI tests?\n" .
"It requires access to an existing test database.",
$TT_RUN_DBI) =~ /y/i) {
@@ -710,7 +867,7 @@ sub dbi_config {
my $default = (grep(/m.?sql/i, @drivers))[0];
- print <<EOF;
+ message(<<EOF);
Please enter the driver name for the test database.
The DBD drivers installed on your system are
@@ -720,12 +877,12 @@ The DBD drivers installed on your system are
EOF
while (! $driver) {
- $driver = prompt("Enter driver name: ", $default);
- print("! No such DBD driver\n"), undef $driver
+ $driver = ttprompt("Enter driver name: ", $default);
+ message("! No such DBD driver\n"), undef $driver
unless grep(/^$driver$/, @drivers);
}
- print <<EOF;
+ message(<<EOF);
Now enter the data source (DSN) for the test database.
Many DBD drivers require only a database name (e.g. 'test') while
@@ -737,13 +894,13 @@ EOF
my $dbname_eg = $driver eq 'Pg' ? 'dbname=test' : 'test';
while (! $dbname) {
- $dbname = prompt('Database name: ', $dbname_eg);
+ $dbname = ttprompt('Database name: ', $dbname_eg);
}
$dsn = "dbi:$driver:$dbname";
- $user = prompt('Enter user name : ', '');
- $pass = prompt('Enter password : ', '');
+ $user = ttprompt('Enter user name : ', '');
+ $pass = ttprompt('Enter password : ', '');
$user = '' unless defined $user;
$pass = '' unless defined $pass;
@@ -752,7 +909,7 @@ EOF
$TT_RUN_DBI = 0;
}
- print "\nwriting $DBI_CONFIG_FILE\n";
+ message("\nwriting $DBI_CONFIG_FILE\n");
open(CFGFILE, ">$DBI_CONFIG_FILE") || die "$DBI_CONFIG_FILE: $!\n";
print CFGFILE <<EOF;
\$run = $TT_RUN_DBI;
@@ -778,7 +935,6 @@ sub fix_file {
local *FP;
local $/ = undef;
-# print "\nSetting $find in $file to '$fix'\n\n";
$find = quotemeta($find);
open(FP, "< $file") || die "$file: $!\n";
@@ -793,14 +949,16 @@ sub fix_file {
close(FP);
}
-#
+
+#------------------------------------------------------------------------
# findProgram($path, $prog)
#
# Find a program, $prog, by traversing the given directory path, $path.
# Returns full path if the program is found.
#
# Written by Craig Barratt, Richard Tietjen add fixes for Win32.
-#
+#------------------------------------------------------------------------
+
sub findProgram {
my($path, $prog) = @_;
my $sep = $WIN32 ? qr/;/ : qr/:/;
@@ -816,3 +974,56 @@ sub findProgram {
}
}
}
+
+
+#------------------------------------------------------------------------
+# message($text)
+#
+# Print message unless quiet mode.
+#------------------------------------------------------------------------
+
+sub message {
+ return if $TT_QUIET;
+ print @_;
+}
+
+
+#------------------------------------------------------------------------
+# ttprompt($message, $default)
+#------------------------------------------------------------------------
+
+sub ttprompt {
+ my ($msg, $def)=@_;
+ my $ISA_TTY = -t STDIN && (-t STDOUT || !(-f STDOUT || -c STDOUT)) ; # Pipe?
+ my $dispdef = defined $def ? "[$def] " : " ";
+ $def = defined $def ? $def : "";
+ my $ans = '';
+ local $|=1;
+ print "$msg $dispdef" unless $TT_QUIET;
+ if ($TT_ACCEPT || ! $ISA_TTY) {
+ print "$def\n" unless $TT_QUIET;
+ }
+ else {
+ chomp($ans = <STDIN>);
+ }
+ return ($ans ne '') ? $ans : $def;
+}
+
+
+#------------------------------------------------------------------------
+# yep($text)
+#------------------------------------------------------------------------
+
+sub yep {
+ return if $TT_QUIET;
+ print '[X] ', shift, "\n";
+}
+
+
+#------------------------------------------------------------------------
+# nope($text)
+#------------------------------------------------------------------------
+sub nope {
+ return if $TT_QUIET;
+ print '[ ] ', shift, "\n";
+}
View
18 README
@@ -1,9 +1,9 @@
Template Toolkit
- Version 2.04
+ Version 2.04b
- 29 June 2001
+ 04 August 2001
Copyright (C) 1996-2001 Andy Wardley. All Rights Reserved
Copyright (C) 1998-2001 Canon Research Centre Europe Ltd.
@@ -42,8 +42,8 @@ need to install them. They're all available from CPAN if you do.
To install the Template Toolkit:
- tar zxf Template-Toolkit-2.04.tar.gz
- cd Template-Toolkit-2.04
+ tar zxf Template-Toolkit-2.04b.tar.gz
+ cd Template-Toolkit-2.04b
perl Makefile.PL
make
make test
@@ -295,19 +295,19 @@ The Template Toolkit is distributed as a gzipped tar archive file:
Template-Toolkit-<version>.tar.gz
-where <version> represents the current version number, e.g. 2.04.
+where <version> represents the current version number, e.g. 2.04b.
To install the Template Toolkit, unpack the distribution archive to
create an installation directory. Something like this:
- tar zxf Template-Toolkit-2.04.tar.gz
+ tar zxf Template-Toolkit-2.04b.tar.gz
or
- gunzip Template-Toolkit-2.04.tar.gz
- tar xf Template-Toolkit-2.04.tar
+ gunzip Template-Toolkit-2.04b.tar.gz
+ tar xf Template-Toolkit-2.04b.tar
You can then 'cd' into the directory created,
- cd Template-Toolkit-2.04
+ cd Template-Toolkit-2.04b
and perform the usual Perl installation procedure:
View
2 TODO
@@ -3,7 +3,7 @@
# TODO
#
# DESCRIPTION
-# TODO list for the Template Toolkit version 2.04, containing
+# TODO list for the Template Toolkit version 2.04b, containing
# known bugs, limitations, planned enhancements, long term visions
# and a few whacky ideas.
#
View
2 bin/release
@@ -1,6 +1,6 @@
docsrc/bin/ttmkdocs \
&& docsrc/bin/ttpodglu \
-&& perl Makefile.PL \
+&& perl Makefile.PL TT_ACCEPT=y \
&& make \
&& make test \
&& make dist \
View
4 bin/tpage
@@ -112,8 +112,8 @@ L<http://www.andywardley.com/|http://www.andywardley.com/>
=head1 VERSION
-2.16, distributed as part of the
-Template Toolkit version 2.04, released on 29 June 2001.
+2.17, distributed as part of the
+Template Toolkit version 2.04b, released on 04 August 2001.
=head1 COPYRIGHT
View
4 bin/ttree
@@ -627,8 +627,8 @@ L<http://www.andywardley.com/|http://www.andywardley.com/>
=head1 VERSION
-2.16, distributed as part of the
-Template Toolkit version 2.04, released on 29 June 2001.
+2.17, distributed as part of the
+Template Toolkit version 2.04b, released on 04 August 2001.
=head1 COPYRIGHT
View
4 docs/src/FAQ/FAQ.html
@@ -207,8 +207,8 @@
[% WRAPPER section
title="VERSION"
-%]<p>
-2.16, distributed as part of the
-Template Toolkit version 2.04, released on 29 June 2001.
+2.17, distributed as part of the
+Template Toolkit version 2.04b, released on 04 August 2001.
</p>
[%- END %]
[% WRAPPER section
View
4 docs/src/Library/HTML.html
@@ -307,8 +307,8 @@
[% WRAPPER section
title="VERSION"
-%]<p>
-2.16, distributed as part of the
-Template Toolkit version 2.04, released on 29 June 2001.
+2.17, distributed as part of the
+Template Toolkit version 2.04b, released on 04 August 2001.
</p>
[%- END %]
[% WRAPPER section
View
4 docs/src/Library/PostScript.html
@@ -39,8 +39,8 @@
[% WRAPPER section
title="VERSION"
-%]<p>
-2.16, distributed as part of the
-Template Toolkit version 2.04, released on 29 June 2001.
+2.17, distributed as part of the
+Template Toolkit version 2.04b, released on 04 August 2001.
</p>
[%- END %]
[% WRAPPER section
View
4 docs/src/Library/Splash.html
@@ -980,8 +980,8 @@
[% WRAPPER section
title="VERSION"
-%]<p>
-2.16, distributed as part of the
-Template Toolkit version 2.04, released on 29 June 2001.
+2.17, distributed as part of the
+Template Toolkit version 2.04b, released on 04 August 2001.
</p>
[%- END %]
[% WRAPPER section
View
2 docs/src/Manual/Config.html
@@ -1521,7 +1521,7 @@
[% WRAPPER section
title="VERSION"
-%]<p>
-Template Toolkit version 2.04, released on 29 June 2001.
+Template Toolkit version 2.04b, released on 04 August 2001.
</p>
[%- END %]
[% WRAPPER section
View
2 docs/src/Manual/Credits.html
@@ -132,7 +132,7 @@
[% WRAPPER section
title="VERSION"
-%]<p>
-Template Toolkit version 2.04, released on 29 June 2001.
+Template Toolkit version 2.04b, released on 04 August 2001.
</p>
[%- END %]
[% WRAPPER section
View
2 docs/src/Manual/Directives.html
@@ -1941,7 +1941,7 @@
[% WRAPPER section
title="VERSION"
-%]<p>
-Template Toolkit version 2.04, released on 29 June 2001.
+Template Toolkit version 2.04b, released on 04 August 2001.
</p>
[%- END %]
[% WRAPPER section
View
2 docs/src/Manual/Filters.html
@@ -417,7 +417,7 @@
[% WRAPPER section
title="VERSION"
-%]<p>
-Template Toolkit version 2.04, released on 29 June 2001.
+Template Toolkit version 2.04b, released on 04 August 2001.
</p>
[%- END %]
[% WRAPPER section
View
2 docs/src/Manual/Internals.html
@@ -363,7 +363,7 @@
[% WRAPPER section
title="VERSION"
-%]<p>
-Template Toolkit version 2.04, released on 29 June 2001.
+Template Toolkit version 2.04b, released on 04 August 2001.
</p>
[%- END %]
[% WRAPPER section
View
2 docs/src/Manual/Intro.html
@@ -253,7 +253,7 @@
[% WRAPPER section
title="VERSION"
-%]<p>
-Template Toolkit version 2.04, released on 29 June 2001.
+Template Toolkit version 2.04b, released on 04 August 2001.
</p>
[%- END %]
[% WRAPPER section
View
2 docs/src/Manual/Plugins.html
@@ -441,7 +441,7 @@
[% WRAPPER section
title="VERSION"
-%]<p>
-Template Toolkit version 2.04, released on 29 June 2001.
+Template Toolkit version 2.04b, released on 04 August 2001.
</p>
[%- END %]
[% WRAPPER section
View
2 docs/src/Manual/Refs.html
@@ -123,7 +123,7 @@
[% WRAPPER section
title="VERSION"
-%]<p>
-Template Toolkit version 2.04, released on 29 June 2001.
+Template Toolkit version 2.04b, released on 04 August 2001.
</p>
[%- END %]
[% WRAPPER section
View
2 docs/src/Manual/Syntax.html
@@ -269,7 +269,7 @@
[% WRAPPER section
title="VERSION"
-%]<p>
-Template Toolkit version 2.04, released on 29 June 2001.
+Template Toolkit version 2.04b, released on 04 August 2001.
</p>
[%- END %]
[% WRAPPER section
View
2 docs/src/Manual/Variables.html
@@ -962,7 +962,7 @@
[% WRAPPER section
title="VERSION"
-%]<p>
-Template Toolkit version 2.04, released on 29 June 2001.
+Template Toolkit version 2.04b, released on 04 August 2001.
</p>
[%- END %]
[% WRAPPER section
View
2 docs/src/Manual/Views.html
@@ -602,7 +602,7 @@
[% WRAPPER section
title="VERSION"
-%]<p>
-Template Toolkit version 2.04, released on 29 June 2001.
+Template Toolkit version 2.04b, released on 04 August 2001.
</p>
[%- END %]
[% WRAPPER section
View
2 docs/src/Modules/Template.html
@@ -811,7 +811,7 @@
[% WRAPPER section
title="VERSION"
-%]<p>
-Template Toolkit version 2.04, released on 29 June 2001.
+Template Toolkit version 2.04b, released on 04 August 2001.
</p>
[%- END %]
[% WRAPPER section
View
4 docs/src/Modules/Template/Base.html
@@ -98,8 +98,8 @@
[% WRAPPER section
title="VERSION"
-%]<p>
-2.19, distributed as part of the
-Template Toolkit version 2.04, released on 29 June 2001.
+2.20, distributed as part of the
+Template Toolkit version 2.04b, released on 04 August 2001.
</p>
[%- END %]
[% WRAPPER section
View
4 docs/src/Modules/Template/Config.html
@@ -137,8 +137,8 @@
[% WRAPPER section
title="VERSION"
-%]<p>
-2.17, distributed as part of the
-Template Toolkit version 2.04, released on 29 June 2001.
+2.18, distributed as part of the
+Template Toolkit version 2.04b, released on 04 August 2001.
</p>
[%- END %]
[% WRAPPER section
View
4 docs/src/Modules/Template/Constants.html
@@ -89,8 +89,8 @@
[% WRAPPER section
title="VERSION"
-%]<p>
-2.18, distributed as part of the
-Template Toolkit version 2.04, released on 29 June 2001.
+2.19, distributed as part of the
+Template Toolkit version 2.04b, released on 04 August 2001.
</p>
[%- END %]
[% WRAPPER section
View
4 docs/src/Modules/Template/Context.html
@@ -612,8 +612,8 @@
[% WRAPPER section
title="VERSION"
-%]<p>
-2.24, distributed as part of the
-Template Toolkit version 2.04, released on 29 June 2001.
+2.25, distributed as part of the
+Template Toolkit version 2.04b, released on 04 August 2001.
</p>
[%- END %]
[% WRAPPER section
View
4 docs/src/Modules/Template/Document.html
@@ -190,8 +190,8 @@
[% WRAPPER section
title="VERSION"
-%]<p>
-2.19, distributed as part of the
-Template Toolkit version 2.04, released on 29 June 2001.
+2.20, distributed as part of the
+Template Toolkit version 2.04b, released on 04 August 2001.
</p>
[%- END %]
[% WRAPPER section
View
4 docs/src/Modules/Template/Exception.html
@@ -79,8 +79,8 @@
[% WRAPPER section
title="VERSION"
-%]<p>
-2.15, distributed as part of the
-Template Toolkit version 2.04, released on 29 June 2001.
+2.16, distributed as part of the
+Template Toolkit version 2.04b, released on 04 August 2001.
</p>
[%- END %]
[% WRAPPER section
View
4 docs/src/Modules/Template/Filters.html
@@ -600,8 +600,8 @@
[% WRAPPER section
title="VERSION"
-%]<p>
-2.20, distributed as part of the
-Template Toolkit version 2.04, released on 29 June 2001.
+2.21, distributed as part of the
+Template Toolkit version 2.04b, released on 04 August 2001.
</p>
[%- END %]
[% WRAPPER section
View
4 docs/src/Modules/Template/Iterator.html
@@ -215,8 +215,8 @@
[% WRAPPER section
title="VERSION"
-%]<p>
-2.17, distributed as part of the
-Template Toolkit version 2.04, released on 29 June 2001.
+2.18, distributed as part of the
+Template Toolkit version 2.04b, released on 04 August 2001.
</p>
[%- END %]
[% WRAPPER section
View
4 docs/src/Modules/Template/Parser.html
@@ -444,8 +444,8 @@
[% WRAPPER section
title="VERSION"
-%]<p>
-2.22, distributed as part of the
-Template Toolkit version 2.04, released on 29 June 2001.
+2.24, distributed as part of the
+Template Toolkit version 2.04b, released on 04 August 2001.
</p>
<pre> </pre>
[%- END %]
View
4 docs/src/Modules/Template/Plugin.html
@@ -228,8 +228,8 @@
[% WRAPPER section
title="VERSION"
-%]<p>
-2.18, distributed as part of the
-Template Toolkit version 2.04, released on 29 June 2001.
+2.19, distributed as part of the
+Template Toolkit version 2.04b, released on 04 August 2001.
</p>
[%- END %]
[% WRAPPER section
View
4 docs/src/Modules/Template/Plugin/Autoformat.html
@@ -140,8 +140,8 @@
[% WRAPPER section
title="VERSION"
-%]<p>
-2.17, distributed as part of the
-Template Toolkit version 2.04, released on 29 June 2001.
+2.18, distributed as part of the
+Template Toolkit version 2.04b, released on 04 August 2001.
</p>
[%- END %]
[% WRAPPER section
View
4 docs/src/Modules/Template/Plugin/CGI.html
@@ -70,8 +70,8 @@
[% WRAPPER section
title="VERSION"
-%]<p>
-2.16, distributed as part of the
-Template Toolkit version 2.04, released on 29 June 2001.
+2.17, distributed as part of the
+Template Toolkit version 2.04b, released on 04 August 2001.
</p>
[%- END %]
[% WRAPPER section
View
2 docs/src/Modules/Template/Plugin/DBI.html
@@ -231,7 +231,7 @@
title="VERSION"
-%]<p>
1.04, distributed as part of the
-Template Toolkit version 2.04, released on 29 June 2001.
+Template Toolkit version 2.04b, released on 04 August 2001.
</p>
[%- END %]
[% WRAPPER section
View
4 docs/src/Modules/Template/Plugin/Datafile.html
@@ -90,8 +90,8 @@
[% WRAPPER section
title="VERSION"
-%]<p>
-2.18, distributed as part of the
-Template Toolkit version 2.04, released on 29 June 2001.
+2.19, distributed as part of the
+Template Toolkit version 2.04b, released on 04 August 2001.
</p>
[%- END %]
[% WRAPPER section
View
4 docs/src/Modules/Template/Plugin/Date.html
@@ -132,8 +132,8 @@
[% WRAPPER section
title="VERSION"
-%]<p>
-2.16, distributed as part of the
-Template Toolkit version 2.04, released on 29 June 2001.
+2.17, distributed as part of the
+Template Toolkit version 2.04b, released on 04 August 2001.
</p>
[%- END %]
[% WRAPPER section
View
4 docs/src/Modules/Template/Plugin/Directory.html
@@ -232,8 +232,8 @@
[% WRAPPER section
title="VERSION"
-%]<p>
-2.16, distributed as part of the
-Template Toolkit version 2.04, released on 29 June 2001.
+2.17, distributed as part of the
+Template Toolkit version 2.04b, released on 04 August 2001.
</p>
[%- END %]
[% WRAPPER section
View
4 docs/src/Modules/Template/Plugin/Dumper.html
@@ -87,8 +87,8 @@
[% WRAPPER section
title="VERSION"
-%]<p>
-2.16, distributed as part of the
-Template Toolkit version 2.04, released on 29 June 2001.
+2.17, distributed as part of the
+Template Toolkit version 2.04b, released on 04 August 2001.
</p>
[%- END %]
[% WRAPPER section
View
4 docs/src/Modules/Template/Plugin/File.html
@@ -263,8 +263,8 @@
[% WRAPPER section
title="VERSION"
-%]<p>
-2.16, distributed as part of the
-Template Toolkit version 2.04, released on 29 June 2001.
+2.17, distributed as part of the
+Template Toolkit version 2.04b, released on 04 August 2001.
</p>
[%- END %]
[% WRAPPER section