[21860] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 4064 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Nov 4 14:07:45 2002

Date: Mon, 4 Nov 2002 11:05:10 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 4 Nov 2002     Volume: 10 Number: 4064

Today's topics:
        "Premature end of script headers" error message (Albert)
    Re: "Premature end of script headers" error message <Graham.T.Wood@oracle.com>
    Re: "Premature end of script headers" error message <cingram@pjocsNOSPAMORHAM.demon.co.uk>
    Re: "Premature end of script headers" error message <flavell@mail.cern.ch>
    Re: Chart creation <jeff@vpservices.com>
        Checking AFS tokens <family2@aracnet.com>
    Re: don't understand use strict; <jurgenex@hotmail.com>
    Re: don't understand use strict; <tassilo.parseval@post.rwth-aachen.de>
    Re: don't understand use strict; <tassilo.parseval@post.rwth-aachen.de>
    Re: don't understand use strict; <md0nilhe@mdstud.DIESPAMchalmers.se>
    Re: don't understand use strict; <jurgenex@hotmail.com>
        Erroneous pattern matching? <jon@rogers.tv>
    Re: Erroneous pattern matching? <nospam@nospam.org>
        Flash sendXML with CGI <rrobbins@kolbnetworks.com>
    Re: Limit output of examine (x) and return (r) in debug (Peter Scott)
    Re: Perl -e "print qq!    Tips and Tricks   !" <zzapper@ntlworld.com>
    Re: Perl and large text files <jurgenex@hotmail.com>
    Re: Perl and large text files <jarkko.rantamaki@edu.stadia.no.spam.fi>
    Re: Perl question.... <jurgenex@hotmail.com>
        supplying input to external command (J M)
    Re: supplying input to external command <tassilo.parseval@post.rwth-aachen.de>
    Re: supplying input to external command <bart.lateur@pandora.be>
        Written under a socket descriptor problem .... <ochampag@nortelnetworks.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 4 Nov 2002 08:25:34 -0800
From: akastl@web.de (Albert)
Subject: "Premature end of script headers" error message
Message-Id: <cae869c7.0211040825.58d6ff2d@posting.google.com>

Hi,

I try to start a perl script by executing it via the address bar of
Internet Explorer. It is located on Apache Server with Linux.

After this I get an Internal Server Error. In the Apache error log
file I get the error message "Premature end of script headers".

A friend of mine said it could be that I used the wrong Perl editor. I
used the Windows editor to change the script. I doubt that's the
reason. Could it be that I have to transfer the perl script to the
host in binary and not in ASCII mode? I transfered it with WS-FTP in
ASCII mode. By the way, what is the "script header"?

It would be nice if you could help me.

Thanks in advance.

Albert


------------------------------

Date: Mon, 04 Nov 2002 17:51:33 +0000
From: Graham Wood <Graham.T.Wood@oracle.com>
Subject: Re: "Premature end of script headers" error message
Message-Id: <3DC6B3A5.FA22999B@oracle.com>

Albert wrote:

> Hi,
>
> I try to start a perl script by executing it via the address bar of
> Internet Explorer. It is located on Apache Server with Linux.
>
> After this I get an Internal Server Error. In the Apache error log
> file I get the error message "Premature end of script headers".
>
> A friend of mine said it could be that I used the wrong Perl editor. I
> used the Windows editor to change the script. I doubt that's the
> reason. Could it be that I have to transfer the perl script to the
> host in binary and not in ASCII mode? I transfered it with WS-FTP in
> ASCII mode. By the way, what is the "script header"?
>
> It would be nice if you could help me.
>
> Thanks in advance.
>
> Albert

Premature end of script headers means that your server has not been told
what type of content it is supposed to be displaying.  Your output needs
to start with "Content-type: text/html\n\n" if you're displaying html or
"Content-type: text/plain\n\n" if you are displaying plain text.  I
wouldn't expect perl to care if you transfered your script in ASCII or
binary mode.

Graham Wood



------------------------------

Date: Mon, 4 Nov 2002 18:21:18 -0000
From: "Clyde Ingram" <cingram@pjocsNOSPAMORHAM.demon.co.uk>
Subject: Re: "Premature end of script headers" error message
Message-Id: <aq6dp2$pqf$1$8300dec7@news.demon.co.uk>


