Changeset 357

Show
Ignore:
Timestamp:
04/27/08 07:54:30 (3 weeks ago)
Author:
ingy
Message:
THe latest TT
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/core/Spork/spork

    • Property svn:executable set to
      1
  • trunk/src/core/Template-Installed/lib/Template.pm

    r45 r357  
    88# 
    99# AUTHOR 
    10 #   Andy Wardley   <abw@andywardley.com
     10#   Andy Wardley   <abw@wardley.org
    1111# 
    1212# COPYRIGHT 
    13 #   Copyright (C) 1996-2002 Andy Wardley.  All Rights Reserved. 
     13#   Copyright (C) 1996-2006 Andy Wardley.  All Rights Reserved. 
    1414#   Copyright (C) 1998-2002 Canon Research Centre Europe Ltd. 
    1515# 
     
    1818# 
    1919# REVISION 
    20 #   $Id: Template.pm,v 2.80 2004/10/04 10:24:10 abw Exp
     20#   $Id: Template.pm 1056 2007-04-27 11:51:47Z abw
    2121# 
    2222#======================================================================== 
    23   
     23 
    2424package Template; 
    25 use base qw( Template::Base ); 
    26  
    27 require 5.005; 
    2825 
    2926use strict; 
    30 use vars qw( $VERSION $AUTOLOAD $ERROR $DEBUG $BINMODE ); 
    31 use Template::Base; 
     27use warnings; 
     28use base 'Template::Base'; 
     29 
    3230use Template::Config; 
    3331use Template::Constants; 
     
    3735use File::Path; 
    3836 
    39 ## This is the main version number for the Template Toolkit. 
    40 ## It is extracted by ExtUtils::MakeMaker and inserted in various places. 
    41 $VERSION     = '2.14'; 
    42 $ERROR       = ''; 
    43 $DEBUG       = 0; 
    44 $BINMODE     = 0 unless defined $BINMODE; 
     37our $VERSION = '2.19'; 
     38our $ERROR   = ''; 
     39our $DEBUG   = 0; 
     40our $BINMODE = 0 unless defined $BINMODE; 
     41our $AUTOLOAD; 
    4542 
    4643# preload all modules if we're running under mod_perl 
     
    6158    my $options = (@opts == 1) && UNIVERSAL::isa($opts[0], 'HASH') 
    6259        ? shift(@opts) : { @opts }; 
     60 
     61    $options->{ binmode } = $BINMODE 
     62        unless defined $options->{ binmode }; 
    6363     
    64     $options->{ binmode } = $BINMODE  
    65         unless defined $options->{ binmode }; 
    66  
    6764    # we're using this for testing in t/output.t and t/filter.t so  
    6865    # don't remove it if you don't want tests to fail... 
     
    7774            $outstream = "$outpath/$outstream" if $outpath; 
    7875        }        
    79          
     76 
    8077        # send processed template to output stream, checking for error 
    8178        return ($self->error($error)) 
     
    193190        elsif (open(FP, ">$where")) {  
    194191            # binmode option can be 1 or a specific layer, e.g. :utf8 
    195             my $bm = $options->{ binmode }; 
    196             if ($bm && +$bm == 1) {  
     192            my $bm = $options->{ binmode }; 
     193            if ($bm && $bm eq 1) {  
    197194                binmode FP; 
    198195            } 
     
    938935=head1 AUTHOR 
    939936 
    940 Andy Wardley E<lt>abw@andywardley.comE<gt> 
    941  
    942 L<http://www.andywardley.com/|http://www.andywardley.com/> 
     937Andy Wardley E<lt>abw@wardley.orgE<gt> 
     938 
     939L<http://wardley.org/|http://wardley.org/> 
    943940 
    944941 
     
    947944=head1 VERSION 
    948945 
    949 Template Toolkit version 2.14, released on 04 October 2004
     946Template Toolkit version 2.19, released on 27 April 2007
    950947 
    951948=head1 COPYRIGHT 
    952949 
    953   Copyright (C) 1996-2004 Andy Wardley.  All Rights Reserved. 
    954   Copyright (C) 1998-2002 Canon Research Centre Europe Ltd. 
     950  Copyright (C) 1996-2007 Andy Wardley.  All Rights Reserved. 
     951 
    955952 
    956953This module is free software; you can redistribute it and/or 
  • trunk/src/core/Template-Installed/lib/Template/Base.pm

    r45 r357  
    88# 
    99# AUTHOR 
    10 #   Andy Wardley   <abw@kfs.org> 
     10#   Andy Wardley   <abw@wardley.org> 
    1111# 
    1212# COPYRIGHT 
    13 #   Copyright (C) 1996-2000 Andy Wardley.  All Rights Reserved. 
     13#   Copyright (C) 1996-2006 Andy Wardley.  All Rights Reserved. 
    1414#   Copyright (C) 1998-2000 Canon Research Centre Europe Ltd. 
    1515# 
     
    1717#   modify it under the same terms as Perl itself. 
    1818# 
    19 #------------------------------------------------------------------------ 
    20 
    21 #   $Id: Base.pm,v 2.70 2004/01/30 19:32:21 abw Exp $ 
     19# REVISION 
     20#   $Id: Base.pm 1055 2007-04-27 11:50:40Z abw $ 
    2221# 
    2322#======================================================================== 
     
    2524package Template::Base; 
    2625 
    27 require 5.004; 
    28  
    2926use strict; 
    30 use vars qw( $VERSION )
     27use warnings
    3128use Template::Constants; 
    3229 
    33 $VERSION = sprintf("%d.%02d", q$Revision: 2.70 $ =~ /(\d+)\.(\d+)/)
     30our $VERSION = 2.77
    3431 
    3532 
     
    5047 
    5148    {   no strict qw( refs ); 
    52        $argnames = \@{"$class\::BASEARGS"} || [ ]; 
     49        $argnames = \@{"$class\::BASEARGS"} || [ ]; 
    5350    } 
    5451 
    5552    # shift off all mandatory args, returning error if undefined or null 
    5653    foreach $arg (@$argnames) { 
    57        return $class->error("no $arg specified") 
    58            unless ($cfg = shift); 
    59        push(@args, $cfg); 
     54        return $class->error("no $arg specified") 
     55            unless ($cfg = shift); 
     56        push(@args, $cfg); 
    6057    } 
    6158 
    6259    # fold all remaining args into a hash, or use provided hash ref 
    63 #    local $" = ', '; 
    64 #    print STDERR "args: [@_]\n"; 
    6560    $cfg  = defined $_[0] && UNIVERSAL::isa($_[0], 'HASH') ? shift : { @_ }; 
    6661 
    6762    my $self = bless { 
    68        map { ($_ => shift @args) } @$argnames, 
    69        _ERROR  => '', 
     63        map { ($_ => shift @args) } @$argnames, 
     64        _ERROR  => '', 
    7065        DEBUG   => 0, 
    7166    }, $class; 
    72  
     67     
    7368    return $self->_init($cfg) ? $self : $class->error($self->error); 
    7469} 
     
    9186 
    9287    {  
    93        no strict qw( refs ); 
    94        $errvar = ref $self ? \$self->{ _ERROR } : \${"$self\::ERROR"}; 
     88        no strict qw( refs ); 
     89        $errvar = ref $self ? \$self->{ _ERROR } : \${"$self\::ERROR"}; 
    9590    } 
    9691    if (@_) { 
    97        $$errvar = ref($_[0]) ? shift : join('', @_); 
    98        return undef; 
     92        $$errvar = ref($_[0]) ? shift : join('', @_); 
     93        return undef; 
    9994    } 
    10095    else { 
    101        return $$errvar; 
     96        return $$errvar; 
    10297    } 
    10398} 
     
    130125 
    131126    unless ($msg =~ /\n$/) { 
    132        $msg .= ($self->{ DEBUG } & Template::Constants::DEBUG_CALLER) 
    133                 ? " at $file line $line\n" 
    134                 : "\n"; 
     127        $msg .= ($self->{ DEBUG } & Template::Constants::DEBUG_CALLER) 
     128            ? " at $file line $line\n" 
     129            : "\n"; 
    135130    } 
    136131 
     
    280275=head1 AUTHOR 
    281276 
    282 Andy Wardley E<lt>abw@andywardley.comE<gt> 
    283  
    284 L<http://www.andywardley.com/|http://www.andywardley.com/> 
     277Andy Wardley E<lt>abw@wardley.orgE<gt> 
     278 
     279L<http://wardley.org/|http://wardley.org/> 
    285280 
    286281 
     
    289284=head1 VERSION 
    290285 
    291 2.70, distributed as part of the 
    292 Template Toolkit version 2.14, released on 04 October 2004
     2862.77, distributed as part of the 
     287Template Toolkit version 2.19, released on 27 April 2007
    293288 
    294289=head1 COPYRIGHT 
    295290 
    296   Copyright (C) 1996-2004 Andy Wardley.  All Rights Reserved. 
    297   Copyright (C) 1998-2002 Canon Research Centre Europe Ltd. 
     291  Copyright (C) 1996-2007 Andy Wardley.  All Rights Reserved. 
     292 
    298293 
    299294This module is free software; you can redistribute it and/or 
  • trunk/src/core/Template-Installed/lib/Template/Config.pm

    r45 r357  
    77# 
    88# AUTHOR 
    9 #   Andy Wardley   <abw@kfs.org> 
     9#   Andy Wardley   <abw@wardley.org> 
    1010# 
    1111# COPYRIGHT 
    12 #   Copyright (C) 1996-2000 Andy Wardley.  All Rights Reserved. 
    13 #   Copyright (C) 1998-2000 Canon Research Centre Europe Ltd. 
     12#   Copyright (C) 1996-2006 Andy Wardley.  All Rights Reserved. 
    1413# 
    1514#   This module is free software; you can redistribute it and/or 
    1615#   modify it under the same terms as Perl itself. 
    1716# 
    18 #------------------------------------------------------------------------ 
    19 
    20 #   $Id: Config.pm,v 2.68 2004/01/30 19:32:23 abw Exp $ 
     17# REVISION 
     18#   $Id: Config.pm 1055 2007-04-27 11:50:40Z abw $ 
    2119# 
    2220#======================================================================== 
     
    2422package Template::Config; 
    2523 
    26 require 5.004; 
    27  
    2824use strict; 
    29 use base qw( Template::Base ); 
     25use warnings; 
     26use base 'Template::Base'; 
    3027use vars qw( $VERSION $DEBUG $ERROR $INSTDIR 
    31             $PARSER $PROVIDER $PLUGINS $FILTERS $ITERATOR  
     28             $PARSER $PROVIDER $PLUGINS $FILTERS $ITERATOR  
    3229             $LATEX_PATH $PDFLATEX_PATH $DVIPS_PATH 
    33             $STASH $SERVICE $CONTEXT $CONSTANTS @PRELOAD ); 
    34  
    35 $VERSION   = sprintf("%d.%02d", q$Revision: 2.68 $ =~ /(\d+)\.(\d+)/)
     30             $STASH $SERVICE $CONTEXT $CONSTANTS @PRELOAD ); 
     31 
     32$VERSION   = 2.74
    3633$DEBUG     = 0 unless defined $DEBUG; 
    3734$ERROR     = ''; 
     
    5249$INSTDIR  = ''; 
    5350 
    54 # LaTeX executable paths set at installation time by the Makefile.PL 
    55 # Empty strings cause the latex(pdf|dvi|ps) filters to throw an error. 
    56 $LATEX_PATH    = ''; 
    57 $PDFLATEX_PATH = ''; 
    58 $DVIPS_PATH    = ''; 
    5951 
    6052#======================================================================== 
     
    135127    return undef unless $class->load($PROVIDER); 
    136128    return $PROVIDER->new($params)  
    137        || $class->error("failed to create template provider: ", 
    138                         $PROVIDER->error); 
     129        || $class->error("failed to create template provider: ", 
     130                        $PROVIDER->error); 
    139131} 
    140132 
     
    285277} 
    286278 
    287 #------------------------------------------------------------------------ 
    288 # latexpaths() 
    289 # 
    290 # Returns a reference to a three element array: 
    291 #    [latex_path,  pdf2latex_path, dvips_path] 
    292 # These values are determined by Makefile.PL at installation time 
    293 # and are used by the latex(pdf|dvi|ps) filters. 
    294 #------------------------------------------------------------------------ 
    295  
    296 sub latexpaths { 
    297     return [$LATEX_PATH, $PDFLATEX_PATH, $DVIPS_PATH]; 
    298 } 
    299279 
    300280#======================================================================== 
     
    433413=head1 AUTHOR 
    434414 
    435 Andy Wardley E<lt>abw@andywardley.comE<gt> 
    436  
    437 L<http://www.andywardley.com/|http://www.andywardley.com/> 
     415Andy Wardley E<lt>abw@wardley.orgE<gt> 
     416 
     417L<http://wardley.org/|http://wardley.org/> 
    438418 
    439419 
     
    442422=head1 VERSION 
    443423 
    444 2.68, distributed as part of the 
    445 Template Toolkit version 2.14, released on 04 October 2004
     4242.74, distributed as part of the 
     425Template Toolkit version 2.19, released on 27 April 2007
    446426 
    447427=head1 COPYRIGHT 
    448428 
    449   Copyright (C) 1996-2004 Andy Wardley.  All Rights Reserved. 
    450   Copyright (C) 1998-2002 Canon Research Centre Europe Ltd. 
     429  Copyright (C) 1996-2007 Andy Wardley.  All Rights Reserved. 
     430 
    451431 
    452432This module is free software; you can redistribute it and/or 
  • trunk/src/core/Template-Installed/lib/Template/Constants.pm

    r45 r357  
    77# 
    88# AUTHOR 
    9 #   Andy Wardley   <abw@kfs.org> 
     9#   Andy Wardley   <abw@wardley.org> 
    1010# 
    1111# COPYRIGHT 
    12 #   Copyright (C) 1996-2000 Andy Wardley.  All Rights Reserved. 
     12#   Copyright (C) 1996-2006 Andy Wardley.  All Rights Reserved. 
    1313#   Copyright (C) 1998-2000 Canon Research Centre Europe Ltd. 
    1414# 
     
    1616#   modify it under the same terms as Perl itself. 
    1717# 
    18 #---------------------------------------------------------------------------- 
    19 
    20 # $Id: Constants.pm,v 2.68 2004/01/30 19:32:23 abw Exp $ 
     18# REVISION 
     19#   $Id: Constants.pm 1055 2007-04-27 11:50:40Z abw $ 
    2120# 
    2221#============================================================================ 
     
    2423package Template::Constants; 
    2524 
    26 require 5.004; 
    2725require Exporter; 
    2826 
    2927use strict; 
    30 use vars qw( $VERSION @ISA @EXPORT_OK %EXPORT_TAGS ); 
     28use warnings; 
     29use base 'Exporter'; 
     30 
     31use vars qw( @EXPORT_OK %EXPORT_TAGS ); 
    3132use vars qw( $DEBUG_OPTIONS @STATUS @ERROR @CHOMP @DEBUG); 
    3233 
    33 @ISA     = qw( Exporter ); 
    34 $VERSION = sprintf("%d.%02d", q$Revision: 2.68 $ =~ /(\d+)\.(\d+)/); 
     34our $VERSION = 2.74; 
    3535 
    3636 
     
    5858# CHOMP constants for PRE_CHOMP and POST_CHOMP 
    5959use constant CHOMP_NONE      => 0; # do not remove whitespace 
    60 use constant CHOMP_ALL       => 1; # remove whitespace 
     60use constant CHOMP_ALL       => 1; # remove whitespace up to newline 
     61use constant CHOMP_ONE       => 1; # new name for CHOMP_ALL 
    6162use constant CHOMP_COLLAPSE  => 2; # collapse whitespace to a single space 
     63use constant CHOMP_GREEDY    => 3; # remove all whitespace including newlines 
    6264 
    6365# DEBUG constants to enable various debugging options 
     
    101103@ERROR   = qw( ERROR_FILE ERROR_VIEW ERROR_UNDEF ERROR_PERL  
    102104               ERROR_RETURN ERROR_FILTER ERROR_PLUGIN ); 
    103 @CHOMP   = qw( CHOMP_NONE CHOMP_ALL CHOMP_COLLAPSE ); 
     105@CHOMP   = qw( CHOMP_NONE CHOMP_ALL CHOMP_ONE CHOMP_COLLAPSE CHOMP_GREEDY ); 
    104106@DEBUG   = qw( DEBUG_OFF DEBUG_ON DEBUG_UNDEF DEBUG_VARS  
    105107               DEBUG_DIRS DEBUG_STASH DEBUG_CONTEXT DEBUG_PARSER 
     
    229231  :chomp                      # for PRE_CHOMP and POST_CHOMP 
    230232    CHOMP_NONE                # do not remove whitespace 
    231     CHOMP_ALL                 # remove whitespace 
     233    CHOMP_ONE                 # remove whitespace to newline 
     234    CHOMP_ALL                 # old name for CHOMP_ONE (deprecated) 
    232235    CHOMP_COLLAPSE            # collapse whitespace to a single space 
     236    CHOMP_GREEDY              # remove all whitespace including newlines 
    233237 
    234238  :debug 
     
    253257=head1 AUTHOR 
    254258 
    255 Andy Wardley E<lt>abw@andywardley.comE<gt> 
    256  
    257 L<http://www.andywardley.com/|http://www.andywardley.com/> 
     259Andy Wardley E<lt>abw@wardley.orgE<gt> 
     260 
     261L<http://wardley.org/|http://wardley.org/> 
    258262 
    259263 
     
    262266=head1 VERSION 
    263267 
    264 2.68, distributed as part of the 
    265 Template Toolkit version 2.14, released on 04 October 2004
     2682.74, distributed as part of the 
     269Template Toolkit version 2.19, released on 27 April 2007
    266270 
    267271=head1 COPYRIGHT 
    268272 
    269   Copyright (C) 1996-2004 Andy Wardley.  All Rights Reserved. 
    270   Copyright (C) 1998-2002 Canon Research Centre Europe Ltd. 
     273  Copyright (C) 1996-2007 Andy Wardley.  All Rights Reserved. 
     274 
    271275 
    272276This module is free software; you can redistribute it and/or 
  • trunk/src/core/Template-Installed/lib/Template/Context.pm

    r45 r357  
    99# 
    1010# AUTHOR 
    11 #   Andy Wardley   <abw@kfs.org> 
     11#   Andy Wardley   <abw@wardley.org> 
    1212# 
    1313# COPYRIGHT 
    14 #   Copyright (C) 1996-2000 Andy Wardley.  All Rights Reserved. 
     14#   Copyright (C) 1996-2006 Andy Wardley.  All Rights Reserved. 
    1515#   Copyright (C) 1998-2000 Canon Research Centre Europe Ltd. 
    1616# 
     
    1919#  
    2020# REVISION 
    21 #   $Id: Context.pm,v 2.91 2004/10/04 10:02:29 abw Exp
     21#   $Id: Context.pm 1055 2007-04-27 11:50:40Z abw
    2222# 
    2323#============================================================================ 
     
    2525package Template::Context; 
    2626 
    27 require 5.004; 
    28  
    2927use strict; 
    30 use vars qw( $VERSION $DEBUG $AUTOLOAD $DEBUG_FORMAT )
    31 use base qw( Template::Base )
     28use warnings
     29use base 'Template::Base'
    3230 
    3331use Template::Base; 
     
    3634use Template::Exception; 
    3735 
    38 $VERSION = sprintf("%d.%02d", q$Revision: 2.91 $ =~ /(\d+)\.(\d+)/); 
    39 $DEBUG_FORMAT = "\n## \$file line \$line : [% \$text %] ##\n"; 
    40  
     36our $VERSION = 2.98; 
     37our $DEBUG   = 0 unless defined $DEBUG; 
     38our $DEBUG_FORMAT = "\n## \$file line \$line : [% \$text %] ##\n"; 
     39our $AUTOLOAD; 
    4140 
    4241#======================================================================== 
     
    371370 
    372371            pop(@{$element->{ callers }}) 
    373                 if (UNIVERSAL::isa($element, 'Template::Document')); 
     372                if (UNIVERSAL::isa($component, 'Template::Document')); 
    374373        } 
    375374        $stash->set('component', $component); 
     
    427426 
    428427    FILE: foreach $file (@$files) { 
    429        my $name = $file; 
    430  
    431        if ($^O eq 'MSWin32') { 
    432            # let C:/foo through 
    433            $prefix = $1 if $name =~ s/^(\w{2,})://o; 
    434        
    435        else { 
    436            $prefix = $1 if $name =~ s/^(\w+)://; 
    437        
    438  
    439        if (defined $prefix) { 
    440            $providers = $self->{ PREFIX_MAP }->{ $prefix }  
    441            || return $self->throw(Template::Constants::ERROR_FILE, 
    442                                   "no providers for file prefix '$prefix'"); 
    443        
    444        else { 
    445            $providers = $self->{ PREFIX_MAP }->{ default } 
    446            || $self->{ LOAD_TEMPLATES }; 
    447        
    448  
    449        foreach my $provider (@$providers) { 
    450            ($text, $error) = $provider->load($name, $prefix); 
    451            next FILE unless $error; 
    452            if ($error == Template::Constants::STATUS_ERROR) { 
    453                $self->throw($text) if ref $text; 
    454                $self->throw(Template::Constants::ERROR_FILE, $text); 
    455            } 
    456        
    457        $self->throw(Template::Constants::ERROR_FILE, "$file: not found"); 
     428    my $name = $file; 
     429 
     430    if ($^O eq 'MSWin32') { 
     431        # let C:/foo through 
     432        $prefix = $1 if $name =~ s/^(\w{2,})://o; 
     433   
     434    else { 
     435        $prefix = $1 if $name =~ s/^(\w+)://; 
     436   
     437 
     438    if (defined $prefix) { 
     439        $providers = $self->{ PREFIX_MAP }->{ $prefix }  
     440        || return $self->throw(Template::Constants::ERROR_FILE, 
     441                   "no providers for file prefix '$prefix'"); 
     442   
     443    else { 
     444        $providers = $self->{ PREFIX_MAP }->{ default } 
     445        || $self->{ LOAD_TEMPLATES }; 
     446   
     447 
     448    foreach my $provider (@$providers) { 
     449        ($text, $error) = $provider->load($name, $prefix); 
     450        next FILE unless $error; 
     451        if ($error == Template::Constants::STATUS_ERROR) { 
     452        $self->throw($text) if ref $text; 
     453        $self->throw(Template::Constants::ERROR_FILE, $text); 
     454        } 
     455   
     456    $self->throw(Template::Constants::ERROR_FILE, "$file: not found"); 
    458457    } 
    459458    continue { 
    460        $output .= $text; 
     459    $output .= $text; 
    461460    } 
    462461    return $output; 
     
    497496    # die! die! die! 
    498497    if (UNIVERSAL::isa($error, 'Template::Exception')) { 
    499        die $error; 
     498    die $error; 
    500499    } 
    501500    elsif (defined $info) { 
    502        die (Template::Exception->new($error, $info, $output)); 
     501    die (Template::Exception->new($error, $info, $output)); 
    503502    } 
    504503    else { 
    505        $error ||= ''; 
    506        die (Template::Exception->new('undef', $error, $output)); 
     504    $error ||= ''; 
     505    die (Template::Exception->new('undef', $error, $output)); 
    507506    } 
    508507 
     
    534533 
    535534    if (UNIVERSAL::isa($error, 'Template::Exception')) { 
    536        $error->text($output) if $output; 
    537        return $error; 
     535    $error->text($output) if $output; 
     536    return $error; 
    538537    } 
    539538    else { 
    540        return Template::Exception->new('undef', $error, $output); 
     539    return Template::Exception->new('undef', $error, $output); 
    541540    } 
    542541} 
     
    589588# The leave() method is called when the document has finished 
    590589# processing itself.  This removes the entry from the BLKSTACK list 
    591 # that was added visit() above.  For persistance of BLOCK definitions, 
     590# that was added visit() above.  For persistence of BLOCK definitions, 
    592591# the process() method (i.e. the PROCESS directive) does some extra 
    593592# magic to copy BLOCKs into a shared hash. 
     
    607606# object or as text which is compiled into a template.  Returns a true 
    608607# value (the $block reference or compiled block reference) if 
    609 # succesful or undef on failure.  Call error() to retrieve the 
     608# successful or undef on failure.  Call error() to retrieve the 
    610609# relevent error message (i.e. compilation failure). 
    611610#------------------------------------------------------------------------ 
     
    614613    my ($self, $name, $block) = @_; 
    615614    $block = $self->template(\$block) 
    616        || return undef 
    617            unless ref $block; 
     615    || return undef 
     616        unless ref $block; 
    618617    $self->{ BLOCKS }->{ $name } = $block; 
    619618} 
     
    632631 
    633632    foreach my $provider (@{ $self->{ LOAD_FILTERS } }) { 
    634        ($result, $error) = $provider->store($name, $filter); 
    635        return 1 unless $error; 
    636        $self->throw(&Template::Constants::ERROR_FILTER, $result) 
    637            if $error == &Template::Constants::STATUS_ERROR; 
     633    ($result, $error) = $provider->store($name, $filter); 
     634    return 1 unless $error; 
     635    $self->throw(&Template::Constants::ERROR_FILTER, $result) 
     636        if $error == &Template::Constants::STATUS_ERROR; 
    638637    } 
    639638    $self->throw(&Template::Constants::ERROR_FILTER,  
    640                 "FILTER providers declined to store filter $name"); 
     639        "FILTER providers declined to store filter $name"); 
    641640} 
    642641 
     
    698697#    print "*** debug(@args)\n"; 
    699698    if (@args) { 
    700        if ($args[0] =~ /^on|1$/i) { 
    701            $self->{ DEBUG_DIRS } = 1; 
    702            shift(@args); 
    703        
    704        elsif ($args[0] =~ /^off|0$/i) { 
    705            $self->{ DEBUG_DIRS } = 0; 
    706            shift(@args); 
    707        
     699    if ($args[0] =~ /^on|1$/i) { 
     700        $self->{ DEBUG_DIRS } = 1; 
     701        shift(@args); 
     702   
     703    elsif ($args[0] =~ /^off|0$/i) { 
     704        $self->{ DEBUG_DIRS } = 0; 
     705        shift(@args); 
     706   
    708707    } 
    709708 
    710709    if (@args) { 
    711        if ($args[0] =~ /^msg$/i) { 
     710    if ($args[0] =~ /^msg$/i) { 
    712711            return unless $self->{ DEBUG_DIRS }; 
    713            my $format = $self->{ DEBUG_FORMAT }; 
    714            $format = $DEBUG_FORMAT unless defined $format; 
    715            $format =~ s/\$(\w+)/$hash->{ $1 }/ge; 
    716            return $format; 
    717        
    718        elsif ($args[0] =~ /^format$/i) { 
    719            $self->{ DEBUG_FORMAT } = $args[1]; 
    720        
    721        # else ignore 
     712        my $format = $self->{ DEBUG_FORMAT }; 
     713        $format = $DEBUG_FORMAT unless defined $format; 
     714        $format =~ s/\$(\w+)/$hash->{ $1 }/ge; 
     715        return $format; 
     716   
     717    elsif ($args[0] =~ /^format$/i) { 
     718        $self->{ DEBUG_FORMAT } = $args[1]; 
     719   
     720    # else ignore 
    722721    } 
    723722 
     
    744743 
    745744    warn "no such context method/member: $method\n" 
    746        unless defined ($result = $self->{ uc $method }); 
     745    unless defined ($result = $self->{ uc $method }); 
    747746 
    748747    return $result; 
     
    778777    my ($name, $item, $method, $block, $blocks); 
    779778    my @itemlut = (  
    780        LOAD_TEMPLATES => 'provider', 
    781        LOAD_PLUGINS   => 'plugins', 
    782        LOAD_FILTERS   => 'filters'  
     779        LOAD_TEMPLATES => 'provider', 
     780        LOAD_PLUGINS   => 'plugins', 
     781        LOAD_FILTERS   => 'filters'  
    783782    ); 
    784783 
    785784    # LOAD_TEMPLATE, LOAD_PLUGINS, LOAD_FILTERS - lists of providers 
    786785    while (($name, $method) = splice(@itemlut, 0, 2)) { 
    787        $item = $config->{ $name }  
    788             || Template::Config->$method($config) 
    789             || return $self->error($Template::Config::ERROR); 
    790        $self->{ $name } = ref $item eq 'ARRAY' ? $item : [ $item ]; 
     786        $item = $config->{ $name }  
     787            || Template::Config->$method($config) 
     788            || return $self->error($Template::Config::ERROR); 
     789        $self->{ $name } = ref $item eq 'ARRAY' ? $item : [ $item ]; 
    791790    } 
    792791 
     
    794793    my $prefix_map = $self->{ PREFIX_MAP } = $config->{ PREFIX_MAP } || { }; 
    795794    while (my ($key, $val) = each %$prefix_map) { 
    796         $prefix_map->{ $key } = [ ref $val ? $val : 
    797                                   map { $providers->[$_] }  
    798                                   split(/\D+/, $val) ] 
    799             unless ref $val eq 'ARRAY'; 
    800 #       print(STDERR "prefix $key => $val => [",  
    801 #             join(', ', @{ $prefix_map->{ $key } }), "]\n"); 
     795        $prefix_map->{ $key } = [ ref $val ? $val :  
     796                                  map { $providers->[$_] } split(/\D+/, $val) ] 
     797                                  unless ref $val eq 'ARRAY'; 
    802798    } 
    803799 
    804800    # STASH 
    805801    $self->{ STASH } = $config->{ STASH } || do { 
    806       my $predefs  = $config->{ VARIABLES }  
    807                    || $config->{ PRE_DEFINE }  
    808                    || { }; 
    809  
    810        # hack to get stash to know about debug mode 
    811        $predefs->{ _DEBUG } = ( ($config->{ DEBUG } || 0) 
    812                                & &Template::Constants::DEBUG_UNDEF ) ? 1 : 0 
    813             unless defined $predefs->{ _DEBUG }; 
    814                                  
    815        Template::Config->stash($predefs) 
    816            || return $self->error($Template::Config::ERROR); 
     802        my $predefs  = $config->{ VARIABLES }  
     803            || $config->{ PRE_DEFINE }  
     804            || { }; 
     805 
     806        # hack to get stash to know about debug mode 
     807        $predefs->{ _DEBUG } = ( ($config->{ DEBUG } || 0) 
     808                                 & &Template::Constants::DEBUG_UNDEF ) ? 1 : 0 
     809                                 unless defined $predefs->{ _DEBUG }; 
     810         
     811        Template::Config->stash($predefs) 
     812            || return $self->error($Template::Config::ERROR); 
    817813    }; 
    818  
     814     
    819815    # compile any template BLOCKS specified as text 
    820816    $blocks = $config->{ BLOCKS } || { }; 
    821817    $self->{ INIT_BLOCKS } = $self->{ BLOCKS } = {  
    822        map { 
    823            $block = $blocks->{ $_ }; 
    824            $block = $self->template(\$block) 
    825                || return undef 
    826                    unless ref $block; 
    827            ($_ => $block); 
    828        }  
    829        keys %$blocks 
     818        map { 
     819            $block = $blocks->{ $_ }; 
     820            $block = $self->template(\$block) 
     821                || return undef 
     822                unless ref $block; 
     823            ($_ => $block); 
     824        }  
     825        keys %$blocks 
    830826    }; 
    831827 
     
    875871 
    876872    foreach $key (qw( RECURSION EVAL_PERL TRIM )) { 
    877        $output .= sprintf($format, $key, $self->{ $key }); 
     873    $output .= sprintf($format, $key, $self->{ $key }); 
    878874    } 
    879875    foreach my $pname (qw( LOAD_TEMPLATES LOAD_PLUGINS LOAD_FILTERS )) { 
    880        my $provtext = "[\n"; 
    881        foreach my $prov (@{ $self->{ $pname } }) { 
    882            $provtext .= $prov->_dump(); 
    883 #          $provtext .= ",\n"; 
    884        
    885        $provtext =~ s/\n/\n        /g; 
    886        $provtext =~ s/\s+$//; 
    887        $provtext .= ",\n    ]"; 
    888        $output .= sprintf($format, $pname, $provtext); 
     876    my $provtext = "[\n"; 
     877    foreach my $prov (@{ $self->{ $pname } }) { 
     878        $provtext .= $prov->_dump(); 
     879#       $provtext .= ",\n"; 
     880   
     881    $provtext =~ s/\n/\n        /g; 
     882    $provtext =~ s/\s+$//; 
     883    $provtext .= ",\n    ]"; 
     884    $output .= sprintf($format, $pname, $provtext); 
    889885    } 
    890886    $output .= sprintf($format, STASH => $self->{ STASH }->_dump()); 
     
    15461542=head1 AUTHOR 
    15471543 
    1548 Andy Wardley E<lt>abw@andywardley.comE<gt> 
    1549  
    1550 L<http://www.andywardley.com/|http://www.andywardley.com/> 
     1544Andy Wardley E<lt>abw@wardley.orgE<gt> 
     1545 
     1546L<http://wardley.org/|http://wardley.org/> 
    15511547 
    15521548 
     
    15551551=head1 VERSION 
    15561552