[Catalyst] [Beginner] C::V::Email::Template does not render

Alexander Hartmaier alexander.hartmaier at t-systems.at
Thu Sep 16 08:00:37 GMT 2010


As you can see in the docs of C::View::Email::Template the view you
configure has to be TT, Web in your case, not Email::Template itself.

The rendered template looks fine to me besides the localize.
Does this work with your View::Web when generating a html page for the
browser?

--
Best regards, Alex


Am Mittwoch, den 15.09.2010, 22:23 +0200 schrieb Ekki Plicht (DF4OR):
> Sorry to be a PITA, but I can't make heads nor tails of this view
> thing.
>
> When I started my app I created a view like this
>
> $ script/wshop_create.pl view Web TT
>
> Since then Cat renders my web templates fine.
>
> Now I have followed the cookbook example, later the example from
> C::V::Email::Template docs to send mails:
>
> $ script/wshop_create.pl view Email::Template Email::Template
>
> So I have two view instances, as debug output shows:
>
> | wshop::View::Email::Template | instance |
>
> | wshop::View::Web | instance |
>
> Configured like this (the relevant part only):
>
> <View::Email::Template>
>
> <default>
>
> content_type text/plain
>
> charset utf-8
>
> view Email::Template
>
> </default>
>
> </View::Email::Template>
>
> Now when I want to use the Email::Template like this:
>
> $c->stash->{digest} = $newuser->get_column('digest');
>
> $c->stash->{email} = {
>
> to => $c->req->params->{'email'},
>
> from => $c->config->{mailfrom},
>
> subject => $c->localize( 'mm_registersubject' ),
>
> template => 'registermail.tt'
>
> };
>
> $c->forward( $c->view( 'Email::Template' ));
>
> return $c->res->redirect( $c->uri_for('/user/registerdone') );
>
> I get an error:
>
> Caught exception in wshop::View::Email::Template->process
> "C::V::Email::Template's configured view
> 'wshop::View::Email::Template=HASH(0x9c00890)' doesn't have a render
> method!
> at /usr/lib/perl5/site_perl/5.12.2/i686-linux/Class/MOP/Method/Wrapped.pm line 159"
>
> Now that's most surprising. wshop::V::Email::Template doesn't have a
> render method? Hm. That's where I get lost...
>
> If I change the configuration to 'default view Web' (my other view),
> the email does get sent, but not rendered. A template like this
>
> [% c.localize('mm_reghello') %]
>
> [% c.localize('mm_regsent') %]
>
> [% c.uri_for('/user/registration') %][% c.digest %]
>
> [% c.localize('mm_regfinal') %]
>
> [% PROCESS mailsig.tt %]
>
> Context is [% c %]
>
> Base is [% base %]
>
> Name is [% name %]
>
> is turned into this:
>
> mm_reghello
> mm_regsent
> http://localhost:3000/user/registration
> mm_regfinal
> --
> Signature as intended (i.e. PROCESS works)
>
> Context is wshop=HASH(0xa229bc0)
> Base is http://localhost:3000/
> Name is wshop
>
>
> Any help is greatly appreciated, as I am really lost at the moment.
> TIA.
>
> Cheers,
>
> Ekki
>


*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
T-Systems Austria GesmbH   Rennweg 97-99, 1030 Wien
Handelsgericht Wien, FN 79340b
*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
Notice: This e-mail contains information that is confidential and may be privileged.
If you are not the intended recipient, please notify the sender and then
delete this e-mail immediately.
*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*



More information about the Catalyst mailing list