[13580] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 990 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Oct 5 11:10:34 1999

Date: Tue, 5 Oct 1999 08:10:24 -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: <939136224-v9-i990@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 5 Oct 1999     Volume: 9 Number: 990

Today's topics:
    Re: PERL CGI script works in concole but not with IIS o <tbornhol@prioritytech.com>
    Re: PERL CGI script works in concole but not with IIS o (Bill Moseley)
    Re: PERL CGI script works in concole but not with IIS o (Clinton Pierce)
    Re: Perl Debugger (M.J.T. Guy)
    Re: Perl macros for vi <sr@pc-plus.de>
    Re: sort routine - can it ignore numeric values? (Greg Bacon)
    Re: sort routine - can it ignore numeric values? (Larry Rosler)
    Re: sort routine - can it ignore numeric values? (M.J.T. Guy)
    Re: sort routine - can it ignore numeric values? (M.J.T. Guy)
        test please ignore <xliu@cs.sunysb.edu>
    Re: UNIX (Solaris 2.6) to NT ACCESS DB? (Scott McMahan)
    Re: What's the quickest way to read a file (M.J.T. Guy)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Tue, 5 Oct 1999 09:20:18 -0500
From: "Tim Bornholtz" <tbornhol@prioritytech.com>
Subject: Re: PERL CGI script works in concole but not with IIS or Apache
Message-Id: <A97BC85C126F0747.773F7DF2747F2104.7A6C39CDADA277B7@lp.airnews.net>


Gregor Bruhin <gregor.bruhin@bluewin.ch> wrote in message
news:37F9F6F8.E5B588C8@bluewin.ch...
> Hi,
>
> I have some problems with this simple perl script...
>
> Please, pelase, please help me !
>
> When I run it from a console, it works fine, I get the mail, the std.
> output is ok, all is ok, BUT :-)
>
> when I try to run it through a web server (IIS or apache), I get a error
> code 500 Internal Server Error, and in the log file:
> [Tue Oct 05 10:20:06 1999] [error] [client 10.253.1.135] Premature end
> of script headers: c:/program files/apache group/apache/cgi-bin/mail.pl,
> this means my script died why ???

Look at perlfaq9.  The first question is ... are you ready ...
"My CGI script runs from the command line but not the browser. (500 Server
Error)"

BTW, since you are running windows, the documentation can be found by going
to Start -> Programs -> ActivePerl -> Online Documentation

hth,
Tim Bornholtz
tbornhol@prioritytech.com





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

Date: Tue, 5 Oct 1999 07:24:21 -0700
From: moseley@best.com (Bill Moseley)
Subject: Re: PERL CGI script works in concole but not with IIS or Apache
Message-Id: <MPG.1263a9ecb0e7c5c29897cf@206.184.139.132>

Gregor Bruhin (gregor.bruhin@bluewin.ch) seems to say...
> Hi,
> 
> I have some problems with this simple perl script...
> 
> Please, pelase, please help me !
> 
> When I run it from a console, it works fine, I get the mail, the std.
> output is ok, all is ok, BUT :-)

This was also posted in comp.infosystems.www.authoring.cgi

Please use your newsreaders cross-posting feature.



-- 
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.


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

Date: Tue, 05 Oct 1999 14:13:55 GMT
From: cpierce1@ford.com (Clinton Pierce)
Subject: Re: PERL CGI script works in concole but not with IIS or Apache
Message-Id: <3801fe43.260399885@news.ford.com>

[poster cc'd in e-mail]

On Tue, 05 Oct 1999 15:02:48 +0200, Gregor Bruhin
<gregor.bruhin@bluewin.ch> wrote:
>I have some problems with this simple perl script...

Oh you bet you do.

>when I try to run it through a web server (IIS or apache), I get a error
>code 500 Internal Server Error, and in the log file:
>[Tue Oct 05 10:20:06 1999] [error] [client 10.253.1.135] Premature end
>of script headers: c:/program files/apache group/apache/cgi-bin/mail.pl,
>this means my script died why ???

That means "it didn't work".  You didn't emit the correct Content-type
header as the first thing, or the program crashed, or, or, or...

>when I print the header at the beginning of the script, I get no error,
>but I get no mail, why ???

You do get an error, you just don't recognize it for what it is.  As for
why you don't get mail, read on.

>Here is the famous script:
>#!c:/perl/bin/perl.exe
>
>$port = 25;
>$them = 'mail.gtn.ch';
>$AF_INET = 2;
>$SOCK_STREAM = 1;

OUCH!  Three fouls in one shot.  That's bad.  
	1. I see no "use CGI;" here.
	2. You hard-wired AF_INET and SOCK_STREAM!
	   That's bad, mmmkay?  They're not ALWAYS the same on every
	   system.
	3. I see a reference to "$port=25"...you're going to 
	   try to send this by hand, aren't you?

>$SIG{'INT'} = 'dokill';
>sub dokill {
>    kill 9,$child if $child;
>}

That's an interesting handler.  Any reason that when you get tapped on the
shoulder (INT) you notify your child with a Bazooka (KILL)?

>($name,$aliases,$proto) = getprotobyname('tcp');

Ugh.  You did do this by hand.  Why not use the Socket module for some of
this?  It's quick, easy and comes with every distribution of Perl...

>print S "MAIL FROM:<CGI_SCRIPT_WEBPAGE>\n";
>print S "RCPT TO:<greg.bruhin\@gtn.ch>\n";
>$a=<S>;

You assume too much.  You assume WAAAAAAY too much.  *sigh* talking to
sendmail like this you don't have a clue what goes wrong, when things go
wrong.  You just keep talking and talking and talking and talking and
never notice that the person you're talking to is speaking Navajo or has
died.

>print "Content-type:text/html\n\n";

*ahem* Any reason you print this out nearly dead last in your program?
Any reason you didn't use CGI.pm's header() function?  Any reason you
print out an invalid Content Type header?

>P.S. It should run an a win NT 4 (i386), all patches applied, latest
>release of perl, and latest Apache...

A laundry list?  I think this part is /your/ job.  :-)



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

