OSDN Git Service

minimum error check on template file can not find
authorishikawa <ishikawa@180c8125-5b33-4295-ad04-72a68a15b4cc>
Wed, 15 Jul 2009 13:47:01 +0000 (13:47 +0000)
committerishikawa <ishikawa@180c8125-5b33-4295-ad04-72a68a15b4cc>
Wed, 15 Jul 2009 13:47:01 +0000 (13:47 +0000)
lib/Keitairc/View.pm

index ed85400..9be0475 100644 (file)
@@ -1,6 +1,6 @@
 # -*- mode: perl; coding: utf-8 -*-
 # Keitairc::View
-# $Id: View.pm,v 1.24 2009-07-15 13:41:55 ishikawa Exp $
+# $Id: View.pm,v 1.25 2009-07-15 13:47:01 ishikawa Exp $
 # $Source: /home/ishikawa/work/keitairc/tmp/keitairc/lib/Keitairc/View.pm,v $
 #
 # Copyright (c) 2008 Jun Morimoto <morimoto@mrmt.net>
@@ -109,17 +109,19 @@ sub template{
                $arch = 'ipod-sjis';
        }
 
-       my $t = new HTML::Template(
-               filename => $me->template_path("$arch/$template"),
-               die_on_bad_params => 0,
-               cache => 1);
-       $t->param($p);
+       if (my $filename = $me->template_path("$arch/$template")) {
+               my $t = new HTML::Template(
+                       filename => $filename,
+                       die_on_bad_params => 0,
+                       cache => 1);
+               $t->param($p);
 
-       if(defined $vars){
-               $t->param($vars);
-       }
+               if(defined $vars){
+                       $t->param($vars);
+               }
 
-       $t->output();
+               $t->output();
+       }
 }
 
 ################################################################