1. Shlomi Fish
  2. latemp

Commits

shl...@52c325ad-5fd0-0310-8a0f-c43feede02cc  committed 767f91c

Now throwing an exception if the template procesing fails.

  • Participants
  • Parent commits 5bedb93
  • Branches default
  • Tags Perl/Template-Preprocessor-TTML/cpan-releases/0.01/0.0101

Comments (0)

Files changed (6)

File Perl/modules/Template-Preprocessor-TTML/Changes

View file
 Revision history for Template-Preprocessor-TTML
 
+0.0101  Wed Jan 25 19:54:45 IST 2006
+  - Now throwing an exception if the template processing failed.
 0.0100  Mon Jan 16 21:01:57 IST 2006
         First version, released on an unsuspecting world.
 

File Perl/modules/Template-Preprocessor-TTML/MANIFEST

View file
 lib/Template/Preprocessor/TTML/Base.pm
 lib/Template/Preprocessor/TTML/CmdLineProc.pm
 lib/Template/Preprocessor/TTML.pm
+Makefile.PL
 MANIFEST
 META.yml # Will be created by "make dist"
 README
 t/data/input/explicit-includes.ttml
 t/data/input/hello.ttml
 t/data/input/implicit-includes.ttml
+t/data/input/invalid.ttml
 t/data/input/simple.ttml
 t/data/input/two-params.ttml
 t/pod-coverage.t
 t/pod.t
-Makefile.PL

File Perl/modules/Template-Preprocessor-TTML/TODO

View file
 * Fix the ::TTML POD.
     - Perhaps document the various command line options.
+
+* Throw an exception if $template->process() file (while having an adequate 
+test).

File Perl/modules/Template-Preprocessor-TTML/lib/Template/Preprocessor/TTML.pm

View file
 
 =cut
 
-our $VERSION = '0.0100';
+our $VERSION = '0.0101';
 
 =head1 SYNOPSIS
 
     };
     my $template = Template->new($config);
 
-    $template->process(
-        $self->opts()->input_filename(),
-        $self->opts()->defines(),
-        $self->_get_output(),
+    if (!
+        $template->process(
+            $self->opts()->input_filename(),
+            $self->opts()->defines(),
+            $self->_get_output(),
+        )
     )
+    {
+        die $template->error();
+    }
 }
 
 =head1 AUTHOR

File Perl/modules/Template-Preprocessor-TTML/t/02-main.t

View file
 use strict;
 use warnings;
 
-use Test::More tests => 12;
+use Test::More tests => 13;
 use File::Spec;
 use Template::Preprocessor::TTML;
 
 my $two_params_ttml = File::Spec->catfile( $input_dir, "two-params.ttml" );
 my $explicit_includes_ttml = File::Spec->catfile( $input_dir, "explicit-includes.ttml" );
 my $implicit_includes_ttml = File::Spec->catfile( $input_dir, "implicit-includes.ttml" );
-
+my $invalid_ttml = File::Spec->catfile( $input_dir, "invalid.ttml" );
 
 
 {
     # TEST
     like ($ret->{'out'}, qr{This is TTML version}, "Help #1");
 }
+
+{
+    my $pp = Template::Preprocessor::TTML->new('argv' => [$invalid_ttml]);
+    my $ret;
+    eval {
+        $ret = trap(sub { $pp->run(); });
+    };
+    # TEST
+    ok ($@, "Throws an excpetion on invalid input.");
+}

File Perl/modules/Template-Preprocessor-TTML/t/data/input/invalid.ttml

View file
+[% SET a = BLOCK %]
+Hello.
+[% END %]
+
+[% a %]