Date: 5 Oct 1999 13:48:38 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Perl Debugger
Message-Id: <7tcvjm$re$1@pegasus.csx.cam.ac.uk>

G.Ananth Somayaji <gs_ananth@ti.com> wrote:
>Hello,
>	Is there any way I can emulate tcsh inside the perl debugger.
>  What I would like specifically is something like history,
>  inteligent completion etc.

perl5db.pl provides history  -  see the ! command in perldebug, and also
this quote:

     As shipped, the only command line history supplied is a
     simplistic one that checks for leading exclamation points.
     However, if you install the Term::ReadKey and Term::ReadLine
     modules from CPAN, you will have full editing capabilities
     much like GNU readline(3) provides.

I'm not sure what you mean by "inteligent completion", but the 'f'
command provides filename completion, and perldoc perdebug also says

     A rudimentary command line completion is also available.
     Unfortunately, the names of lexical variables are not
     available for completion.


Mike Guy


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

Date: Tue, 05 Oct 1999 16:27:35 +0200
From: Stephen Riehm <sr@pc-plus.de>
Subject: Re: Perl macros for vi
Message-Id: <37FA0AD7.987E34C3@pc-plus.de>

Ken Chesak wrote:
> 
> Where can I get Perl macros for vi?
> 
>  I tried the following link in Perl FAQ  and it is not valid.
> http://www.perl.com/CPAN/authors/Tom_Christiansen/scripts/toms.exrc,
> 
> Thanks

Do the macros have to be for vi, or would you consider using vim? (a
better vi!)
If so, you might like to try my macros, available at
http://www.bigfoot.com/~stephen.riehm

Steve


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

Date: 5 Oct 1999 14:13:31 GMT
From: gbacon@ruby.itsc.uah.edu (Greg Bacon)
Subject: Re: sort routine - can it ignore numeric values?
Message-Id: <7td12b$fmk$2@info2.uah.edu>

In article <7tcsq0$rdt$1@pegasus.csx.cam.ac.uk>,
	mjtg@cus.cam.ac.uk (M.J.T. Guy) writes:

: Abigail <abigail@delanet.com> wrote:
:
: >
: >   @sorted = map  { $_ -> [0]}
: >             sort { $a -> [1] cmp $b -> [1]}
: >             map  {[$_ => /\s+([^,]+)/]} 
:                      ^^^^^^^^^^^^^^^^^^^
: >             @unsorted;
: 
: That happens to work under current Perls, but you're living dangerously.
: Perl does not, in general, define order of evaluation.    Some future
: optimisation might blow that up.

You think?  It's canon now, and I can't begin to imagine the volume of
clucking that would take place were someone to try to break this
code. :-)

Greg
-- 
Would a fly without wings be called a walk?
    -- George Carlin


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

Date: Tue, 5 Oct 1999 07:37:55 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: sort routine - can it ignore numeric values?
Message-Id: <MPG.1263ad15c3b0d6798a037@nntp.hpl.hp.com>

In article <7tcsq0$rdt$1@pegasus.csx.cam.ac.uk> on 5 Oct 1999 13:00:48 
GMT, M.J.T. Guy <mjtg@cus.cam.ac.uk> says...
> Abigail <abigail@delanet.com> wrote:
> >
> >   @sorted = map  { $_ -> [0]}
> >             sort { $a -> [1] cmp $b -> [1]}
> >             map  {[$_ => /\s+([^,]+)/]} 
>                      ^^^^^^^^^^^^^^^^^^^
> >             @unsorted;
> 
> That happens to work under current Perls, but you're living dangerously.
> Perl does not, in general, define order of evaluation.    Some future
> optimisation might blow that up.

I'm trying but failing to seek meaning in your observation.  I see the 
construction of a two-element anonymous array, the first element of 
which is $_, the second element of which is a field of $_.  Please 
explain what order of evaluation has to do with this construction.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 5 Oct 1999 14:49:54 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: sort routine - can it ignore numeric values?
Message-Id: <7td36i$41n$1@pegasus.csx.cam.ac.uk>

