Hi Josh, When your mail arrived I was trying the call like so
$tt->process( '/www/foo/bar/baz/process_response.tt2', { post_data => $post_data, env => '\%ENV', context => 'email', confirm_key => $person->cs_code, print_mailings => [EMAIL PROTECTED] }, \$response ) || die $tt->error; Can I call process with the full path? It succeeded from the command line so I am guessing I can... When you say to add the path to INCLUDE_PATH do you mean push it to @INC? Or is that a TT config? Or? TIA David > -----Original Message----- > From: Josh Rosenbaum [mailto:] > Sent: Tuesday, January 29, 2008 3:13 PM > To: [EMAIL PROTECTED] > Cc: templates@template-toolkit.org > Subject: Re: [Templates] problems with %ENV when using TT from cron? > > 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