home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / tsw / TSW_3.4.0.exe / Apache2 / perl / XS.pm < prev    next >
Encoding:
Perl POD Document  |  2004-01-30  |  4.8 KB  |  177 lines

  1. #============================================================= -*-Perl-*-
  2. # Template::Stash::XS
  3. # DESCRIPTION
  4. #
  5. #   Perl bootstrap for XS module. Inherits methods from 
  6. #   Template::Stash when not implemented in the XS module.
  7. #
  8. #========================================================================
  9.  
  10. package Template::Stash::XS;
  11.  
  12. use Template;
  13. use Template::Stash;
  14.  
  15. BEGIN {
  16.   require DynaLoader;
  17.   @Template::Stash::XS::ISA = qw( DynaLoader Template::Stash );
  18.  
  19.   eval {
  20.     bootstrap Template::Stash::XS $Template::VERSION;
  21.   };
  22.   if ($@) {
  23.     die "Couldn't load Template::Stash::XS $Template::VERSION:\n\n$@\n";
  24.   }
  25. }
  26.  
  27.  
  28. sub DESTROY {
  29.   # no op
  30.   1;
  31. }
  32.  
  33.  
  34. # catch missing method calls here so perl doesn't barf 
  35. # trying to load *.al files 
  36. sub AUTOLOAD {
  37.   my ($self, @args) = @_;
  38.   my @c             = caller(0);
  39.   my $auto        = $AUTOLOAD;
  40.  
  41.   $auto =~ s/.*:://;
  42.   $self =~ s/=.*//;
  43.  
  44.   die "Can't locate object method \"$auto\"" .
  45.       " via package \"$self\" at $c[1] line $c[2]\n";
  46. }
  47.  
  48. 1;
  49.  
  50. __END__
  51.  
  52.  
  53. #------------------------------------------------------------------------
  54. # IMPORTANT NOTE
  55. #   This documentation is generated automatically from source
  56. #   templates.  Any changes you make here may be lost.
  57. #   The 'docsrc' documentation source bundle is available for download
  58. #   from http://www.template-toolkit.org/docs.html and contains all
  59. #   the source templates, XML files, scripts, etc., from which the
  60. #   documentation for the Template Toolkit is built.
  61. #------------------------------------------------------------------------
  62.  
  63. =head1 NAME
  64.  
  65. Template::Stash::XS - Experimetal high-speed stash written in XS
  66.  
  67. =head1 SYNOPSIS
  68.  
  69.     use Template;
  70.     use Template::Stash::XS;
  71.  
  72.     my $stash = Template::Stash::XS->new(\%vars);
  73.     my $tt2   = Template->new({ STASH => $stash });
  74.  
  75. =head1 DESCRIPTION
  76.  
  77. This module loads the XS version of Template::Stash::XS. It should 
  78. behave very much like the old one, but run about twice as fast. 
  79. See the synopsis above for usage information.
  80.  
  81. Only a few methods (such as get and set) have been implemented in XS. 
  82. The others are inherited from Template::Stash.
  83.  
  84. =head1 NOTE
  85.  
  86. To always use the XS version of Stash, modify the Template/Config.pm 
  87. module near line 45:
  88.  
  89.  $STASH    = 'Template::Stash::XS';
  90.  
  91. If you make this change, then there is no need to explicitly create 
  92. an instance of Template::Stash::XS as seen in the SYNOPSIS above. Just
  93. use Template as normal.
  94.  
  95. Alternatively, in your code add this line before creating a Template
  96. object:
  97.  
  98.  $Template::Config::STASH = 'Template::Stash::XS';
  99.  
  100. To use the original, pure-perl version restore this line in 
  101. Template/Config.pm:
  102.  
  103.  $STASH    = 'Template::Stash';
  104.  
  105. Or in your code:
  106.  
  107.  $Template::Config::STASH = 'Template::Stash';
  108.  
  109. You can elect to have this performed once for you at installation
  110. time by answering 'y' or 'n' to the question that asks if you want
  111. to make the XS Stash the default.
  112.  
  113. =head1 BUGS
  114.  
  115. Please report bugs to the Template Toolkit mailing list
  116. templates@template-toolkit.org
  117.  
  118. As of version 2.05 of the Template Toolkit, use of the XS Stash is
  119. known to have 2 potentially troublesome side effects.  The first
  120. problem is that accesses to tied hashes (e.g. Apache::Session) may not
  121. work as expected.  This should be fixed in an imminent release.  If
  122. you are using tied hashes then it is suggested that you use the
  123. regular Stash by default, or write a thin wrapper around your tied
  124. hashes to enable the XS Stash to access items via regular method
  125. calls.
  126.  
  127. The second potential problem is that enabling the XS Stash causes all
  128. the Template Toolkit modules to be installed in an architecture
  129. dependant library, e.g. in
  130.  
  131.     /usr/lib/perl5/site_perl/5.6.0/i386-linux/Template
  132.  
  133. instead of 
  134.  
  135.     /usr/lib/perl5/site_perl/5.6.0/Template
  136.  
  137. At the time of writing, we're not sure why this is happening but it's
  138. likely that this is either a bug or intentional feature in the Perl
  139. ExtUtils::MakeMaker module.  As far as I know, Perl always checks the
  140. architecture dependant directories before the architecture independant
  141. ones.  Therefore, a newer version of the Template Toolkit installed
  142. with the XS Stash enabled should be used by Perl in preference to any
  143. existing version using the regular stash.  However, if you install a 
  144. future version of the Template Toolkit with the XS Stash disabled, you
  145. may find that Perl continues to use the older version with XS Stash 
  146. enabled in preference.
  147.  
  148. =head1 AUTHORS
  149.  
  150. Andy Wardley E<lt>abw@tt2.orgE<gt>
  151.  
  152. Doug Steinwand E<lt>dsteinwand@citysearch.comE<gt>
  153.  
  154. =head1 VERSION
  155.  
  156. Template Toolkit version 2.13, released on 30 January 2004.
  157.  
  158.  
  159.  
  160. =head1 COPYRIGHT
  161.  
  162.   Copyright (C) 1996-2004 Andy Wardley.  All Rights Reserved.
  163.   Copyright (C) 1998-2002 Canon Research Centre Europe Ltd.
  164.  
  165. This module is free software; you can redistribute it and/or
  166. modify it under the same terms as Perl itself.
  167.  
  168.  
  169.  
  170. =head1 SEE ALSO
  171.  
  172. L<Template::Stash|Template::Stash>
  173.  
  174.