[Templates-cvs] cvs commit: Template2/lib/Template/Stash Context.pm XS.pm
cvs@template-toolkit.org
cvs@template-toolkit.org
cvs 06/05/26 13:46:11
Modified: lib/Template/Stash Context.pm XS.pm
Log:
Version 2.15
Revision Changes Path
1.61 +7 -7 Template2/lib/Template/Stash/Context.pm
Index: Context.pm
===================================================================
RCS file: /template-toolkit/Template2/lib/Template/Stash/Context.pm,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -r1.60 -r1.61
--- Context.pm 2006/01/30 20:06:15 1.60
+++ Context.pm 2006/05/26 13:46:11 1.61
@@ -65,7 +65,7 @@
#
#----------------------------------------------------------------------------
#
-# $Id: Context.pm,v 1.60 2006/01/30 20:06:15 abw Exp $
+# $Id: Context.pm,v 1.61 2006/05/26 13:46:11 abw Exp $
#
#============================================================================
@@ -77,7 +77,7 @@
use Template::Stash;
use vars qw( $VERSION $DEBUG $ROOT_OPS $SCALAR_OPS $HASH_OPS $LIST_OPS );
-$VERSION = sprintf("%d.%02d", q$Revision: 1.60 $ =~ /(\d+)\.(\d+)/);
+$VERSION = sprintf("%d.%02d", q$Revision: 1.61 $ =~ /(\d+)\.(\d+)/);
#========================================================================
@@ -756,21 +756,21 @@
=head1 AUTHOR
-Andy Wardley E<lt>abw@andywardley.comE<gt>
+Andy Wardley E<lt>abw@wardley.orgE<gt>
-L<http://www.andywardley.com/|http://www.andywardley.com/>
+L<http://wardley.org/|http://wardley.org/>
=head1 VERSION
-1.59, distributed as part of the
-Template Toolkit version 2.15, released on 30 January 2006.
+1.60, distributed as part of the
+Template Toolkit version 2.15, released on 26 May 2006.
=head1 COPYRIGHT
- Copyright (C) 1996-2004 Andy Wardley. All Rights Reserved.
+ Copyright (C) 1996-2006 Andy Wardley. All Rights Reserved.
Copyright (C) 1998-2002 Canon Research Centre Europe Ltd.
This module is free software; you can redistribute it and/or
1.39 +38 -59 Template2/lib/Template/Stash/XS.pm
Index: XS.pm
===================================================================
RCS file: /template-toolkit/Template2/lib/Template/Stash/XS.pm,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- XS.pm 2006/01/30 20:06:15 1.38
+++ XS.pm 2006/05/26 13:46:11 1.39
@@ -65,7 +65,7 @@
=head1 NAME
-Template::Stash::XS - Experimetal high-speed stash written in XS
+Template::Stash::XS - High-speed variable stash written in C
=head1 SYNOPSIS
@@ -77,77 +77,56 @@
=head1 DESCRIPTION
-This module loads the XS version of Template::Stash::XS. It should
-behave very much like the old one, but run about twice as fast.
-See the synopsis above for usage information.
+The Template:Stash::XS module is an implementation of the
+Template::Stash written in C. The "XS" in the name refers to Perl's
+XS extension system for interfacing Perl to C code. It works just
+like the regular Perl implementation of Template::Stash but runs about
+twice as fast.
+
+The easiest way to use the XS stash is to configure the Template
+Toolkit to use it by default. You can do this at installation time
+(when you run C<perl Makefile.PL>) by answering 'y' to the questions:
+
+ Do you want to build the XS Stash module? y
+ Do you want to use the XS Stash by default? y
+
+See the F<INSTALL> file distributed with the Template Toolkit for further
+details on installation.
+
+If you don't elect to use the XS stash by default then you should use
+the C<STASH> configuration item when you create a new Template object.
+This should reference an XS stash object that you have created
+manually.
-Only a few methods (such as get and set) have been implemented in XS.
-The others are inherited from Template::Stash.
-
-=head1 NOTE
-
-To always use the XS version of Stash, modify the Template/Config.pm
-module near line 45:
-
- $STASH = 'Template::Stash::XS';
+ use Template;
+ use Template::Stash::XS;
-If you make this change, then there is no need to explicitly create
-an instance of Template::Stash::XS as seen in the SYNOPSIS above. Just
-use Template as normal.
+ my $stash = Template::Stash::XS->new(\%vars);
+ my $tt2 = Template->new({ STASH => $stash });
-Alternatively, in your code add this line before creating a Template
-object:
+Alternately, you can set the C<$Template::Config::STASH> package
+variable like so:
- $Template::Config::STASH = 'Template::Stash::XS';
+ use Template;
+ use Template::Config;
-To use the original, pure-perl version restore this line in
-Template/Config.pm:
+ $Template::Config::STASH = 'Template::Stash::XS';
- $STASH = 'Template::Stash';
+ my $tt2 = Template->new();
-Or in your code:
+The XS stash will then be automatically used.
- $Template::Config::STASH = 'Template::Stash';
+If you want to use the XS stash by default and don't want to
+re-install the Template Toolkit, then you can manually modify the
+C<Template/Config.pm> module near line 42 to read:
-You can elect to have this performed once for you at installation
-time by answering 'y' or 'n' to the question that asks if you want
-to make the XS Stash the default.
+ $STASH = 'Template::Stash::XS';
=head1 BUGS
Please report bugs to the Template Toolkit mailing list
templates@template-toolkit.org
-As of version 2.05 of the Template Toolkit, use of the XS Stash is
-known to have 2 potentially troublesome side effects. The first
-problem is that accesses to tied hashes (e.g. Apache::Session) may not
-work as expected. This should be fixed in an imminent release. If
-you are using tied hashes then it is suggested that you use the
-regular Stash by default, or write a thin wrapper around your tied
-hashes to enable the XS Stash to access items via regular method
-calls.
-
-The second potential problem is that enabling the XS Stash causes all
-the Template Toolkit modules to be installed in an architecture
-dependant library, e.g. in
-
- /usr/lib/perl5/site_perl/5.6.0/i386-linux/Template
-
-instead of
-
- /usr/lib/perl5/site_perl/5.6.0/Template
-
-At the time of writing, we're not sure why this is happening but it's
-likely that this is either a bug or intentional feature in the Perl
-ExtUtils::MakeMaker module. As far as I know, Perl always checks the
-architecture dependant directories before the architecture independant
-ones. Therefore, a newer version of the Template Toolkit installed
-with the XS Stash enabled should be used by Perl in preference to any
-existing version using the regular stash. However, if you install a
-future version of the Template Toolkit with the XS Stash disabled, you
-may find that Perl continues to use the older version with XS Stash
-enabled in preference.
-
=head1 AUTHORS
Andy Wardley E<lt>abw@tt2.orgE<gt>
@@ -156,13 +135,13 @@
=head1 VERSION
-Template Toolkit version 2.15, released on 30 January 2006.
+Template Toolkit version 2.15, released on 26 May 2006.
=head1 COPYRIGHT
- Copyright (C) 1996-2004 Andy Wardley. All Rights Reserved.
+ Copyright (C) 1996-2006 Andy Wardley. All Rights Reserved.
Copyright (C) 1998-2002 Canon Research Centre Europe Ltd.
This module is free software; you can redistribute it and/or