In article <7td12b$fmk$2@info2.uah.edu>, Greg Bacon <gbacon@cs.uah.edu> wrote:
>In article <7tcsq0$rdt$1@pegasus.csx.cam.ac.uk>,
>	mjtg@cus.cam.ac.uk (M.J.T. Guy) writes:
>
>: Abigail <abigail@delanet.com> wrote:
>:
>: >
>: >   @sorted = map  { $_ -> [0]}
>: >             sort { $a -> [1] cmp $b -> [1]}
>: >             map  {[$_ => /\s+([^,]+)/]} 
>:                      ^^^^^^^^^^^^^^^^^^^
>: >             @unsorted;
>: 
>: That happens to work under current Perls, but you're living dangerously.
>: Perl does not, in general, define order of evaluation.    Some future
>: optimisation might blow that up.
>
>You think?  It's canon now, and I can't begin to imagine the volume of
>clucking that would take place were someone to try to break this
>code. :-)

No, it isn't canon.   Slight variations on that code already break, e.g.
the rather artificial

       sub dont_do_much { @_ };

       [ dont_do_much($_ => /\s+([^,]+)/) ];

Deferring copying of the value of a variable is an optimisation that
Perl already uses.


Mike Guy


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

Date: 5 Oct 1999 14:53:30 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: sort routine - can it ignore numeric values?
Message-Id: <7td3da$453$1@pegasus.csx.cam.ac.uk>

In article <MPG.1263ad15c3b0d6798a037@nntp.hpl.hp.com>,
Larry Rosler <lr@hpl.hp.com> wrote:
>In article <7tcsq0$rdt$1@pegasus.csx.cam.ac.uk> on 5 Oct 1999 13:00:48 
>GMT, M.J.T. Guy <mjtg@cus.cam.ac.uk> says...
>> Abigail <abigail@delanet.com> wrote:
>> >
>> >   @sorted = map  { $_ -> [0]}
>> >             sort { $a -> [1] cmp $b -> [1]}
>> >             map  {[$_ => /\s+([^,]+)/]} 
>>                      ^^^^^^^^^^^^^^^^^^^
>> >             @unsorted;
>> 
>> That happens to work under current Perls, but you're living dangerously.
>> Perl does not, in general, define order of evaluation.    Some future
>> optimisation might blow that up.
>
>I'm trying but failing to seek meaning in your observation.  I see the 
>construction of a two-element anonymous array, the first element of 
>which is $_, the second element of which is a field of $_.  Please 
>explain what order of evaluation has to do with this construction.

Ooops.   I'd read that as if it were s///, which would have a side
effect on $_.

Need more coffee.


Mike Guy


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

Date: Tue, 05 Oct 1999 10:21:01 -0400
From: Xiaoyan Liu <xliu@cs.sunysb.edu>
Subject: test please ignore
Message-Id: <37FA094D.FB6941FD@cs.sunysb.edu>





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

Date: Tue, 05 Oct 1999 13:28:16 GMT
From: scott@aravis.softbase.com (Scott McMahan)
Subject: Re: UNIX (Solaris 2.6) to NT ACCESS DB?
Message-Id: <Q1nK3.1160$H32.69840@newshog.newsread.com>

Kragen Sitaker (kragen@dnaco.net) wrote:

> Anyway, it *could* change, but when and if it does, it means that
> *every application* that uses COM for storage will suddenly no longer
> be able to read its old files.

That's not right -- the application would be oblivious to the change.
A COM storage could be stored anywhere, and the application doesn't
care because it uses the COM API. A storage could be in a BLOB field in
a database as easily as a file, as long as the application was able to
name it properly. If the application couldn't name the file properly,
it would break, but it would probably break anyway :)

The whole point of the storage abstraction is the implementation
of "files" can change out from under the application without it
even noticing. The idea is to allow for distributed files and
so forth, ie a filesystem with files on other computers.

> BTW, the NTFS-as-COM-storage idea sort of parallels Linux's reiserfs.

An object-oriented file system in a database was also tried by Oracle, if
I remember right, who wanted to replace the entire OS with a "bare metal"
computer running just Oracle. None of these have taken off, probably
because the speed is not there yet. Either that or the "low tech" file
sharing is good enough, and not worth the migration. Beats me.

Scott


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

Date: 5 Oct 1999 13:24:45 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: What's the quickest way to read a file
Message-Id: <7tcu6t$slk$1@pegasus.csx.cam.ac.uk>

Philip 'Yes, that's my address' Newton <nospam.newton@gmx.net> wrote:
>On Tue, 05 Oct 1999 00:00:01 +0200, Frank de Bot <debot@xs4all.nl> wrote:
>
>>What is the quickest way to read a file of about 2800 Kb?
>
>With Perl, my bets would be on local $/; followed by one <> if you
>want it all at once; then you don't have to scan for $/ or split lines
>into array elements etc. (Question: Would pre-extending the scalar
>which receives the file's contents to the required length, e.g. using
>stat() to determine it and saying $contents = ' ' x $length, be any
>faster than just assigning $contents = <> without initialisation?)

I'd expect using sysread() to read the file in one gulp would be
fastest, but I haven't tried any benchmarking.


Mike Guy


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

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 990
*************************************


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