[13794] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1204 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Oct 27 23:47:52 1999

Date: Wed, 27 Oct 1999 20:47:41 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <941082461-v9-i1204@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 27 Oct 1999     Volume: 9 Number: 1204

Today's topics:
        waking from sleep() (Eric Smith)
    Re: waking from sleep() (Charles DeRykus)
    Re: waking from sleep() (Eric Smith)
    Re: waking from sleep() (M.J.T. Guy)
    Re: waking from sleep() (Clinton Pierce)
    Re: what is SHTML ? (Mark W. Schumann)
        What makes the web go? <jjklimeck@home.com.com>
    Re: What makes the web go? <kperrier@blkbox.com>
    Re: What makes the web go? (Craig Berry)
    Re: What makes the web go? (Randal L. Schwartz)
    Re: What makes the web go? (brian d foy)
    Re: What makes the web go? (Martien Verbruggen)
        What PERL routine will fetch a file attribute like when wharmon@prodigy.net
    Re: What PERL routine will fetch a file attribute like  <eyounes@aol.com>
    Re: What PERL routine will fetch a file attribute like  <c4jgurney@my-deja.com>
        what's typeless? <down@ms2.url.com.tw>
    Re: what's typeless? (Scott McMahan)
    Re: what's typeless? (John McKown)
        Where to get LWP modules? <310064202272#0001@online.de>
    Re: Where to get LWP modules? (Michael Budash)
        Why can't I exec another script holywater@chat.ru
    Re: Why can't I exec another script (Clinton Pierce)
    Re: Why does this code give a broken pipe? <rootbeer@redcat.com>
    Re: Why does this compile? (Clinton Pierce)
        Why does this print 'bar'? <vlad@doom.net>
    Re: Why does this print 'bar'? <newsposter@cthulhu.demon.nl>
    Re: Why does this print 'bar'? <matthias.schwarze@wiesbaden.netsurf.de>
    Re: Why does this print 'bar'? <vlad@doom.net>
    Re: Why does this print 'bar'? (Martien Verbruggen)
    Re: Why does this print 'bar'? <jeffp@crusoe.net>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 26 Oct 1999 12:34:37 GMT
From: eric@fruitcom.com (Eric Smith)
Subject: waking from sleep()
Message-Id: <slrn81b7ur.lae.eric@plum.fruitcom.com>

Is there a signal that one may send to a sleeping process to abort the
sleep and continue the loop iteration in:

while (){
    sleep 200;
    print "Hey, why are you disturbing my sleep";
}


-- 
Eric Smith
eric@fruitcom.com
www.fruitcom.com

gensig: Cowardly refusing to create an empty signature


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

Date: Wed, 27 Oct 1999 19:57:03 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: waking from sleep()
Message-Id: <FKA233.2oG@news.boeing.com>

In article <slrn81ek9n.2b5.eric@plum.fruitcom.com>,
Eric Smith <eric@fruitcom.com> wrote:
>Thank you
>
>What I am trying to do is have an external process which is set off by soem
>event send a signal to the sleeping perl script.  So there is no user
>invoked ^C on a keyboard.
>
>I can undestand how to give an alarm() to program from within that program
>but not sure how to do so for an external process.
>

kill -ALRM  "sleeping pid"


--
Charles DeRykus


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

Date: 27 Oct 1999 19:23:36 GMT
From: eric@fruitcom.com (Eric Smith)
Subject: Re: waking from sleep()
Message-Id: <slrn81ek9n.2b5.eric@plum.fruitcom.com>

Thank you

What I am trying to do is have an external process which is set off by soem
event send a signal to the sleeping perl script.  So there is no user
invoked ^C on a keyboard.

I can undestand how to give an alarm() to program from within that program
but not sure how to do so for an external process.

ciao


