>-----Original Message-----
>From: Alexander Hartmaier [mailto:alexander.hartmaier@t-
>systems.at]
>Sent: 31 October 2012 12:46
>To: catalyst@lists.scsys.co.uk
>Subject: Re: [Catalyst] Access Catalyst context object from script

>I suggest to load your Catalyst app with a config that doesn't
>load
>unnecessary stuff like the models and views, just the controllers
>and
>use $c->uri_for_action.
>Take a look at how Catalyst::Test::ctx_request does it or even
>use
>Catalyst::Test...

Great - this worked, thanks. I used:

        use Catalyst::Test 'MyApp';
        my($res, $c) = ctx_request('/');

... then I just pass $c into the layer I use for the TT/mailing bit:

        $params{Catalyst} = $c;

        # New MIME::Lite::TT object:
        my $msg = MIME::Lite::TT->new(
                From        =>  $from,
                To          =>  $to,
                        Subject     =>  $subject,
                Template    =>  $template_path,
                TmplOptions =>  \%options,
                        TmplParams  =>  \%params,
        );
 
Thanks for your help,

Anthony

_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/

Reply via email to