[Templates-cvs] cvs commit: TT3/lib/Template/TT3/Generator Debug.pm

cvs@template-toolkit.org cvs@template-toolkit.org
Mon, 02 Feb 2004 10:01:39 +0000


cvs         04/02/02 10:01:38

  Modified:    lib/Template/TT3/Generator Debug.pm
  Log:
  * added temporary _default() method
  
  Revision  Changes    Path
  1.4       +20 -4     TT3/lib/Template/TT3/Generator/Debug.pm
  
  Index: Debug.pm
  ===================================================================
  RCS file: /template-toolkit/TT3/lib/Template/TT3/Generator/Debug.pm,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Debug.pm	2004/01/26 14:27:06	1.3
  +++ Debug.pm	2004/02/02 10:01:37	1.4
  @@ -17,7 +17,7 @@
   #   modify it under the same terms as Perl itself.
   #
   # REVISION
  -#   $Id: Debug.pm,v 1.3 2004/01/26 14:27:06 abw Exp $
  +#   $Id: Debug.pm,v 1.4 2004/02/02 10:01:37 abw Exp $
   #
   #========================================================================
   
  @@ -26,12 +26,13 @@
   use strict;
   use warnings;
   use Template::TT3::Generator;
  -use vars qw( $VERSION $DEBUG $ERROR );
  +use vars qw( $VERSION $DEBUG $ERROR $DEFAULT );
   use base qw( Template::TT3::Generator );
   
  -$VERSION = sprintf("%d.%02d", q$Revision: 1.3 $ =~ /(\d+)\.(\d+)/);
  +$VERSION = sprintf("%d.%02d", q$Revision: 1.4 $ =~ /(\d+)\.(\d+)/);
   $DEBUG   = 0 unless defined $DEBUG;
   $ERROR   = '';
  +$DEFAULT = '_default';
   
   
   sub integer {
  @@ -419,6 +420,21 @@
       return "<test:$item>";
   }
   
  +
  +# NOTE: this is temporary
  +
  +sub _default {
  +    my ($self, $name, @items) = @_;
  +    my ($out, $items);
  +
  +    foreach my $item (@items) {
  +        $out = $self->generate($item) || return;
  +        $out =~ s/\n/\n  /g;
  +        $items .= "  $out\n";
  +    }
  +    return "<$name:\n$items>";
  +}
  +    
   1;
   __END__
   
  @@ -452,7 +468,7 @@
   
   =head1 VERSION
   
  -$Revision: 1.3 $
  +$Revision: 1.4 $
   
   =head1 COPYRIGHT