mjtg@cus.cam.ac.uk (M.J.T. Guy) posted in comp.lang.perl.misc 
on 27 Oct 1999 17:20:58 GMT:
 > In article <slrn81b7ur.lae.eric@plum.fruitcom.com>,
 > Eric Smith <eric@fruitcom.com> wrote:
 > >Is there a signal that one may send to a sleeping process to abort the
 > >sleep and continue the loop iteration in:
 > >
 > >while (){
 > >    sleep 200;
 > >    print "Hey, why are you disturbing my sleep";
 > >}
 > 
 > Any signal will interrupt the sleep, if you die() in the signal handler:
 > 
 > % perl -we '$SIG{INT} = sub { die "Got INT\n" }; sleep 1000'
 > ^CGot INT
 > 
 > But of course, you'll have to wrap your code in an eval{} if you want
 > to do anything afterwards.
 > 
 > 
 > Mike Guy


-- 
Eric Smith
eric@fruitcom.com
www.fruitcom.com

True wealth is measured not by what you accumulate, but by what you pass on
 to others
- Larry Wall.


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

Date: 27 Oct 1999 17:20:58 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: waking from sleep()
Message-Id: <7v7c9q$hia$1@pegasus.csx.cam.ac.uk>

In article <slrn81b7ur.lae.eric@plum.fruitcom.com>,
Eric Smith <eric@fruitcom.com> wrote:
>Is there a signal that one may send to a sleeping process to abort the
>sleep and continue the loop iteration in:
>
>while (){
>    sleep 200;
>    print "Hey, why are you disturbing my sleep";
>}

Any signal will interrupt the sleep, if you die() in the signal handler:

% perl -we '$SIG{INT} = sub { die "Got INT\n" }; sleep 1000'
^CGot INT

But of course, you'll have to wrap your code in an eval{} if you want
to do anything afterwards.


Mike Guy


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

Date: Tue, 26 Oct 1999 13:24:27 GMT
From: cpierce1@ford.com (Clinton Pierce)
Subject: Re: waking from sleep()
Message-Id: <3816ab0f.1802693476@news.ford.com>

