On Mon, 27 Jan 2003 12:21:02 +0100, Enric Roca wrote:

I don't see any real concurrency problem in your script, but I'm also not
a concurrency expert. However, I believe, I can help you to write your
script more Perlish :-)

> This is the script:
> 
> 
> #!/usr/local/bin/perl

use strict;
use warnings;

> print "Content-type: text/xml\n";
> use CGI;

You never use a method from the CGI module in this script.

> read(STDIN, $cadena, $ENV{'CONTENT_LENGTH'});

I'm also not a CGI expert, but I believer that STDIN consists of nothing
more than the content. So a

local $/ = undef;
my $cadena = <STDIN>;

could be enough.

> 
> $cadena =~ tr/+/ /;     # reeplace the + sign by spaces
> 
> $request = "> /myfolder/mypipe/pipe1";

So you will open a file, not a pipe!

> 
> unless (open(SYSREQUEST, $request))
>   {
>     die("Impossible to open the pipe $request\n");
>   }
> 
> print SYSREQUEST "$cadena\n";

A shorter to write it is
open SYSREQUEST, '> /myfolder/mypipe/pipe1' or die "Impossible ...";
print SYSREQUEST $cadena, "\n";

> close(SYSREQUEST);
> 
> $request2 = "/myfolder/mypipe/pipe2";
> 
> unless (open(SYSREQUEST2, $request2))
>   {
>     die("Impossible to open the pipe $request2\n");
>   }
> 

Again, shorter is
open SYSREQUEST2, "/myfolder/mypipe/pipe2" or die "...";

> while ( <SYSREQUEST2> )
> {
>   print "$_\n";
> }

print $_, "\n" while <SYSREQUEST>;

> close(SYSREQUEST2);
> 

Greetings,
Janek

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to