cvsuser 02/03/12 09:06:29
Modified: P5EEx/Blue MANIFEST Makefile.PL
P5EEx/Blue/cgi-bin demo_report.conf ttx.PL
Added: P5EEx/Blue/templates/ttdemo footer.txt header.txt index.html
Log:
begin demonstrating support for Template Toolkit
Revision Changes Path
1.11 +9 -4 p5ee/P5EEx/Blue/MANIFEST
Index: MANIFEST
===================================================================
RCS file: /cvs/public/p5ee/P5EEx/Blue/MANIFEST,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -w -r1.10 -r1.11
--- MANIFEST 18 Feb 2002 19:01:21 -0000 1.10
+++ MANIFEST 12 Mar 2002 17:06:29 -0000 1.11
@@ -6,6 +6,7 @@
P5EEx/Blue/P5EE.pm
P5EEx/Blue/Exceptions.pm
P5EEx/Blue/Reference.pm
+P5EEx/Blue/UserAgent.pm
P5EEx/Blue/Config.pm
P5EEx/Blue/Config.pod
P5EEx/Blue/Config/File.pm
@@ -98,7 +99,11 @@
examples/Reference.1.out
t/Config.t
t/Reference.t
-cgi-bin/button
-cgi-bin/p5ee
-cgi-bin/p5ee.conf.sample
-cgi-bin/config.pl.sample
+cgi-bin/p5x.PL
+cgi-bin/button.PL
+cgi-bin/ttx.PL
+cgi-bin/demo_report.conf
+cgi-bin/demo_report.pl
+templates/ttdemo/header.txt
+templates/ttdemo/footer.txt
+templates/ttdemo/index.html
1.12 +2 -2 p5ee/P5EEx/Blue/Makefile.PL
Index: Makefile.PL
===================================================================
RCS file: /cvs/public/p5ee/P5EEx/Blue/Makefile.PL,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -w -r1.11 -r1.12
--- Makefile.PL 18 Feb 2002 19:01:21 -0000 1.11
+++ Makefile.PL 12 Mar 2002 17:06:29 -0000 1.12
@@ -1,6 +1,6 @@
######################################################################
-## File: $Id: Makefile.PL,v 1.11 2002/02/18 19:01:21 spadkins Exp $
+## File: $Id: Makefile.PL,v 1.12 2002/03/12 17:06:29 spadkins Exp $
######################################################################
use ExtUtils::MakeMaker;
@@ -15,7 +15,7 @@
my @bin_programs = qw();
my @sbin_programs = qw(perldocs);
-my @cgibin_programs = qw(p5ee button);
+my @cgibin_programs = qw(p5x ttx button);
%opts = (
'INSTALLDIRS' => 'perl',
1.2 +13 -12 p5ee/P5EEx/Blue/cgi-bin/demo_report.conf
Index: demo_report.conf
===================================================================
RCS file: /cvs/public/p5ee/P5EEx/Blue/cgi-bin/demo_report.conf,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -r1.1 -r1.2
--- demo_report.conf 10 Mar 2002 17:26:02 -0000 1.1
+++ demo_report.conf 12 Mar 2002 17:06:29 -0000 1.2
@@ -1,6 +1,6 @@
#############################################################################
-# $Id: demo_report.conf,v 1.1 2002/03/10 17:26:02 spadkins Exp $
+# $Id: demo_report.conf,v 1.2 2002/03/12 17:06:29 spadkins Exp $
#############################################################################
perlinc = /usr/ov/acoc/dev/src/P5EEx-Blue, /usr/ov/acoc/dev/lib/perl5/5.6.0
@@ -14,4 +14,5 @@
scriptDir = /usr/ov/acoc/dev/p5ee/P5EEx/Blue/cgi-bin
htmlUrlDir = /pub/p5ee/software/htdocs
htmlDir = /usr/ov/acoc/dev/p5ee/P5EEx/Blue/htdocs
+ttTemplateDir = /usr/ov/acoc/dev/p5ee/P5EEx/Blue/template/ttdemo
1.2 +12 -6 p5ee/P5EEx/Blue/cgi-bin/ttx.PL
Index: ttx.PL
===================================================================
RCS file: /cvs/public/p5ee/P5EEx/Blue/cgi-bin/ttx.PL,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -r1.1 -r1.2
--- ttx.PL 10 Mar 2002 17:26:02 -0000 1.1
+++ ttx.PL 12 Mar 2002 17:06:29 -0000 1.2
@@ -16,7 +16,7 @@
print OUT <<'!NO!SUBSTITUTIONS!';
######################################################################
-## $Id: ttx.PL,v 1.1 2002/03/10 17:26:02 spadkins Exp $
+## $Id: ttx.PL,v 1.2 2002/03/12 17:06:29 spadkins Exp $
######################################################################
BEGIN {
@@ -25,10 +25,13 @@
%main::conf = ();
$open = 0; # assume we cannot find an openable config file ...
if (defined $ENV{PATH_INFO}) {
- $file = $ENV{PATH_INFO} . ".conf"; # default config file based on
PATH_INFO
+ $file = $ENV{PATH_INFO};
+ $file =~ s!/$!!; # remove any trailing slash
+ $file =~ s!/[^/]+\.[^/]+$!!; # remove any trailing file (i.e.
"/index.html")
+ $file .= ".conf"; # default config file based on
PATH_INFO
$file =~ s!^/!!; # with no leading "/"
$file =~ s!/!_!g; # and internal "/"s changed to "_"s
- $open = open(main::FILE, "< $file") if (-r $file);
+ $open = open(main::FILE, "< $file") if ($file && -r $file);
}
$open = open(main::FILE, "< $0.conf") if (!$open && -r "$0.conf");
$open = open(main::FILE, "< p5ee.conf") if (!$open && -r "p5ee.conf");
@@ -78,7 +81,10 @@
my ($template);
$template = $cgi->param("template");
-$template = $ENV{PATH_INFO} if (! defined $template);
+if (! defined $template && defined $ENV{PATH_INFO}) {
+ $template = $ENV{PATH_INFO};
+ $template =~ s!.*/!/!;
+}
$template = "/index.html" if (! defined $template || $template eq "/");
$template =~ s!^/!!;
@@ -94,8 +100,8 @@
my ($var, $value, $vars, %vars);
my ($tproc, %tconfig, $templatedir, @templatedirs);
- if ($main::conf{"templatedir"}) {
- $templatedir = $main::conf{"templatedir"};
+ if ($main::conf{"ttTemplateDir"}) {
+ $templatedir = $main::conf{"ttTemplateDir"};
@templatedirs = split(/ *, */,$templatedir);
}
elsif ($main::conf{"prefix"}) {
1.1 p5ee/P5EEx/Blue/templates/ttdemo/footer.txt
Index: footer.txt
===================================================================
</form>
</body>
</html>
1.1 p5ee/P5EEx/Blue/templates/ttdemo/header.txt
Index: header.txt
===================================================================
<html>
<head>
<title>$title</title>
</head>
<body bgcolor='#c0f0f0'>
<form method='POST'>
1.1 p5ee/P5EEx/Blue/templates/ttdemo/index.html
Index: index.html
===================================================================
[% PROCESS header.txt
title = "Widget Demo"
%]
[% USE ctx = P5EE(cgi => cgi) %]
<h1>Examples</h1>
of embedding a P5EE Widget into a Template Toolkit page
<hr/>
[% ctx.widget('table').display %]
[% PROCESS footer.txt %]