[poster cc'd in e-mail]

On 26 Oct 1999 12:34:37 GMT, eric@fruitcom.com (Eric Smith) wrote:
>Is there a signal that one may send to a sleeping process to abort the
>sleep and continue the loop iteration in:
>
>while (){
>    sleep 200;
>    print "Hey, why are you disturbing my sleep";
>}

Use the same one that sleep(2) uses: SIGALRM



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

Date: 26 Oct 1999 19:04:53 -0400
From: catfood@apk.net (Mark W. Schumann)
Subject: Re: what is SHTML ?
Message-Id: <7v5c2l$eu9@junior.apk.net>

In article <slrn813ncf.sf2.bmccoy@moebius.foiservices.com>,
Brett W. McCoy <bmccoy@foiservices.com> wrote:
>Also Sprach Mark W. Schumann <catfood@apk.net>:
>>Also think self-interest.
>>
>>The FAQs and PODs have been in refinement for years.  Their answers
>>are virtually always the "best thinking" on a topic.
>>
>>The one-time responses you get to a post are going to vary widely in
>>quality.
>>
>>If an answer is in the FAQ, it's likely to be the _best_ answer.
>
>Right... the FAQs and PODs are developed, essentially, under the same
>spirit as open source software, are they not?  

Broadly, yes.



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

Date: Wed, 27 Oct 1999 07:24:13 GMT
From: Master The Web <jjklimeck@home.com.com>
Subject: What makes the web go?
Message-Id: <S6YWOKQ6jKdBbwXIKAi81+lSdtp=@4ax.com>

What programming language powers sites like amazon, or
yahoo?

Is it all perl/cgi? with some database stuff?
If so, what is that database stuff...sql server?

I've been looking for information on database-driven
websites and how to implement them but so
far I'm coming up with nothing.

I want to learn how to do this. So far the best solution
is to learn perl/cgi and then just go from there.

Sound like a good  idea?


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

Date: 27 Oct 1999 16:23:56 -0500
From: Kent Perrier <kperrier@blkbox.com>
Subject: Re: What makes the web go?
Message-Id: <040E989A90E89B1E.088AC376A07B9A08.2ED0114BCD784F27@lp.airnews.net>

Blue goo.
-- 
We are in fact well and truly doomed.
				-- Jamie Zawinski
				   http://www.jwz.org/gruntle/nscpdorm.html



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

Date: Wed, 27 Oct 1999 16:50:25 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: What makes the web go?
Message-Id: <s1ebahf4r0894@corp.supernews.com>

Master The Web (jjklimeck@home.com.com) wrote:
: What programming language powers sites like amazon, or
: yahoo?
: 
: Is it all perl/cgi? with some database stuff?
: If so, what is that database stuff...sql server?

Most complex sites are built as numerous subsystems, programmed in a
variety of languages and running on various physical pieces of hardware
and often several operating systems as well.

: I've been looking for information on database-driven : websites and how
to implement them but so : far I'm coming up with nothing. 

Philip Greenspun's _Database Backed Web Sites_ is quite good as an
overview.

: I want to learn how to do this. So far the best solution
: is to learn perl/cgi and then just go from there.
: 
: Sound like a good  idea?

Experimenting with Perl CGI apps would certainly be a wise course.
Whether or not you end up using these technologies, you'll learn a lot
about the underlying mechanisms of the web which will serve you well with
any technology you choose.

-- 
   |   Craig Berry - cberry@cinenet.net
 --*--  http://www.cinenet.net/users/cberry/home.html
   |   "They do not preach that their God will rouse them
      a little before the nuts work loose." - Kipling


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

Date: 27 Oct 1999 07:34:48 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: What makes the web go?
Message-Id: <m1k8o8ub1z.fsf@halfdome.holdit.com>

>>>>> "Master" == Master The Web <jjklimeck@home.com.com> writes:

Master> What programming language powers sites like amazon, or
Master> yahoo?

Master> Is it all perl/cgi? with some database stuff?

Mostly, yes.  Amazon.com uses Perl extensively in the back end,
although I think some of their front-end stuff is C++ for speed.

Yahoo was originally all prototyped in Perl/CGI, but now uses custom
servers (no CGI needed if the server does the serving :).  They still
use Perl quite extensively for backend stuff.  I see a few ".py" URLs
though, so perhaps they're also using some of that other-P-stuff.

Master> If so, what is that database stuff...sql server?

No, nobody doing the kind of volume that Yahoo or Amazon.com gets
could *ever* use M$ products.  Most likely Oracle or Sybase instead.
(Seriously.)

Master> Sound like a good  idea?

Yes.

print "Just another Perl hacker,"

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: Wed, 27 Oct 1999 11:08:41 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: What makes the web go?
Message-Id: <brian-ya02408000R2710991108410001@news.panix.com>

In article <m1k8o8ub1z.fsf@halfdome.holdit.com>, merlyn@stonehenge.com (Randal L. Schwartz) posted:

> >>>>> "Master" == Master The Web <jjklimeck@home.com.com> writes:
> 
> Master> What programming language powers sites like amazon, or
> Master> yahoo?

> Mostly, yes.  Amazon.com uses Perl extensively in the back end,
> although I think some of their front-end stuff is C++ for speed.

Amazon told me that none of their web stuff is in Perl, although
a lot of their backup stuff is.  there will be details about this
on www.perl.org next month ;)

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>


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

Date: Wed, 27 Oct 1999 22:52:05 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: What makes the web go?
Message-Id: <pmLR3.68$z73.2028@nsw.nnrp.telstra.net>

On 27 Oct 1999 07:34:48 -0700,
	Randal L. Schwartz <merlyn@stonehenge.com> wrote:
> >>>>> "Master" == Master The Web <jjklimeck@home.com.com> writes:
> 
> Master> What programming language powers sites like amazon, or
> Master> yahoo?
> 
> Master> Is it all perl/cgi? with some database stuff?
> 
> Mostly, yes.  Amazon.com uses Perl extensively in the back end,
> although I think some of their front-end stuff is C++ for speed.

C++ for speed? hmmmm... 

:)

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | In the fight between you and the
Commercial Dynamics Pty. Ltd.   | world, back the world - Franz Kafka
NSW, Australia                  | 


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

Date: Wed, 27 Oct 1999 04:44:56 GMT
From: wharmon@prodigy.net
Subject: What PERL routine will fetch a file attribute like when the file was created?
Message-Id: <3816830e.913876695@news.rio.com>

Thanks,

Will


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

