Evan A. Zacks wrote:
On Wed, Nov 08, 2006 at 03:38:28PM -0500, Jason Purdy wrote:sub my_runmode { my $self = shift; my $query = $self->query(); $query->param( 'eid' ) =~ m%^(\d+)$%; my $email_id = $1; my $email = OTREmail->retrieve( $query->param( 'eid' ) );Not sure if this was just typed into your email, or pasted from actual code, but is there any reason you don't use the untainted $email_id in your call to OTREmail->retrieve() ?
You're right - I did paste from actual code, but it's still in development. Fixed - thanks! :) I had untainted the $email_id for the command call later on, but forgot to piggyback on that work for the cdbi retrieval.
# forking off the email sending... if ( my $pid = fork() ) { # this is the parent, in which case, we don't need anything else # ... Nothing to see here ... # ... Move along! ... } elsif( defined $pid ) { # this is the child close( STDOUT ); # so the parent can move on... :) my $output = qx%./otr_sendemails.pl $email_id%; } else { die "Cannot fork off email thread: $!"; } return $self->forward( 'start' ); }Should the child process exit after it's done running the external process? Its return value ($self->forward()) won't be seen by the end user. Perhaps consider using exec() to replace the child process with the (possibly long-running) otr_sendemails.pl script.
I tried exec, system and qx, but they all mangled or held up the output. Per the exec() documentation, there shouldn't be anything after a call. When I tried the exec(), I got a 500 error b/c the output of the utility script was passed along.
My usage is pretty specific and probably irrelevant for some -- I'm not interested in the output and I'm not using mod_perl for it.
I did get Randal's column for some inspiration, but the glimmer that I really wanted people to see is that you have to close STDOUT in the forked process so the cgiapp parent process can keep going.
- Jason --------------------------------------------------------------------- Web Archive: http://www.mail-archive.com/[email protected]/ http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2 To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
