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
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to