Re: System calls to return data via STDOUT

1999-12-08 Thread G.W. Haywood

Hi again,

On Wed, 8 Dec 1999, hamid khoshnevis wrote:

> Thanks, Ged.
>
> No you are right on.  I do glimpseindex off-line and want to search using 
> glimpse.  So I call glimpse and get the result set which I am able to pull 
> into regular perl with no problem but as soon as I take the working solution 
> to modperl, no result set comes back to the browser.  I am now trying the 
> solutions others have recommended, but so far no luck.

Hmmm.  Typical cgi -> modperl scenario?

I'm a bit clearer, now, how far you've got.  When you say that you are
able to pull the result set into perl, do you mean into an Apache cgi
script written in perl or into a perl script running at a terminal?

If you haven't yet made it work with plain Apache/cgi then I think it
would be a good idea to do that before mod_perl clouds the issue.

>From your previous posts it seemed like you were designing the system
but now it seems more like you're into debugging.  If you get to the
bottom of it from the others' suggestions, let me know.  If not, come
back to me and we'll do some more investigation.

73
Ged.




Re: System calls to return data via STDOUT

1999-12-07 Thread Andrei A. Voropaev

It's better not to put this stuff into mod_perl because you'll have issues with memory 
etc. And the time you gain is nothing to compare with the time needed
to start external process.

Put it in regular CGI script. And to catch output from external program
use standart methods like backticks, pipe, etc. If you need to provide some
input to that external program then you may want to use the following method.


$pid = open(IN, "-|");
if($pid == 0){ #child, STDOUT -> parent
   open(OUT, "|external_program");
   print OUT @stuff_for_external_program;
   close(OUT); # wait for it to finish;
   exit 0;
}
@from_external_program = ;
  
Add child reaper and you should be all set.

Andrei

On Tue, Dec 07, 1999 at 01:53:20AM -0800, hamid khoshnevis wrote:
> I am trying to call Glimpse from modperl and capture the data set back.  
> After I wrote the email, I was told by a friend that I should use temporary 
> files to capture the output of Glimpse.
> 
> Any ideas??
> 
> hamid
> 
> 
> >From: "G.W. Haywood" <[EMAIL PROTECTED]>
> >To: mod_perl Mailing List <[EMAIL PROTECTED]>
> >Subject: System calls to return data via STDOUT
> >Date: Mon, 6 Dec 1999 19:01:23 + (GMT)
> >
> >Hi all,
> >
> >On Sun, 5 Dec 1999, hamid khoshnevis <[EMAIL PROTECTED]> wrote:
> >
> > > I am a newbie modperl'er
> >
> >Welcome to the club.
> >
> > > I am tyring to get system calls to return data to modperl (via stdout).
> >
> >The idea of mod_perl is to get things to go faster by avoiding as much
> >as possible the (time consuming) launching of new processes and things
> >like that.  Are your system calls launching new processes?  If so, you
> >may not be getting the benefits of mod_perl but you'll be getting the
> >disadvantages (huge memory consumption to name but a few).
> >
> >What is making the system calls and why?
> >Is There More Than One Way To Do It?
> >
> >73
> >Ged.
> >
> 
> __
> Get Your Private, Free Email at http://www.hotmail.com

-- 



Re: System calls to return data via STDOUT

1999-12-07 Thread Rick Myers

On Dec 07, 1999 at 01:53:20 -0800, hamid khoshnevis twiddled the keys to say:
> I am trying to call Glimpse from modperl and capture the data set back.  
> After I wrote the email, I was told by a friend that I should use temporary 
> files to capture the output of Glimpse.
> 
> Any ideas??

Pipe it to a filehandle. Something like...

  open PIPE, "/bin/glimpse |";
  while () {
push @array, $_;
  }

Not very mod_perl'ish, but it saves re-inventing the glimpse
engine in perl.

Rick Myers[EMAIL PROTECTED]

The Feynman Problem   1) Write down the problem.
Solving Algorithm 2) Think real hard.
  3) Write down the answer.



Re: System calls to return data via STDOUT

1999-12-07 Thread hamid khoshnevis

I am trying to call Glimpse from modperl and capture the data set back.  
After I wrote the email, I was told by a friend that I should use temporary 
files to capture the output of Glimpse.

Any ideas??

hamid


>From: "G.W. Haywood" <[EMAIL PROTECTED]>
>To: mod_perl Mailing List <[EMAIL PROTECTED]>
>Subject: System calls to return data via STDOUT
>Date: Mon, 6 Dec 1999 19:01:23 + (GMT)
>
>Hi all,
>
>On Sun, 5 Dec 1999, hamid khoshnevis <[EMAIL PROTECTED]> wrote:
>
> > I am a newbie modperl'er
>
>Welcome to the club.
>
> > I am tyring to get system calls to return data to modperl (via stdout).
>
>The idea of mod_perl is to get things to go faster by avoiding as much
>as possible the (time consuming) launching of new processes and things
>like that.  Are your system calls launching new processes?  If so, you
>may not be getting the benefits of mod_perl but you'll be getting the
>disadvantages (huge memory consumption to name but a few).
>
>What is making the system calls and why?
>Is There More Than One Way To Do It?
>
>73
>Ged.
>

__
Get Your Private, Free Email at http://www.hotmail.com



System calls to return data via STDOUT

1999-12-06 Thread G.W. Haywood

Hi all,

On Sun, 5 Dec 1999, hamid khoshnevis <[EMAIL PROTECTED]> wrote:

> I am a newbie modperl'er 

Welcome to the club.

> I am tyring to get system calls to return data to modperl (via stdout).

The idea of mod_perl is to get things to go faster by avoiding as much
as possible the (time consuming) launching of new processes and things
like that.  Are your system calls launching new processes?  If so, you
may not be getting the benefits of mod_perl but you'll be getting the
disadvantages (huge memory consumption to name but a few).

What is making the system calls and why?
Is There More Than One Way To Do It?

73
Ged.