Date: Wed, 27 Oct 1999 16:36:41 +0200
From: "Ysteric's" <eyounes@aol.com>
Subject: Re: What PERL routine will fetch a file attribute like when the file was created?
Message-Id: <7v72cj$a8a@news.vtcom.fr>

$MyFile = "pudu.cul";

if( -e $MyFile) {
    print "WWWAAAAAAaaaaaaaaaaaooooooooooooooooooooo, my file exists\n";
}

Eric

wharmon@prodigy.net a écrit dans le message
<3816830e.913876695@news.rio.com>...
>Thanks,
>
>Will




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

Date: Wed, 27 Oct 1999 08:05:03 GMT
From: Jeremy Gurney <c4jgurney@my-deja.com>
Subject: Re: What PERL routine will fetch a file attribute like when the file was created?
Message-Id: <7v6bne$g8u$1@nnrp1.deja.com>

In article <3816830e.913876695@news.rio.com>,
  wharmon@prodigy.net wrote:
> Thanks,
>
> Will

Will,

It's all in the faq.

perlfaq5 - Files and Formats
How do I get a file's timestamp in perl?

Jeremy Gurney
SAS Programmer  |  Proteus Molecular Design Ltd.
"What if there were no hypothetical situations?"


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 26 Oct 1999 19:46:43 +0800
From: Ken <down@ms2.url.com.tw>
Subject: what's typeless?
Message-Id: <381594A3.354EDCA8@ms2.url.com.tw>