"Graham Wood" <Graham.T.Wood@oracle.com> wrote in message
news:3DC6B3A5.FA22999B@oracle.com...
> Albert wrote:
>
> > Hi,
> >
> > I try to start a perl script by executing it via the address bar of
> > Internet Explorer. It is located on Apache Server with Linux.
> >
> > After this I get an Internal Server Error. In the Apache error log
> > file I get the error message "Premature end of script headers".
> >
> > A friend of mine said it could be that I used the wrong Perl editor. I
> > used the Windows editor to change the script. I doubt that's the
> > reason. Could it be that I have to transfer the perl script to the
> > host in binary and not in ASCII mode? I transfered it with WS-FTP in
> > ASCII mode. By the way, what is the "script header"?
> >
> > It would be nice if you could help me.
> >
> > Thanks in advance.
> >
> > Albert
>
> Premature end of script headers means that your server has not been told
> what type of content it is supposed to be displaying.  Your output needs
> to start with "Content-type: text/html\n\n" if you're displaying html or
> "Content-type: text/plain\n\n" if you are displaying plain text.

Try autoflushing output buffer, before any writes to STDOUT or STDERR,
perhaps.  IIRC:

    $| = 1;
 I
> wouldn't expect perl to care if you transfered your script in ASCII or
> binary mode.
>
> Graham Wood
>




------------------------------

Date: Mon, 4 Nov 2002 19:34:17 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: "Premature end of script headers" error message
Message-Id: <Pine.LNX.4.40.0211041918020.29666-100000@lxplus072.cern.ch>

On Nov 4, Graham Wood inscribed on the eternal scroll:

[fullquote - a worrying sign - snipped]

> Premature end of script headers means that your server has not been told
> what type of content it is supposed to be displaying.

Could be.  But it's quite possible to end the script headers
prematurely even _after_ an appropriate Content-type has been sent;
and on the other hand some kinds of CGI response don't require a
Content-type header.  So it's one possible - indeed rather common -
explanation, but it isn't what it "means".

> I wouldn't expect perl to care if you transfered your script in
> ASCII or binary mode.

So you're not aware of the strange effect which happens on unix when
there's a CR directly after #!/the/path/to/perl  on the shebang line,
but mysteriously goes away again if the advice (for quite other
reasons) to add -w or -wT is followed?

I definitely advise the original poster to upload scripts in so-called
"ascii" (i.e text) mode - especially important if doing cross-platform
transfers (typically Windows/unix).

An alternative is to get a Windows editor which can respect unix
line-end conventions (I use PFE32, for example), but a chap would need
to know a bit more about the technicalities before I'd be confident of
recommending that as the preferred solution.

And in general I'd advise the O.P to explore the resources cited in
http://www.perl.org/CGI_MetaFAQ.html
and in this case particularly
http://www.perl.org/troubleshooting_CGI.html

cheers



------------------------------

Date: Mon, 04 Nov 2002 08:14:52 -0800
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Chart creation
Message-Id: <3DC69CFC.6040703@vpservices.com>

Michael Gauf wrote:

> Can anyone sugvest any perl software that can create line charts on the
> fly, based on data inside a MySQL database? The line chart would have to
> hold many different types of data. The software could be freeware,
> shareware,or perhaps a tutorial. Thanks for your assistance.
> 
> Michael Gauf
> 

DBD::Chart or DBIx::Chart

-- 
Jeff



------------------------------

Date: Mon, 04 Nov 2002 07:58:05 -0600
From: Abernathey Family <family2@aracnet.com>
Subject: Checking AFS tokens
Message-Id: <3DC67CED.DF68C9C0@aracnet.com>

I'm looking for a better way to check for afs permission. Currently I
issue `tokens` and then parse the results for the cells of interest. I'm
wondering if there is a better way.


------------------------------

Date: Mon, 04 Nov 2002 16:12:32 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: don't understand use strict;
Message-Id: <Q%wx9.11908$t1.2840@nwrddc02.gnilink.net>

henrik nilsson wrote:
> i'm having problems with the "use strict;" option; even trivial
> scripts like the one below returns error messages like
> Global symbol "@err" requires explicit package name at test.pl line 5.
> Global symbol "$olle" requires explicit package name at test.pl line
> 7.
>
> why? isn't "$olle=1;" a valid declaration?

