Re: open - does not work

2000-09-29 Thread Vsevolod Ilyushchenko



Jerrad Pierce wrote:
 
 No... that opens a handle to ehir INPUT
 
 output is
 open(OUT, "magic_open |");

I am not sure why, but the command line Perl script with

open (AAA, "|some_program");

accepts input via "print AAA" AND prints the output of the program on stdout.

 Or you could just slurp in a string with
 
 $_ = `normal_open`;

Yes, I know. I just want to see how far I can go with the "open". Besides, according 
to the author of the script (it's for the analog web log analyzer), using open is more 
secure.

Simon
-- 
 _
|   x |   Simon (Vsevolod ILyushchenko) [EMAIL PROTECTED]   
| y = e   |
|_|   http://www.simonf.com[EMAIL PROTECTED]   
| 
 
Disclaimer: This is not me.
This is just my mailer talking to your mailer...



Re: open - does not work

2000-09-29 Thread Doug MacEachern

On Fri, 29 Sep 2000, Vsevolod Ilyushchenko wrote:

 
 I am not sure why, but the command line Perl script with
 
   open (AAA, "|some_program");
 
 accepts input via "print AAA" AND prints the output of the program on stdout.

because C-level stdout is not hooked up to the client under mod_perl.

  Or you could just slurp in a string with
  
  $_ = `normal_open`;
 
 Yes, I know. I just want to see how far I can go with the "open".
 Besides, according to the author of the script (it's for the analog web
 log analyzer), using open is more secure.

i've never heard that before, how is it more secure?  more efficient
maybe, but doubt that its more secure.




Re: open - does not work

2000-09-29 Thread Jim Winstead

On Sep 29, Doug MacEachern wrote:
 On Fri, 29 Sep 2000, Vsevolod Ilyushchenko wrote:
  Yes, I know. I just want to see how far I can go with the "open".
  Besides, according to the author of the script (it's for the analog web
  log analyzer), using open is more secure.
 
 i've never heard that before, how is it more secure?  more efficient
 maybe, but doubt that its more secure.

probably a reference to the fact that you have to escape the
arguments used in something like $foo = `cat $bar` because it will
go through /bin/sh, but you can avoid that by using open/fork/exec
(or the three-argument open in perl 5.6).

jim



Re: open - does not work

2000-09-28 Thread Doug MacEachern

On Thu, 28 Sep 2000, Vsevolod Ilyushchenko wrote:

 Hi,
 
 Why does this script give no output under mod_perl, but works fine from the command 
line:
 
 #!/usr/bin/perl -w
 
 use CGI;
 
 print CGI-header();
 
 open (AAA, "-");

because the C level stdout is not hooked up to the client.  you can do
this as an alternative:

if ($ENV{MOD_PERL}) {
tie *AAA, 'Apache';
}
else {
open (AAA, "-");
}




Re: open - does not work

2000-09-28 Thread Vsevolod Ilyushchenko

  Why does this script give no output under mod_perl, but works fine from the 
command line:
 
  #!/usr/bin/perl -w
 
  use CGI;
 
  print CGI-header();
 
  open (AAA, "-");
 
 because the C level stdout is not hooked up to the client.  you can do
 this as an alternative:
 
 if ($ENV{MOD_PERL}) {
 tie *AAA, 'Apache';
 }
 else {
 open (AAA, "-");
 }

Doug,

Thanks, this works. However, it also gives me the following error:

Can't locate object method "FETCH" via package "Apache" at 
/usr/lib/perl5/site_perl/5.005/i386-linux/Apache/PerlRun.pm line 310.

Besides, what is the incantation to be able to open pipes to programs and capture 
their output:

open (AAA, "|some_program");

Simon
-- 
 _
|   x |   Simon (Vsevolod ILyushchenko) [EMAIL PROTECTED]   
| y = e   |
|_|   http://www.simonf.com[EMAIL PROTECTED]   
| 
 
Disclaimer: This is not me.
This is just my mailer talking to your mailer...



RE: open - does not work

2000-09-28 Thread Jerrad Pierce

No... that opens a handle to ehir INPUT

output is
open(OUT, "magic_open |");

Or you could just slurp in a string with

$_ = `normal_open`;

-Original Message-
From: Vsevolod Ilyushchenko [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 28, 2000 5:17 PM
To: Doug MacEachern
Cc: [EMAIL PROTECTED]
Subject: Re: open "-" does not work


  Why does this script give no output under mod_perl, but 
works fine from the command line:
 
  #!/usr/bin/perl -w
 
  use CGI;
 
  print CGI-header();
 
  open (AAA, "-");
 
 because the C level stdout is not hooked up to the client.  
you can do
 this as an alternative:
 
 if ($ENV{MOD_PERL}) {
 tie *AAA, 'Apache';
 }
 else {
 open (AAA, "-");
 }

Doug,

Thanks, this works. However, it also gives me the following error:

Can't locate object method "FETCH" via package "Apache" at 
/usr/lib/perl5/site_perl/5.005/i386-linux/Apache/PerlRun.pm line 310.

Besides, what is the incantation to be able to open pipes to 
programs and capture their output:

open (AAA, "|some_program");

Simon
-- 
 _
|   x |   Simon (Vsevolod ILyushchenko) [EMAIL PROTECTED]   
| y = e   |
|_|   http://www.simonf.com
[EMAIL PROTECTED]  
 
   Disclaimer: This is not me. 
   
   This is just my mailer talking to your mailer...