what's typeless?I know storng-type language(c/c++.....)
but I do't understand what the obvious advantanges and disadvantages of
having on 
types in a language are..........
I read the article from in IEEE Computer magazine.There are something
about
typeless,but i still do not know it...:(
somebody can tell me?
please cc to my e-mail........thankx


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

Date: Tue, 26 Oct 1999 18:47:52 GMT
From: scott@aravis.softbase.com (Scott McMahan)
Subject: Re: what's typeless?
Message-Id: <sHmR3.4275$hK6.249297@monger.newsread.com>

Ken (down@ms2.url.com.tw) wrote:
> what's typeless?

Depends.

(That's the answer to every vague computer question!)

A typeless language does not require the explicit typing of a
variable. 

Perl is like this, except it distinguishes scalars and aggregates.
You still don't declare whether a variable is one or the other,
it's implicit in the use.

Visual Basic is too, sort of, in its VARIANT. The two are different:
Perl uses context to guess the type of a string, while VB actually can
store all types in a variant. (VB has had explicit typing grafted onto
it. Change of this sort is typical.)

There is also implict typing like Fortran where type is not declared
but implicit in the variable name somehow.

There is no such thing as a true typeless language unless you get into
something like B where the only data type was the machine word.
In this low-level world, a string, for example, is a series of
consecutive words in memory. You get no help in using them.

> ... but I do't understand what the obvious advantanges and disadvantages of
> having on types in a language are..........

Advantage: Makes OO programming more fun and easy. Perl kinda sorta
supports OO, but in a non-OO way. A language like Java, which is
fully typed, makes pure OO easier.

Disadvantage: People don't think in types, and it's an extra layer
of cognitive dissonance for problem solving. You have to wrestle
with the machine representation rather than the problem.

Scott




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

Date: Tue, 26 Oct 1999 10:18:56 +0000
From: joarmc@linux2.johnmckown.net (John McKown)
Subject: Re: what's typeless?
Message-Id: <slrn81b00g.ugh.joarmc@linux2.johnmckown.net>

On Tue, 26 Oct 1999 19:46:43 +0800, Ken <down@ms2.url.com.tw> wrote:
>what's typeless?I know storng-type language(c/c++.....)
>but I do't understand what the obvious advantanges and disadvantages of
>having on 
>types in a language are..........
>I read the article from in IEEE Computer magazine.There are something
>about
>typeless,but i still do not know it...:(
>somebody can tell me?
>please cc to my e-mail........thankx

I'm not an expert by any means. But what I've always thought typeless meant
is that a variable name can contain different types of data at different
times during execution. What a typed language, such as C, you tell the
compiler what type of data is contained in the variable. Such as "int",
or "float" or "double", and so on. With a typeless language, a variable
can contain an int at some time during execution, then later contain
a string value. I use a language at work that does this. I can write
code such as:

Var=1 /* Var contains the integer 1 */
 ... other code
Var=10.5 /* Var now contains the floating point number 10.5 */
 ... even more code
Var="This is a test" /* Var now contains a string */

I don't know how other languages do this, but the ones that I'm familiar
with generally do this by making "Var" a pointer! This pointer points
to a self-describing structure which contains the value. For example,
Var points to a piece of member. The first word contains a binary 1. This
indicates that the next word contains an integer. If the first word had
contained a 2, then the run-time would have known that the next 4 bytes
contained a float. If the first word had contained a 3, then the next 
two bytes are a length code in binary, followed by a character string,
and so forth. Generally, typeless languages are interpreted, not compiled.
That's due to the fact that being typeless causes overhead and the calling
of different subroutines or conversion routines at run time. 

Hope this was of some help to you,
John


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

Date: Wed, 27 Oct 1999 22:57:57 +0200
From: bmlam <310064202272#0001@online.de>
Subject: Where to get LWP modules?
Message-Id: <38176755.21291FE9@online.de>


--------------E6E48E8908C91834CB715248
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

I know this is a dumb question. While trying to run the following code
snippet from perldoc,

        # or print ASCII from HTML from a URL
        # also need HTML-Tree package from CPAN
        use LWP::Simple;
        use HTML::Parse;
        use HTML::FormatText;
        my ($html, $ascii);
        $html = get("http://www.perl.com/");
        defined $html
            or die "Can't fetch HTML from http://www.perl.com/";
        $ascii = HTML::FormatText->new->format(parse_html($html));
        print $ascii;


I got following errors:

Can't locate LWP/Simple.pm in @INC (@INC contains:
/usr/lib/perl5/i386-linux/5.0
0404 /usr/lib/perl5 /usr/lib/perl5/site_perl/i386-linux
/usr/lib/perl5/site_perl
 .) at test1 line 3.
BEGIN failed--compilation aborted at test1 line 3.

I ran find on /usr and /lib looking for "*.pm" files and could be
positive that the required modules are not included in my perl
distribuation. Can some one please point me to the location where I can
download the stuff for Linux?

Thanks.

--------------E6E48E8908C91834CB715248
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
I know this is a dumb question. While trying to run the following code
snippet from perldoc,
<p><font face="Courier New,Courier"><font size=-2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
# or print ASCII from HTML from a URL</font></font>
<br><font face="Courier New,Courier"><font size=-2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
# also need HTML-Tree package from CPAN</font></font>
<br><font face="Courier New,Courier"><font size=-2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
use LWP::Simple;</font></font>
<br><font face="Courier New,Courier"><font size=-2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
use HTML::Parse;</font></font>
<br><font face="Courier New,Courier"><font size=-2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
use HTML::FormatText;</font></font>
<br><font face="Courier New,Courier"><font size=-2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
my ($html, $ascii);</font></font>
<br><font face="Courier New,Courier"><font size=-2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
$html = get("<A HREF="http://www.perl.com/">http://www.perl.com/</A>");</font></font>
<br><font face="Courier New,Courier"><font size=-2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
defined $html</font></font>
<br><font face="Courier New,Courier"><font size=-2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
or die "Can't fetch HTML from <A HREF="http://www.perl.com/">http://www.perl.com/</A>";</font></font>
<br><font face="Courier New,Courier"><font size=-2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
$ascii = HTML::FormatText->new->format(parse_html($html));</font></font>
<br><font face="Courier New,Courier"><font size=-2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
print $ascii;</font></font>
<br>&nbsp;
<p>I got following errors:
<p><tt>Can't locate LWP/Simple.pm in @INC (@INC contains: /usr/lib/perl5/i386-linux/5.0</tt>
<br><tt>0404 /usr/lib/perl5 /usr/lib/perl5/site_perl/i386-linux /usr/lib/perl5/site_perl</tt>
<br><tt>&nbsp;.) at test1 line 3.</tt>
<br><tt>BEGIN failed--compilation aborted at test1 line 3.</tt><tt></tt>
<p>I ran find on /usr and /lib looking for "*.pm" files and could be positive
that the required modules are not included in my perl distribuation. Can
some one please point me to the location where I can download the stuff
for Linux?
<p>Thanks.</html>

--------------E6E48E8908C91834CB715248--



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

Date: Wed, 27 Oct 1999 15:14:28 -0700
From: mbudash@wcws.com (Michael Budash)
Subject: Re: Where to get LWP modules?
Message-Id: <mbudash-2710991514280001@adsl-216-103-91-123.dsl.snfc21.pacbell.net>

In article <38176755.21291FE9@online.de>, bmlam
<310064202272#0001@online.de> wrote:

[snip]

> Can't locate LWP/Simple.pm in @INC (@INC contains:
> /usr/lib/perl5/i386-linux/5.0
> 0404 /usr/lib/perl5 /usr/lib/perl5/site_perl/i386-linux
> /usr/lib/perl5/site_perl
>  .) at test1 line 3.
> BEGIN failed--compilation aborted at test1 line 3.
> 
> I ran find on /usr and /lib looking for "*.pm" files and could be
> positive that the required modules are not included in my perl
> distribuation. Can some one please point me to the location where I can
> download the stuff for Linux?

cpan.org

[snip html garbage]
-- 
Michael Budash ~~~~~~~~~~ mbudash@wcws.com


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

Date: Tue, 26 Oct 1999 16:06:13 GMT
From: holywater@chat.ru
Subject: Why can't I exec another script
Message-Id: <7v4jhi$7bc$1@nnrp1.deja.com>

Please help me

I need to run another Perl CGI script from current. The other script
should return some HTML text,which ought to be displayed by browser. I
don't need to return to the first script. First I tried to do like this:
exec "$fullpathtoscript/$script";
But it didn't work - I get just 500.
When I changed it to exec "$script" - it did nothing at all.
Please tell me what did I do wrong and what should I do in future.

Yura.
holywater@chat.ru


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 26 Oct 1999 16:35:41 GMT
From: cpierce1@ford.com (Clinton Pierce)
Subject: Re: Why can't I exec another script
Message-Id: <3818d7b5.1814123862@news.ford.com>

On Tue, 26 Oct 1999 16:06:13 GMT, holywater@chat.ru wrote:

>Please help me
>
>I need to run another Perl CGI script from current. The other script
>should return some HTML text,which ought to be displayed by browser. I
>don't need to return to the first script. First I tried to do like this:
>exec "$fullpathtoscript/$script";
>But it didn't work - I get just 500.
>When I changed it to exec "$script" - it did nothing at all.
>Please tell me what did I do wrong and what should I do in future.

Have you tried running this interactively to make sure it works at all?

Have you tried making sure the exec() actually worked by putting some
stuff after it?  (exec *can* fail you know)

Does your second script work?  Can you run it directly?  Can you run it
from the command line?




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

Date: Mon, 25 Oct 1999 13:42:35 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Why does this code give a broken pipe?
Message-Id: <Pine.GSO.4.10.9910251340190.29843-100000@user2.teleport.com>

On Sun, 24 Oct 1999, Gavin Cato wrote:

> However after every 10-20 requests it aborts with "broken pipe". 

That sounds as if you're printing to a closed pipe and getting a SIGPIPE.
Maybe you want this?

    $SIG{PIPE} = 'IGNORE';

> chomp ($date = `date`);

Why not this?

    my $date = localtime;

Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Mon, 25 Oct 1999 13:21:07 GMT
From: cpierce1@ford.com (Clinton Pierce)
Subject: Re: Why does this compile?
Message-Id: <380ca209.1210559152@news.ford.com>

[poster cc'd in e-mail]

On 19 Oct 1999 16:08:21 GMT, moody+@pie.ius.cs.cmu.edu (James Moody)
wrote:
>    $foo = "Hello!" &jumbo;

>Just curious.

Remember, in Perl 5 subroutine calls don't need to have the ampersand.
Also, you're not using "strict" or warnings so the Perl interpreter isn't
going to be able to help you much.

Read that as:

dollar-foo equals "Hello!" bitwise-anded with the results from jumbo.

Consider that for a bit, and you've got your answer.



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

Date: 27 Oct 1999 17:42:58 GMT
From: <vlad@doom.net>
Subject: Why does this print 'bar'?
Message-Id: <7v7dj2$6c4$1@news.servint.com>

#!/usr/bin/perl -w
use strict;

my $n = 1;
my $s;

($n == 1) ? $s = 'foo' : $s = 'bar';
print "$s\n";


I thought that the above was the same as:

#!/usr/bin/perl -w
use strict;

my $n = 1;
my $s;

if ($n == 1) {
	$s = 'foo';
} else {
	$s = 'bar';
}
print "$s\n";

-v


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

Date: 27 Oct 1999 21:56:50 GMT
From: Erik van Roode <newsposter@cthulhu.demon.nl>
Subject: Re: Why does this print 'bar'?
Message-Id: <7v7sf2$gi1$1@internal-news.uu.net>

vlad@doom.net wrote:

> ($n == 1) ? $s = 'foo' : $s = 'bar';

  I can't remember what the exact reasoning was, but it had something to
do with priorities of the ?: and = operators. Add some parentheses.

Try
  ($n == 1) ? ($s = 'foo') : ($s = 'bar');

But you probably could use:
  $s = ($n == 1) ? 'foo' : 'bar';

Erik



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

Date: Thu, 28 Oct 1999 00:08:53 +0200
From: Matthias Schwarze <matthias.schwarze@wiesbaden.netsurf.de>
Subject: Re: Why does this print 'bar'?
Message-Id: <381777F5.99B4CCB5@wiesbaden.netsurf.de>

> ($n == 1) ? $s = 'foo' : $s = 'bar';
> print "$s\n";

The correct syntax would be
$s = ($n == 1) ? 'foo' : 'bar';

Now print "$s\n" says 'foo'.


Matthias


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

Date: 27 Oct 1999 18:22:44 GMT
From: <vlad@doom.net>
Subject: Re: Why does this print 'bar'?
Message-Id: <7v7ftk$6f8$1@news.servint.com>

>> ($n == 1) ? $s = 'foo' : $s = 'bar';

> I can't remember what the exact reasoning was, but it had something to
> do with priorities of the ?: and = operators. Add some parentheses.

That would be it. Thanks.

-v


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

Date: Wed, 27 Oct 1999 22:58:17 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Why does this print 'bar'?
Message-Id: <dsLR3.71$z73.2028@nsw.nnrp.telstra.net>

On 27 Oct 1999 17:42:58 GMT,
	vlad@doom.net <vlad@doom.net> wrote:
> #!/usr/bin/perl -w
> use strict;
> 
> my $n = 1;
> my $s;
> 
> ($n == 1) ? $s = 'foo' : $s = 'bar';

You have a precedence problem.

# perldoc perlop
[snip]
         right       ?:
         right       = += -= *= etc.
[snip]

That order means that ?: has a higher precednece than =, which is
good, because it makes the more common way to write what you are
trying to do possible :)

$s = ($n == 1) ? 'foo' : 'bar';

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | Freudian slip: when you say one thing
Commercial Dynamics Pty. Ltd.   | but mean your mother.
NSW, Australia                  | 


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

Date: Wed, 27 Oct 1999 20:27:27 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: Why does this print 'bar'?
Message-Id: <Pine.GSO.4.10.9910272025580.2694-100000@crusoe.crusoe.net>

[posted & mailed]

On Oct 27, vlad@doom.net blah blah blah:

> ($n == 1) ? $s = 'foo' : $s = 'bar';

Due to precedence disruptions, this is actually:

  ( ($n == 1) ? ($s = 'foo') : $s ) = 'bar';

That sets $s to 'bar' no matter what.

You might want

  ($n == 1) ? ($s = 'foo') : ($s = 'bar');

or

  $s = ($n == 1) ? 'foo' : 'bar';

-- 

  MIDN 4/C PINYAN, USNR, NROTCURPI
  jeff pinyan      japhy@pobox.com
  perl stuff       japhy+perl@pobox.com
  CPAN ID: PINYAN  http://www.perl.com/CPAN/authors/id/P/PI/PINYAN/



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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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 V9 Issue 1204
**************************************


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