David Martin wrote:
> I have an inherited script that sends an email using TT to assemble an 
> email.  The template syntax compiles fine, and the script actually 
> succeeds without issue from the commandline.  However when cron runs the 
> script the $response variable is empty.
> 
>  
> 
> I have verified that the only variable that is altered in cron vs cmd 
> line is %ENV so I making an educated guess that this is somehow causing 
> $response to be empty.
> 
>  
> 
>                 my $response = '';
> 
>                 $tt->process( 'process_response.tt2', {
> 
>                         data  => $data,
> 
>                         env => \%ENV,
> 
>                         context => 'email'
> 
>                 }, \$response );
> 
>  
> 
> I have captured the contents of %ENV from both environments and pasted 
> below my sig.  Anyone see what may be causing issues?  Any advice as to 
> how to fix?

I think Andrew hit this right on the head. Most likely your cron job isn't 
running the script in the current directory of process_response.tt2. That means 
your process_response.tt2 file isn't found because it's not included.

So you have a few fixes you could do. Add the correct path for 
process_response.tt2 to the INCLUDE_PATH config. Or make sure your script is in 
the correct working directory.

If it's not that, then I'm not sure what is going on. You should probably be 
checking the return value of the ->process call and dying with $tt->error() if 
it's false.

-- Josh

_______________________________________________
templates mailing list
templates@template-toolkit.org
http://mail.template-toolkit.org/mailman/listinfo/templates

Reply via email to