Well I figured out what was wrong. When I defined an error runmode it
shunted all the error messages to it and I couldn't see the errors that it
was producing. The moral of the story is if you define an error runmode, use
it. Now the other problem I have is that my replacing of load_tmpl is not
working. Where should add_callback be placed? In cgiapp_init or setup?

On 12/28/05, Jamie Krasnoo <[EMAIL PROTECTED]> wrote:
>
> Dan,
>
> I'm sorry. I should have included that too. In my cgiapp_init I have this.
>
> # Application initiation
> sub cgiapp_init {
>     my $self = shift;
>
>     # configure the database from the environment
>     $self->dbh_config();
>
>     # Override the load_tmpl callback
>     $self->add_callback('load_tmpl', \&load_tmpl_expr);
>
>     my $cgi_obj = $self->cgiapp_get_query();
>
>     # get the user's id
>     $self->param('userid',($ENV{'REQUEST_METHOD'} eq 'GET') ?
> $ENV{'REMOTE_USER'} : $cgi_obj->param('USERID'));
>
>
> $self->param('user_data',&APP::GMOP::UTIL::DatabaseCalls::_get_user_data($self));
>
>
> }
>
> On 12/28/05, Dan Horne <[EMAIL PROTECTED]> wrote:
> >
> > Jamie
> >
> > Maybe I'm confused. Your sub below is load_tmpl_expr, so how have you
> > overloaded load_tmpl?
> >
> > By the way, I switched from H::T to H::T::Expr by using
> > C:A::Plugin::AnyTemplate - it made the migration painless
> >
> > Dan
> >
> > > -----Original Message-----
> > > From: Jamie Krasnoo [mailto:[EMAIL PROTECTED]
> > > Sent: Thursday, 29 December 2005 8:14 a.m.
> > > To: CGI App
> > > Subject: [cgiapp] load_tmpl stopped working
> > >
> > > I'm having a slight problem with CGI::App that I can't seem to figure
> > out.
> > > I
> > > have overloaded load_tmpl to use HTML::Template::Expr instead of the
> > > regular
> > > module.
> > >
> > > sub load_tmpl_expr {
> > >     my ($self, $ht_params, $tmpl_params, $tmpl_file) = @_;
> > >
> > >     my $template_obj = '';
> > >
> > >     use HTML::Template::Expr;
> > >
> > >     if (ref $tmpl_file eq 'SCALAR') {
> > >         $template_obj =
> > HTML::Template::Expr->new_scalar_ref($tmpl_file,
> > > %{$ht_params});
> > >     }
> > >     elsif (ref $tmpl_file eq 'GLOB') {
> > >         $template_obj =
> > HTML::Template::Expr->new_filehandle($tmpl_file,
> > > %{$ht_params} );
> > >     }
> > >     else {
> > >         $template_obj = HTML::Template::Expr->new_file($tmpl_file,
> > > %{$ht_params} );
> > >     }
> > >
> > >     return $template_obj;
> > > }
> > >
> > > and also overloaded cgiapp_postrun to encapsulate the output of all
> > the
> > > runmodes in a main template.
> > >
> > > sub cgiapp_postrun {
> > >     my $self = shift;
> > >     my $output_ref = shift;
> > >
> > >
> > >     my $masterTemplate = $self->load_tmpl('GMOP_master.html');
> > >     $masterTemplate->param('CONTENT', $$output_ref);
> > >     $masterTemplate->param('SECTIONNAME',
> > $self->param('section_name'));
> > >
> > >     # Replace old output with new output
> > >     $$output_ref = $masterTemplate->output();
> > > }
> > >
> > > Hoever load_tmpl seems to have stopped working for the runmodes except
> > for
> > > cgiapp_postrun. In fact it seems like all the runmodes die without
> > giving
> > > any errors at all. They all just stop right before loading the
> > template.
> > > I've put in print STDERR statements before and after the load_tmpl and
> > the
> > > print statment before the load_tmpl always shows up in the logs but
> > the
> > > one
> > > after never does. So I'm guessing that the runmode is dying
> > unexpectedly.
> > > Can anyone give me any suggestions as to what I'm doing wrong or if
> > anyone
> > > has come across this problem before?
> > >
> > > Thanks,
> > >
> > > Jamie
> >
> >
>

Reply via email to