Because it is an assignment.

To declare a variable use "my" (or "local" but you don't want to use that
unless you know the differences to "my". There's an FAQ about it).

> #/usr/bin/perl -w
> use strict;
>
> $err[0]="gulle was a good farmer";
> $err[1]="and he had five sons";

You didn't declare @err anywhere.
Add
    my @err;
before your assignments. Of course you could declare the array and assign
values to it in one step:
    my @err = ("gulle was a good farmer", "and he had five sons");
>
> $olle = 1;

Same stuff: you didn't declare $olle anywhere:
    my $olle = 1;

jue




------------------------------

Date: 4 Nov 2002 16:21:27 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@post.rwth-aachen.de>
Subject: Re: don't understand use strict;
Message-Id: <aq66q7$bl3$1@nets3.rz.RWTH-Aachen.DE>

Also sprach henrik nilsson:

> i'm having problems with the "use strict;" option; even trivial scripts 
> like the one below returns error messages like
> Global symbol "@err" requires explicit package name at test.pl line 5.
> Global symbol "$olle" requires explicit package name at test.pl line 7.
> 
> why? isn't "$olle=1;" a valid declaration?

A strictures-proof declaration either includes my() or fully qualifying
a variable with its package name, in which case you create a global
variable for a package. You usually want the former flavour, that is, a
lexical variable.

> #/usr/bin/perl -w
> use strict;
> 
> $err[0]="gulle was a good farmer";
> $err[1]="and he had five sons";

Should be:

    my @err = ('gulle was a good farmer', 
               'and he had five sons');
    # or also
    my @err;
    $err[0] = 'gulle was a good farmer'; # @err is already declared,
    $err[1] = 'and he had five sons';    # therefore no my() here
    
> $olle = 1;

    my $olle = 1;
    
> if ($olle == "1") {

    if ($olle == 1) {

'==' and '!=' are used for numerical comparison. Even though "1" is
treated as a number by Perl (and thus your comparison works), the quotes
aren't necessary and shouldn't be there.

>          print "\n", @err, "\n"; }

If you don't want your array elements pasted behind one another, put
them into double quotes and the elements get implicitely joined with the
value of $":

    print "\n@err\n";

Now you have a whitespace between 'farmer' and 'and', given you haven
changed the value of $".

Tassilo
-- 
$_=q!",}])(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus;})(rekcah{lrePbus;})(lreP{rehtonabus;})(rehtona{tsuJbus!;
$_=reverse;s/sub/(reverse"bus").chr(32)/xge;tr~\n~~d;eval;


------------------------------

Date: 4 Nov 2002 16:25:12 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@post.rwth-aachen.de>
Subject: Re: don't understand use strict;
Message-Id: <aq6718$bud$1@nets3.rz.RWTH-Aachen.DE>

Also sprach Jürgen Exner:

> henrik nilsson wrote:
>> i'm having problems with the "use strict;" option; even trivial
>> scripts like the one below returns error messages like
>> Global symbol "@err" requires explicit package name at test.pl line 5.
>> Global symbol "$olle" requires explicit package name at test.pl line
>> 7.
>>
>> why? isn't "$olle=1;" a valid declaration?
> 
> Because it is an assignment.
> 
> To declare a variable use "my" (or "local" but you don't want to use that
> unless you know the differences to "my". There's an FAQ about it).

Oups, careful. local() can't be used to declare a variable. The code
would still give a fatal error at compile time. local() is used to give
a global variable temporarily a different value.

Tassilo
-- 
$_=q!",}])(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus;})(rekcah{lrePbus;})(lreP{rehtonabus;})(rehtona{tsuJbus!;
$_=reverse;s/sub/(reverse"bus").chr(32)/xge;tr~\n~~d;eval;


------------------------------

Date: Mon, 04 Nov 2002 17:16:35 +0100
From: henrik nilsson <md0nilhe@mdstud.DIESPAMchalmers.se>
Subject: Re: don't understand use strict;
Message-Id: <3DC69D63.50601@mdstud.DIESPAMchalmers.se>

Thanks a lot for your kindness - it really helped!

However, I was under the impression that you, if you my-declare @err in 
the main body of your program, would limit the scope of @err to the main 
body only, so that you wouldn't be able to read @err from inside a 
subroutine?

And that you, if my-declaring $value inside a subroutine, wouldn't be 
able to "return $value;" to the main body of the program?

But I must be incorrect, right?

Thanks again,

Henrik


> You didn't declare @err anywhere.
> Add
>     my @err;
> before your assignments. Of course you could declare the array and assign
> values to it in one step:
>     my @err = ("gulle was a good farmer", "and he had five sons");
> 
>>$olle = 1;
> 
> 
> Same stuff: you didn't declare $olle anywhere:
>     my $olle = 1;
> 
> jue
> 
> 




------------------------------

Date: Mon, 04 Nov 2002 18:16:54 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: don't understand use strict;
Message-Id: <qQyx9.12277$t1.11826@nwrddc02.gnilink.net>

[Please don't post jeopardy style; answers re-arranged into chronological
order]
henrik nilsson wrote:
>> You didn't declare @err anywhere.
>> Add
>>     my @err;
>> before your assignments. Of course you could declare the array and
>> assign values to it in one step:
>>     my @err = ("gulle was a good farmer", "and he had five sons");
>>
>>> $olle = 1;
>>
>>
>> Same stuff: you didn't declare $olle anywhere:
>>     my $olle = 1;

> However, I was under the impression that you, if you my-declare @err
> in the main body of your program, would limit the scope of @err to
> the main body only,

Right.

> so that you wouldn't be able to read @err from
> inside a subroutine?

But subroutines are part of the main body, aren't they?
BTW: those variable are commonly called global

> And that you, if my-declaring $value inside a subroutine, wouldn't be
> able to "return $value;" to the main body of the program?

Please distinguish between a variable and its value.
The variable $value is visible inside the sub only and in 99.9% of all cases
this is a good thing.
When you are using "return $value", then the sub returns the current
value(!) of the local variable $value (not the variable itself!) to the
calling routine.
Thus while the calling routine has no access to $variable it still recieves
the returned value. And that is all it cares about.

BTW: You may want to read a few books about software engineering or
programming language design. And if you really want to know the gory details
check out compiler construction.

jue




------------------------------

Date: Mon, 04 Nov 2002 19:32:53 +0100
From: Jon Rogers <jon@rogers.tv>
Subject: Erroneous pattern matching?
Message-Id: <3DC6BD4D.A43050F4@rogers.tv>


Dear all,

My script works fine, but it generates an error message in the logs:

Use of uninitialized value in pattern match (m//) at
/var/www/cgi-bin/script.cgi line 497, referer ...

the line itself looks like

if ($save[$i] =~ m/$match/) { # then act }

As far as I can tell, those variables have been declared? Is it still a
declaration problem?

/ Jon


------------------------------

Date: Mon, 4 Nov 2002 13:41:51 -0500
From: "Christian Caron" <nospam@nospam.org>
Subject: Re: Erroneous pattern matching?
Message-Id: <aq6f1f$r53@nrn2.NRCan.gc.ca>

"Jon Rogers" <jon@rogers.tv> wrote in message
news:3DC6BD4D.A43050F4@rogers.tv...
> Use of uninitialized value in pattern match (m//) at
> /var/www/cgi-bin/script.cgi line 497, referer ...
>
> the line itself looks like
>
> if ($save[$i] =~ m/$match/) { # then act }
>
> As far as I can tell, those variables have been declared? Is it still a
> declaration problem?
>
> / Jon

Is $match defined (and declared)? It tries to match the variable $match.
Maybe you loop $i one step too far ($save[$i] is undefined)?

By the way, you don't need the "m" when you use //. You would need the m in
this case: m#$match#.




------------------------------

Date: Mon, 4 Nov 2002 13:25:29 -0500
From: "Robert Robbins" <rrobbins@kolbnetworks.com>
Subject: Flash sendXML with CGI
Message-Id: <usdes5s88v0j55@corp.supernews.com>

Hello Perl Programmers,

I am trying to write a Perl script that reads the XML sent by
Flash using its XML.send method. The XML.send uses the
content type text/xml and sends the data using POST. I've
tried the CGI.pm and cgi-lib.pl. The cgi-lib.pl script won't
work with this content type and the CGI.pm does not provide
a method for getting the raw post data. I tried $q->param('raw')
but this did not work. An ASP script can successfully
get the XML using:

Response.BinaryWrite Request.BinaryRead(Request.TotalBytes)

And PHP has the $GLOBALS["HTTP_RAW_POST_DATA"]
global variable. I need to do this in Perl.

Robert Robbins




------------------------------

Date: Mon, 04 Nov 2002 17:11:51 GMT
From: peter@PSDT.com (Peter Scott)
Subject: Re: Limit output of examine (x) and return (r) in debugger.
Message-Id: <rTxx9.673866$Ag2.25810938@news2.calgary.shaw.ca>

In article <u1m9suk8qau2cvode003mcjphukscgv97e@4ax.com>,
 "Teh (tî'pô)" <teh@mindless.com> writes:
>I hope this isn't a FAQ, but I can't figure out how to download
>specific files from perl 5.8 without downloading the whole thing.

http://search.cpan.org/src/JHI/perl-5.8.0/lib/perl5db.pl
http://search.cpan.org/src/JHI/perl-5.8.0/lib/dumpvar.pl

-- 
Peter Scott
http://www.perldebugged.com


------------------------------

Date: Mon, 04 Nov 2002 17:56:52 +0000
From: zzapper <zzapper@ntlworld.com>
Subject: Re: Perl -e "print qq!    Tips and Tricks   !"
Message-Id: <tpcdsu0o4qvt5r3bp5m714qdn5jlb9gf73@4ax.com>

On Mon, 04 Nov 2002 10:23:01 +0000, zzapper <zzapper@ntlworld.com>
wrote:

>secondly although I've found loads of stuff on JAPH, I
>haven't really found a FAQ on why & how they work
>
I guess my question was actually, "Are there any different rules for
writing perl -e scripts rather than an ordinary script"? 

perl -e '$_="<sfldbijmsfQjsfiupobjutvK"; y/A-Za-ik-zj</ZA-Yza-ik-y ,/; $_=reverse $_ ;print '


------------------------------

Date: Mon, 04 Nov 2002 16:15:57 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Perl and large text files
Message-Id: <13xx9.11909$t1.11080@nwrddc02.gnilink.net>

JorkkiS wrote:
> I'm supposed to write a sript that searches through a text file for a
> given string. The script it self will be very simple, but I was
> wondering will I run into problems, because the size of the text file
> is around 5 megabytes.

5 MB is really not that much (unless you are still running on a 486 with 8MB
of RAM, of course).

> I was thinking of reading it into an array and
> then greping throug it... will there be problems, other than it might
> take a while.

On a non-antic computer no problem, but see below

> Is there a better way to approach this?

Sure. Read the file line by line.
    while (<>) {
        # do whatever you need to with the current line
    }

jue




------------------------------

Date: Mon, 4 Nov 2002 20:46:58 +0200
From: "JorkkiS" <jarkko.rantamaki@edu.stadia.no.spam.fi>
Subject: Re: Perl and large text files
Message-Id: <aq6f0s$hc3$1@nyytiset.pp.htv.fi>

Thanks for ideas and suggestions.
Maybe I will do two versions of this script. One with the grep and array...
and other with line by line approach.
Then I can compare which is faster.

BR
Jarkko




------------------------------

Date: Mon, 04 Nov 2002 16:17:39 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Perl question....
Message-Id: <D4xx9.11914$t1.1823@nwrddc02.gnilink.net>

Andras Malatinszky wrote:
> I often find that people use tr when my first thought would be to
> reach for  =~s/.../.../. Is there some advantage to using tr instead
> of regex substitution or is it just personal preference?

For the limited tasks it can do tr will be much faster than s.

jue




------------------------------

Date: 4 Nov 2002 08:43:47 -0800
From: jagman98@attbi.com (J M)
Subject: supplying input to external command
Message-Id: <4a8adfa4.0211040843.11113959@posting.google.com>

Gurus,

I perl script needs to do following:

### cd to data directory
(/) # cd /tmp/xx/data

### run update binary
(/tmp/xx/data) # /usr/local/bin/update

Welcome to update....
Input Value1: <enter value1>
Input ValueN: <enter ValueN>

Done! Update completed successfully!

Input 2 to exit: 2

(/tmp/xx/data) # 

How can I cd to data directory and run external command and supply
values to external command at the same time!  TIA!


------------------------------

Date: 4 Nov 2002 17:13:14 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@post.rwth-aachen.de>
Subject: Re: supplying input to external command
Message-Id: <aq69ra$fh4$1@nets3.rz.RWTH-Aachen.DE>

Also sprach J M:

> Gurus,
> 
> I perl script needs to do following:
> 
> ### cd to data directory
> (/) # cd /tmp/xx/data

    chdir "/tmp/xx/data";

> ### run update binary
> (/tmp/xx/data) # /usr/local/bin/update
> 
> Welcome to update....
> Input Value1: <enter value1>
> Input ValueN: <enter ValueN>
> 
> Done! Update completed successfully!
> 
> Input 2 to exit: 2
> 
> (/tmp/xx/data) # 

Try a pipe-open:

    open UPDATE, "| /usr/local/bin/update" or die $!;
    print UPDATE "value1\n";
    ...
    print UPDATE "valueN\n";
    close UPDATE or die $!;

> How can I cd to data directory and run external command and supply
> values to external command at the same time!  TIA!

If you need a pipe to and from the program, an ordinary pipe-open can't
be used. In such a case, try IPC::Open2 which gives you a read and write
handle for your program.

Tassilo
-- 
$_=q!",}])(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus;})(rekcah{lrePbus;})(lreP{rehtonabus;})(rehtona{tsuJbus!;
$_=reverse;s/sub/(reverse"bus").chr(32)/xge;tr~\n~~d;eval;


------------------------------

Date: Mon, 04 Nov 2002 17:45:54 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: supplying input to external command
Message-Id: <tacdsuo3alqkehmvobsdl3veqs3okul7qf@4ax.com>

J M wrote:

>Welcome to update....
>Input Value1: <enter value1>
>Input ValueN: <enter ValueN>

I *think* this is one of the things the module Expect is designed for.
Well worth a look.

	<http://search.cpan.org/author/RGIERSIG/Expect-1.15/>

"Expect.pm is built to either spawn a process or take an existing
filehandle and interact with it such that normally interactive tasks can
be done without operator assistance."

-- 
	Bart.


------------------------------

Date: Mon, 4 Nov 2002 17:33:04 +0100
From: "Olive" <ochampag@nortelnetworks.com>
Subject: Written under a socket descriptor problem ....
Message-Id: <aq67ls$pcg$1@bcarh8ab.ca.nortel.com>

Hi ,

i would like to write a perl server that execute a perl command under sh and
write the result on the opened socket descriptor ...

Actually, i arrive to launch the command under my server but the result is
not written under the Socket descriptor and so the client can not retrieve
the result of his command .....

Tags #EXEC CMD identify the part of code where i launch a perl programm
under sh and try to write result under the socket descriptor .... Result is
not written whereas i see the execution and the result under standard output
 ....

Could someone tell me what happen ??

Thanks;;

Olivier

Incrimined part of code :
-------------------------

scrsomething under sh and
    $con++;
    if (($child[$con] = fork()) == 0) {
        print "accept ok\n";

        ($af,$port,$inetaddr) = unpack($sockaddr,$addr);
        @inetaddr = unpack('C4',$inetaddr);
        print "$con: $af $port @inetaddr\n";

        while (<NS>) {
                print NS "SERVER --> $con: $_";  # Talk back to client #
===>>>> That is read by the client
                # -------------------------
                # If run command is wanted
                # -------------------------
                if ($_ =~ /run/) {
                        @list = split(/ /,$_);
                        $exec="";
                        $cmd="";
                        for($i=1;$i <= $#list;$i++) {
                                $cmd=$cmd.$list[$i]." ";
                        }
                        $list[2] =~ s/ //g;

$exec="/swbts/umts/iss/tests/oam/".$list[2]."/$cmd\n";
#EXEC CMD                        open TMP,"$exec|";
#EXEC CMD                        while($WR = <TMP>) {
#EXEC CMD                               print NS "$con : $WR";    ===>>>>
That is not read by the client
#EXEC CMD                       }
#EXEC CMD                        close(TMP);
                }
                # ----------------------------
                # If result command is wanted
                # ----------------------------
                if ($_ =~ /result/) {
                        print NS "1";
                }
                print "$con: $_\n";
                print NS "WafitServer>";
===>>>> That is read by the client

        }
        close(NS);
        exit;
    }




------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 4064
***************************************


home help back first fref pref prev next nref lref last post