[Catalyst] Access Catalyst context object from script

Anthony Gladdish anthony.gladdish at newcastle.ac.uk
Wed Oct 31 13:10:41 GMT 2012

>-----Original Message-----
>From: Alexander Hartmaier [mailto:alexander.hartmaier at t-
>Sent: 31 October 2012 12:46
>To: catalyst at 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
>unnecessary stuff like the models and views, just the controllers
>use $c->uri_for_action.
>Take a look at how Catalyst::Test::ctx_request does it or even

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,


More information about the Catalyst mailing list