[11647] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5247 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Mar 29 01:03:12 1999

Date: Sun, 28 Mar 99 22:00:17 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sun, 28 Mar 1999     Volume: 8 Number: 5247

Today's topics:
        code to search for URLs? <kevin.smith@ntexpert.demon.co.uk>
        GD Perl package 1.18 <smiths@erols.com>
        Help with split (nf0)
    Re: Help with split (Bob Trieger)
    Re: Help with split (nf0)
    Re: how to include a init table file without complainin (Daniel)
    Re: how to include a init table file without complainin (Sam Holden)
        Language Netiquette (Was: Re: Counter Digits) (Larry Rosler)
        Link "scraper"? Any examples out there? ma5ter@my-dejanews.com
    Re: perl port for 16-bit MSDOS? <ebohlman@netcom.com>
    Re: Pushing current line back onto <FILE> (William Herrera)
        PWS, Win95, CGI and Perl (Robzenuk)
    Re: PWS, Win95, CGI and Perl <jonsmirl@mediaone.com>
    Re: Q on procmail piped to perl - solved <tavi367@ibm.net>
    Re: RE to match one line of Larry's quote <555034897s@acadiau.ca>
    Re: RE to match one line of Larry's quote (Sam Holden)
    Re: RE to match one line of Larry's quote (Sam Holden)
    Re: script headers <jhknight@olemiss.edu>
    Re: Very large float arrays and size problem <jdf@pobox.com>
    Re: Webspace? editor@dvar.com
    Re: Why do we like Perl? <chowse@mdcc.edu>
    Re: Writing isn't working, and the mode is set, Help! <ebohlman@netcom.com>
    Re: Writing isn't working, and the mode is set, Help! <ebohlman@netcom.com>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Mon, 29 Mar 1999 02:59:17 +0100
From: Kevin Smith <kevin.smith@ntexpert.demon.co.uk>
Subject: code to search for URLs?
Message-Id: <36FEDE75.C9FAFAEC@ntexpert.demon.co.uk>

 Hi, 
I would like to know if there is/are programs
available that can be incorporated in a web
page (or CGI script) and that can look up various URLs
from a users input. 
E.g. A user types in
"xyz" and the web page then lists all 
domain names that it can contact (without loading the
page)
like xyz.com, xyz.net, xyz.co.uk.........
and so on.
 
Alternatively, which language do you think
would be the easiest for writing a program
to do this? Would javascript do it?
 
Alternatively, do you know of any websites
where I could go and look for the appropriate
code? 

Regards, 
Kevin Smith


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

Date: Sun, 28 Mar 1999 23:16:33 -0500
From: "The Smiths" <smiths@erols.com>
Subject: GD Perl package 1.18
Message-Id: <7dmue3$suq$1@autumn.news.rcn.net>

Does anyone know what version of the gd library is shipped with the GD Perl
package version 1.18?  Has anyone upgraded the gd library to 1.3 while still
using GD 1.18?

Thanks,
Tim.






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

Date: Mon, 29 Mar 1999 03:27:47 GMT
From: nf0@10500bc.org (nf0)
Subject: Help with split
Message-Id: <36fef2d1.7640066@news.hex.net>

I'm trying to split a line like this:
article.php3?file=issues/199903/something
I want to split on the /'s but I can't seem to 
get the syntax correct could some one help?
Thanks in advance


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

Date: Mon, 29 Mar 1999 03:36:33 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: Help with split
Message-Id: <7dmsk8$8jh$1@oak.prod.itd.earthlink.net>

In article <36fef2d1.7640066@news.hex.net>, nf0@10500bc.org wrote:
>I'm trying to split a line like this:
>article.php3?file=issues/199903/something
>I want to split on the /'s but I can't seem to 
>get the syntax correct could some one help?
>Thanks in advance

split /\//;

you have to escape the forward slash with a back slash.

HTH

Bob Trieger
sowmaster@juicepigs.com       



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

Date: Mon, 29 Mar 1999 04:55:16 GMT
From: nf0@10500bc.org (nf0)
Subject: Re: Help with split
Message-Id: <36ff079c.3368496@news.hex.net>

Thanks thats just what I was looking for. 

On Mon, 29 Mar 1999 03:36:33 GMT, sowmaster@juicepigs.com (Bob
Trieger) wrote:

>In article <36fef2d1.7640066@news.hex.net>, nf0@10500bc.org wrote:
>>I'm trying to split a line like this:
>>article.php3?file=issues/199903/something
>>I want to split on the /'s but I can't seem to 
>>get the syntax correct could some one help?
>>Thanks in advance
>
>split /\//;
>
>you have to escape the forward slash with a back slash.
>
>HTH
>
>Bob Trieger
>sowmaster@juicepigs.com       



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

Date: Sun, 28 Mar 1999 19:42:19 GMT
From: daniel.mendyke@digital.com (Daniel)
Subject: Re: how to include a init table file without complaining from "use strict"
Message-Id: <7dm0v1$css$1@nntpd.lkg.dec.com>

In article <36EFA6A7.3E515811@eed.ericsson.se>, Alex Farber <eedalf@eed.ericsson.se> wrote:
>Tungning Cherng wrote:
>> For example, Two files: a.pl ad b.pl.
>> 
>> % cat a.pl
>> my %largeTable=(
>>    'a' , '1',
>>    'b' , '2',
>> );
>> 
>> % cat b.pl
>> use strict;
>> require "a.pl";
>> print "$largeTable{'a'}\n";
>
>Or maybe use Exporter (type "perldoc Exporter").
>
>/Alex

I've been trying to run the above example with
no success.  Why does the following code
print nothing at all?  I'm expecting the print 
statement in 'run_one.pl' to print the number 1
but it doesn't.  What am I doing wrong?

---------------------------
# File one.pl

package TOne;
use vars '$one';
my $one = 1;

--------------------------
# File run_one.pl

use strict;

use vars '$one';
require "one.pl";
package main;
print $one;


-Daniel




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

Date: 29 Mar 1999 05:04:05 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: how to include a init table file without complaining from "use strict"
Message-Id: <slrn7fu2e5.i3i.sholden@pgrad.cs.usyd.edu.au>

On Sun, 28 Mar 1999 19:42:19 GMT, Daniel <daniel.mendyke@digital.com> wrote:
>
>I've been trying to run the above example with
>no success.  Why does the following code
>print nothing at all?  I'm expecting the print 
>statement in 'run_one.pl' to print the number 1
>but it doesn't.  What am I doing wrong?
>
>---------------------------
># File one.pl
>
>package TOne;
>use vars '$one';
>my $one = 1;
 ^^

Why don't you read the documentation that talks about this bit of perl :

perldoc -f my

It's only short and will answer your question in the first sentence.

No I'm not going to type it in for you, if you can run a perl program
you can rea the perl docs.

-- 
Sam

compiling kernels is what I do most, so they do tend to stick to the
cache ;)	--Linus Torvalds


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

Date: Sun, 28 Mar 1999 21:34:28 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Language Netiquette (Was: Re: Counter Digits)
Message-Id: <MPG.1168b0c01b797b3f9897e4@nntp.hpl.hp.com>

[Posted and a courtesy copy sent to Joerg Plate.]

Last Friday, I posted a response in English to a response in English to 
a post in English that had been cross-posted to several newsgroups 
(including some wrong ones) but also including the two groups I am 
posting to now:  comp.lang.perl.misc and de.comp.lang.perl.  Below are 
just the starts of the three posts.

In article <MPG.1165d27bfd60c8a99897da@nntp.hpl.hp.com> on Fri, 26 Mar 
1999 17:21:40 -0800, Larry Rosler <lr@hpl.hp.com >says...
> In article <dSVK2.3083$PY.58750@news.rdc1.on.wave.home.com> on Sat, 27 
> Mar 1999 00:44:57 GMT, Michael Villeneuve <mickv@home.com> says...
> > In article <36fbd156.0@info.xpoint.at> on Fri, 26 Mar 1999 19:25:32
> > +0100, Christian <cb2001@hotmail.com >says...
> > > Hi
> > > 

 ...

Note that the original was posted from Austria -- in English.

My post instigated the following email correspondence with Joerg Plate 
[plate@psyche.kn-bremen.de]:

[JP] The language of "de.comp.lang.perl" is german.

[LR] I responded to an English-language post that was cross-posted to 
[LR] several newsgroups.  I didn't bother to see which they were.
[LR]
[LR] If this offends you, protest to the original poster.

[JP] That was your fault.

[LR] Quatsch!    [Approximate translation:  Bullshit!]

[JP] Nicht lernfdhig? Ende der Diskussion.  [Not educable? ...]

Rather than that being the end of the discussion, I thought to bring it 
up in these two forums, because I think I *am* educable.

Was I culpable to continue an English-language thread in 
de.comp.lang.perl (as I am doing now :-)?  Would any of you have scanned 
the list of cross-posted groups with the thought of avoiding such an 
'error'?  Having discovered a cross-post to de.comp.lang.perl, would you 
have removed that group from the followups, or would you have posted a 
separate response in German to that group, or would you have ignored the 
issue?

War das wahrlich mein Fehler?

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


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

Date: Mon, 29 Mar 1999 02:44:22 GMT
From: ma5ter@my-dejanews.com
Subject: Link "scraper"? Any examples out there?
Message-Id: <7dmpe5$4v2$1@nnrp1.dejanews.com>

I am just learning Perl5 and I am trying to build a "link scraper", i.e., a
CGI that will browse the web and conscruct a new web page with the links that
it is told to find.

Any existing examples of something like this?

Thanks in advance!

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Mon, 29 Mar 1999 03:26:21 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: perl port for 16-bit MSDOS?
Message-Id: <ebohlmanF9C6vx.B8x@netcom.com>

Hans Olav Husum <nbhoh1@moa.norges-bank.no> wrote:
: Please don't laugh: I would like to get hold of a binary dostribution of a
: perl port that runs under MSDOS 3.3 on an 8086. Going back to version 3 or 4
: is OK (and probably necessary).

There's an MS-DOS port of perl 4.0.36 (the last patch of Perl 4) at 
<URL:http://www.oasis.leo.org/perl/ports/msdos/>.  It doesn't say whether 
it uses 386-specific code or requires DOS 5+ features, but it's probably 
worth a try.



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

Date: Mon, 29 Mar 1999 00:39:49 GMT
From: posting.account@lynxview.com (William Herrera)
Subject: Re: Pushing current line back onto <FILE>
Message-Id: <36fecbca.899727546@news.rmi.net>

On 15 Mar 1999 17:00:25 -0500, jete@dgs.dgsys.com (Jete Software Inc.)
wrote:

>I need to push the current line back onto the <FILE> file handle
>
>open(FILE, "/tmp/junk") || die "Can't open /tmp/junk";
>
my ($lastTell)  = 0;
>while <<FILE>) {
>
>	if (something) {
>	   #	push $_ back onto <FILE>;
                           seek(FILE, $lastTell, 0);
>		last;
>	}
             else
             {
               $lastTell = tell(FILE);
             }
>}


---
The above from: address is spamblocked. Use wherrera (at) lynxview (dot) com for the reply address.


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

Date: 29 Mar 1999 02:46:10 GMT
From: robzenuk@aol.com (Robzenuk)
Subject: PWS, Win95, CGI and Perl
Message-Id: <19990328214610.25065.00001604@ng141.aol.com>

I'm not sure if this is the right place to put this post, but I'm pulling my
hair out trying to figure this out.

I recently installed PWS 4.0 on NT 4.0 with SP4 and both Perl and CGI work
great.  I just reinstalled Perl after I installed PWS, allowed all the default
associations to occur and everything worked like a champ.  I wrote a small form
and tested it using GET and POST and everything worked great.  That  was on my
NT machine at work...

At home, I have Windows95.  I installed the PWS product for Windows95 and tried
to do all the same things.  The perlwin32faq6 - web server info suggests to do
the same thing for Windows95.  I actually downloaded the sample html and cgi
script from work and I get different results at home.

When I use method='GET', the browser launches notepad displaying my script
file. When I use method='POST' I get the following message:
----------------------------------------------------------------------------
HTTP Error 405
405 Method Not Allowed

The method specified in the Request Line is not allowed for the resource
identified by the request. Please ensure that you have the proper MIME type set
up for the resource you are requesting.

Please contact the server's administrator if this problem persists.
----------------------------------------------------------------------------
Does anyone know if this can work or better yet does anyone have this working? 
If it does work, is there a set of instructions somewhere?

Any help would be appreciated.

Rob


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

Date: Sun, 28 Mar 1999 21:57:01 -0500
From: "Jon Smirl" <jonsmirl@mediaone.com>
Subject: Re: PWS, Win95, CGI and Perl
Message-Id: <bYBL2.11229$_A2.35354@lwnws01.ne.mediaone.net>

You need to add a registry key for PWS in the Script Map section. It is
something like .pl => perlis.dll. Search around for it in the doc or
dejanews, it's in there. You also need to use PWS's control panel to set the
directory's execute permission.

Perlis.dll works fine on Win95 with PWS.  However, I'm getting almost three
times the performance out of mod_perl with Apache on Win95. The downside is
that it took me a week to get mod_perl/Apache built and functioning where I
had perlis.dll up in about an hour.

I've uninstalled pws/perlis.dll or I'd send you the key.

--
Jon Smirl
jonsmirl@mediaone.net


Robzenuk <robzenuk@aol.com> wrote in message
news:19990328214610.25065.00001604@ng141.aol.com...
> I'm not sure if this is the right place to put this post, but I'm pulling
my
> hair out trying to figure this out.
>
> I recently installed PWS 4.0 on NT 4.0 with SP4 and both Perl and CGI work
> great.  I just reinstalled Perl after I installed PWS, allowed all the
default
> associations to occur and everything worked like a champ.  I wrote a small
form
> and tested it using GET and POST and everything worked great.  That  was
on my
> NT machine at work...
>
> At home, I have Windows95.  I installed the PWS product for Windows95 and
tried
> to do all the same things.  The perlwin32faq6 - web server info suggests
to do
> the same thing for Windows95.  I actually downloaded the sample html and
cgi
> script from work and I get different results at home.
>
> When I use method='GET', the browser launches notepad displaying my script
> file. When I use method='POST' I get the following message:
> --------------------------------------------------------------------------
--
> HTTP Error 405
> 405 Method Not Allowed
>
> The method specified in the Request Line is not allowed for the resource
> identified by the request. Please ensure that you have the proper MIME
type set
> up for the resource you are requesting.
>
> Please contact the server's administrator if this problem persists.
> --------------------------------------------------------------------------
--
> Does anyone know if this can work or better yet does anyone have this
working?
> If it does work, is there a set of instructions somewhere?
>
> Any help would be appreciated.
>
> Rob




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

Date: Mon, 29 Mar 1999 00:41:58 -0500
From: "tavi" <tavi367@ibm.net>
Subject: Re: Q on procmail piped to perl - solved
Message-Id: <36ff1231@news1.us.ibm.net>

In case anyone is interested.

It seems that the recipe and the perl script was working all the time.

It's just that the perl script was dumping its .out file in the $HOME
directory and not in the scripts directory, as I thought it should.

I wish to extend my gratitude to all those who ventured solutions and
de-bugging techniques.

So, if any one wants to know, this is my procmail recipe and the perl
script.

Walter

============================

    :0
    * ^TO()perl@tscinternet\.com
    | $HOME/vmail/perl/test.pl

============================

#! /usr/local/bin/perl5 -w

$/ = undef;                             # undefine line terminator so we
    my $message = <STDIN>;              # slurp in the whole thing at once,
$/ = "\n";                              # then redefine the line terminator

open(LOG, ">>./test.out") or die "$0: Unable to open test.out: $!";
    print LOG '===============================', "\n";
    print LOG $message, "\n\n";
close LOG;


# eof

============================





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

Date: Mon, 29 Mar 1999 00:42:42 -0400
From: Tong <555034897s@acadiau.ca>
Subject: Re: RE to match one line of Larry's quote
Message-Id: <36FF04C2.5D2C195C@acadiau.ca>

Oh, thank you, thank you Larry and Tad very much. 

The answer is really great, actually it is far beyond my understanding.
:-) I added more "()" and print them all out then begun to understand.
So here is my conclusion, correct me if I'm wrong (and tell me if I'm
right):

During a muti-line RE match
"\s" will match/eat "\n", while
"." will still don't match "\n"

Right? Because they are really not appears in the man pages. Another
"un-documented" magic usage is "-n0777e". If I changed to "-ne" and it
wouldn't work any more. I red perlrun several times afterwards and now
think the 0777 is  the same "octnum" as in "-l[octnum]"? I really think
these 3 points will appear in next perl man pages. :-)

Now is the hard part:

- changing from C to Perl, I really (still) don't understand why "use of
while with a m//g option instead of an if" will make so much difference.
I mean how actually does it works?

- Was it the "while" or the "%%" being a great help? What if there is
not such kind of sign ("%%") there? E.g.

title1
  subtitle
  subtitle
title2
  subtitle
  subtitle
  subtitle
title3
  subtitle

How can I add a extra '\n' between subtitle and title? (to change to)

title1
  subtitle
  subtitle

title2
  subtitle
  subtitle
  subtitle

title3
  subtitle

I tired but failed. Now with the new introduction of "while", I have no
idea now. I really hope you don't think it is hard for you. 

Thanks again for your help!


Larry Rosler wrote:

> Here is what I think you want, with explanation (tested).
> 
> #!/usr/local/bin/perl -w
> use strict;
> 
> $_ = do { local $/; <DATA> };   # Slurp the file into $_.
> print $1 while /^%%             # The 'start-of-quote' marker
>                 \s+             #   and whitespace before the quote
>                 (               # Start capture into $1
>                  .+             # One or more non-newline characters
>                  \n             #   and a newline
>                 )               # End capture into $1
>                 \s+             # One or more whitespace characters
>                 --\ Larry\ Wall # up to the 'end-of-quote' marker
>                /gmx;            # Do it as many times as possible
> __END__
> %%
> Besides, including <std_ice_cubes.h> is a fatal error on machines that
> don't have it yet.  Bad language design, there...  :-)
>              -- Larry Wall in <1991Aug22.220929.6857@netlabs.com>
> %%
> Besides, it's good to force C programmers to use the toolbox
> occasionally.  :-)
>              -- Larry Wall in <1991May31.181659.28817@jpl-
> devvax.jpl.nasa.gov>
> %%
> Besides, REAL computers have a rename() system call.    :-)
>              -- Larry Wall in <7937@jpl-devvax.JPL.NASA.GOV>
> %%
> break;                          /* don't do magic till later */
>              -- Larry Wall in stab.c from the perl source code
> %%
> But you have to allow a little for the desire to evangelize when you
> think you have good news.
>              -- Larry Wall in <1992Aug26.184221.29627@netlabs.com>

Tad McClellan wrote:
>    So here's my one-liner:
> 
>       perl -n0777e 'print "$1\n" while /%%\s+(.*?)\s+-- /g' lwall-q.txt
> 
>    (I cannot bring myself to use $& ...)
> 
>    Note my use of while with a m//g option instead of an if,
>    which would only find a single match in the slurped string.


-- 
Anti-Spam: Remove triple 5 to reply


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

Date: 29 Mar 1999 05:21:46 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: RE to match one line of Larry's quote
Message-Id: <slrn7fu3f9.i3i.sholden@pgrad.cs.usyd.edu.au>

On Mon, 29 Mar 1999 00:42:42 -0400, Tong <555034897s@acadiau.ca> wrote:
>Oh, thank you, thank you Larry and Tad very much. 
>
>The answer is really great, actually it is far beyond my understanding.
>:-) I added more "()" and print them all out then begun to understand.
>So here is my conclusion, correct me if I'm wrong (and tell me if I'm
>right):
>
>During a muti-line RE match
>"\s" will match/eat "\n", while
>"." will still don't match "\n"
>
>Right? Because they are really not appears in the man pages.

perldoc perlre tells me :

 .   Match any character (except newline)
\s  Match a whitespace character

It also doesn't mention /n having any effect on newlines. And mentions
a different option to make /n match newlines

>Another
>"un-documented" magic usage is "-n0777e". If I changed to "-ne" and it
>wouldn't work any more. I red perlrun several times afterwards and now
>think the 0777 is  the same "octnum" as in "-l[octnum]"? I really think
>these 3 points will appear in next perl man pages. :-)

perldoc perlrun tells me :

 -0[digits]
            specifies the input record separator ($/) as an octal
            number.  If there are no digits, the null character
            is the separator.  Other switches may precede or
            follow the digits.  For example, if you have a
            version of find which can print filenames terminated
            by the null character, you can say this:

                find . -name '*.bak' -print0 | perl -n0e unlink

            The special value 00 will cause Perl to slurp files
            in paragraph mode.  The value 0777 will cause Perl to
            slurp files whole because there is no legal character
            with that value.

You have a strange definition of '"un-documented" magic'.

>
>Now is the hard part:
>
>- changing from C to Perl, I really (still) don't understand why "use of
>while with a m//g option instead of an if" will make so much difference.
>I mean how actually does it works?

perldoc perlop tells me :

               In scalar context, each execution of m//g finds
               the next match, returning TRUE if it matches, and
               FALSE if there is no further match.

So by using a while you get all the matches as opposed to just the first
match which would be the case with an if.

Again the documentation is quite clear.

>
>- Was it the "while" or the "%%" being a great help? What if there is
>not such kind of sign ("%%") there? E.g.

They both play a part otherwise one of them wouldn't be there...
>
>title1
>  subtitle
>  subtitle
>title2
>  subtitle
>  subtitle
>  subtitle
>title3
>  subtitle
>
>How can I add a extra '\n' between subtitle and title? (to change to)
>
>title1
>  subtitle
>  subtitle
>
>title2
>  subtitle
>  subtitle
>  subtitle
>
>title3
>  subtitle
>
>I tired but failed. Now with the new introduction of "while", I have no
>idea now. I really hope you don't think it is hard for you. 

I'm not sure what you want now... If you just want a blank line in front
of everything that starts at the left margin then tell perl to do that...
The documentation explains things well...

perl -pe 's/^(\S)/\n$1/'

Of course that adds an extra blank line at the start, but that's easy enough
to fix. A substitution isn't really needed either (just print a new line if
you get a match) but again you can do that yourself.

-- 
Sam

People get annoyed when you try to debug them.
	--Larry Wall


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

Date: 29 Mar 1999 05:33:57 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: RE to match one line of Larry's quote
Message-Id: <slrn7fu465.i3i.sholden@pgrad.cs.usyd.edu.au>

On 29 Mar 1999 05:21:46 GMT, Sam Holden <sholden@pgrad.cs.usyd.edu.au> wrote:
>
>It also doesn't mention /n having any effect on newlines. And mentions
>a different option to make /n match newlines

I think I may have meant \n... Oh well that indicates time to stop posting
and get some coffee...

-- 
Sam

Just don't create a file called -rf.  :-)
	--Larry Wall


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

Date: Sun, 28 Mar 1999 20:53:15 -0600
From: Jay Knight <jhknight@olemiss.edu>
Subject: Re: script headers
Message-Id: <36FEEB1A.2174FA87@olemiss.edu>

Uploading the script is NOT the problem, my server is on this machine.  It
could be downloading it though.... I hit shift+save as... should I try again?
thanks....

Jay Knight

Peter Sergeant wrote:

> The most likely, I would say, is that you're uploading using Binary rather
> than ASCII mode.
> Premature end of script headers doesn't mean exactly what you might think,
> so just looking at the script headers isn't going to help. Email the script
> if you want, and I'll see if I can find a problem.
>
> Peter J Sergeant
>
> Jay Knight <jhknight@olemiss.edu> wrote in article
> <36FBFC14.9D9D6309@olemiss.edu>...
> > Dear experienced people,
> >     Most of the time, when I run scripts from the browser, I get a
> > Internal Server Error. So, I go to my server's error log, and there's an
> > error that says premature end of script headers.  There are some simple
> > scripts that work fine, and as far as I can tell the headers are the
> > same.  What might cause these headers to end prematurely?  is it a
> > script error, and perl interpretation error, or possibly a server
> > (apache1.3.4, win98) error?  thanks a bunch.
> >
> > Dumb little newbie,
> > Jay Knight
> >
> >



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

Date: 29 Mar 1999 00:05:29 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: cangelis@hpc.ntua.gr
Subject: Re: Very large float arrays and size problem
Message-Id: <m3hfr4yjfq.fsf@joshua.panix.com>

Costis Angelis <loulou@ltt.ntua.gr> writes:

> I am facing the following situation. I want to read an ASCII file
> containing float values and then write the same file in packed format.

You don't say so in your post, but I'm guessing there's some reason
that you're saving all of the values before writing them out.

In the happy case that there *is* no good reason, then just

  while (<>) {
    print pack('fff', split);
  }

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf


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

Date: Sun, 28 Mar 1999 16:44:07 +0200
From: editor@dvar.com
Subject: Re: Webspace?
Message-Id: <36FE4037.147B@dvar.com>

David L. Cassell wrote:
> 
> editor@dvar.com wrote:
> > Hi everybody,
> > Who knows what is reguired (software & expenses) to setup a server with
> > 18 giga harddisk.
> > I know nothing so all info on this are welcome.
> > Thanking you in anticipation
> 
> I'm sorry, but this is really the wrong newsgroup to be asking.
> Even if you want to set up a webserver and run Perl programs on it,
> this is still the wrong newsgroup.
> If you already have the hardware and OS, ask in one of the many, many
> OS-specific newsgroups.  If you do not even have the OS selected yet,
> then you'll want to spend some time reading newsgroups and documents
> to decide which OS and webserver and web authoring software you
> would prefer.
> 
> David
> --
> David L. Cassell, OAO                     cassell@mail.cor.epa.gov
> Senior computing specialist
> mathematical statistician

Sorry folks, I'm on the highway to the right place.

Thanks.

Regards
Azad


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

Date: Mon, 29 Mar 1999 02:48:41 GMT
From: Charles Howse <chowse@mdcc.edu>
Subject: Re: Why do we like Perl?
Message-Id: <36FEEA07.2A84E036@mdcc.edu>

cch is INTP

In light of INTP, why do I like perl?
-PERL is fringe enough to appeal to fringe personalities.
-PERL is a well done system, and thus appeals to types that appreciate well
done systems.
-PERL works
-Thinking is required
-Many portions/functions don't require explanations due to intuitive nature
and this is a turn on for intuitive types.
-The I type appreciates that large groups are not required to create a
working app
-TIMTOWTDI... which appeals to some mbti types  INTPs also tend to work best
if they are not over-burdened with rules and regulations. Definitely not the
'You MUST do it this way' style.
-PERL does not expect the entire world to be able to use it. Gruff answers
are norm on this list - some types have little time for the touchy-feelie
crap.

for more info on INTP types, or to determine your type:
http://intp.org/

cch


  -Kartik asks about MBTI and PERL



> But of course, not everyone sees things the way I do. Which prompts the
> question I'd like to pose to the community. Why exactly do the fans
> among us like Perl? What are the aspects of it that appeal to us in
> particularly compelling ways?
>
> One of the angles I want to explore on this is personality theory. Back
> before "The Cathedral and the Bazaar", Eric Raymond maintained the
> Jargon file, where he noted the following about the personality
> characteristics of hackers:
>
> ``In terms of Myers-Briggs and equivalent psychometric systems,
> hackerdom appears to concentrate the relatively rare INTJ and INTP
> types; that is, introverted, intuitive, and thinker types...ENT[JP]
> types are also concentrated among hackers but are in a minority.''
>
> An interesting observation, which I think I can expand on. I've got some
> preliminary ideas on how Perl might be a particularly natural fit for
> some personality types. But I'd like to get some independent data from
> people. Those of you who like Perl and are familiar with personality
> models like Myers-Briggs or other models, what type describes your
> personality best? And do you have any thoughts on aspects of Perl that
> particularly appeal to that type?



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

Date: Mon, 29 Mar 1999 03:15:22 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Writing isn't working, and the mode is set, Help!
Message-Id: <ebohlmanF9C6DM.ApL@netcom.com>

William Flanagan <wflanagan@msn.com> wrote:
: The program is to convert a Lotus Notes structured text file into a comma
: delimited file, not knowing the fieldnames and fully expecting that the
: fieldnames will increase over time.  So, that's why all the jumping about.
: I learned a lot from this, and here's the program as it stands now.  Now,
: it's completing and printing, but I'm looking for optimization.

[some comments snipped to save space]

: #!c:\progra~1\perl\bin\perl

You still need a -w there.

'use strict;' would also be desirable.

: if ($#ARGV !=1) {
:     die "Structured Text to Comma Delimiter, 1999 William Flanagan\n Usage:
: $0 inputfile outputfile\n";
:     }
: ($infile,$outfile) = @ARGV;
:    if (! -r $infile) {
:       die "Can't read input $infile\n";
:    }
:    if (! -f $infile) {
:        die "Input $infile is not a plain text, please use a structured plain
: text file\n";
:    }

: $mode='>';
: open(INPUT,"+<$infile") ||
:     die "Can't open $infile successfully, ensure $infile is plain text $!";

Why are you opening INPUT in read/write mode when all you do is read it?  
Note that this will fail if your input file is readable but not writable.

: if ( -e $outfile) {
:     print STDERR "Output file $outfile exists!\n";
:     until ($ans eq 'r' || $ans eq 'a' || $ans eq 'e' ) {
:         print STDERR "replace, append, or exit? ";
:         $ans = getc(STDIN);
:         }
:     if ($ans eq 'e') {exit}
:     }
:     if ($ans eq 'a') {$mode='>>'}

:     else {$mode='>'}

The else clause is unnecessary, since you already defaulted $mode to '>'.

: open(OUTPUT,">$outfile") ||
:     die "Can't create $outfile file, ensure that it does not exist $!";

Misleading error message.  If the output file already exists, opening it 
will wipe it out, but won't fail.

: $ccount = 0;

Change this to 1, for reasons that will become apparent below.

: print STDOUT "\nStructured text to comma separated file converter.\n";
: print STDOUT "Copyright 1999 William Flanagan, All rights reserved.\n";
: print STDOUT "\nPreprocessing $infile...\n";

Progress messages should go to STDERR rather than STDOUT.

: while ($line = <INPUT>) {
:     ($fieldname, $fieldvalue) = split(":", $line);
:     if ($fieldname eq '') {
:        next;}

:     $foundfield='n';
:     for ( $a=0; $a <= $ccount; $a++) {
:          if ($columnlist[$a][1] eq $fieldname) {
:          $foundfield='Y';
:          last; }
:     }
:     if ($foundfield eq 'n') {
:         $columnlist[$ccount] = ["$ccount", "$fieldname"];
:         $ccount++;
:     }

Here you're trying to write C in Perl.  Perl provides a built-in 
mechanism, hashes, for associating a list of names with values.  Replace 
all this with:

$columnnames{$fieldname} ||= $ccount++;

(The change above to make $ccount start at 1 rather than 0 was so we 
could use this idiom rather than having to distinguish between an 
uninitialized hash entry (for a fieldname that hasn't been seen before) and 
one with a zero value (for the first fieldname seen).

: }


: print STDOUT "Writing first line of comma delimited file...\n";

STDERR

: for ($m=0;$m<=$ccount;$m++) {
:     print OUTPUT "$columnlist[$m][1]", ",";
: }
: print OUTPUT "\n";

Replace with:

print OUTPUT join(',',
		  sort {$columnnames{$a} <=> $columnnames{$b}
		  keys %columnnames),"\n";

: print STDOUT "Starting writing of file... the longest part, please wait.\n";

STDERR

: seek(INPUT,0,0);

: $j=0;
: $r=0;
: while ($line = <INPUT>) {
:     chomp($line);
:     ($fieldname, $fieldvalue) = split(":", $line);
:     $fieldvalue=~s/^\s+//;
:     $fieldvalue=~s/,/./;

"$fieldvalue=~tr/,/./" is faster.

:     $foundfield='n';

Not needed; see below.

:     if ($fieldname eq '') {
:        $eorcount++;
:        if ($eorcount eq 3) {

Should be ==, not eq, since you're doing a numeric comparison.

:           for ($k=0;$k<=$#recorddata;$k++) {
:                print OUTPUT "$recorddata[$k]", ",";
:           }
:           print OUTPUT "\n";

Replace with:

print OUTPUT join(',',@recorddata),"\n";

:           @recorddata = ();
:           $eorcount = 0;
:           $r++;
:           next;
:        }
:     }

:     for ( $a=0; $a <= $ccount-1; $a++) {
:          if ($columnlist[$a][1] eq $fieldname) {
:             @recorddata[$a] = $fieldvalue;
:             $foundfield='Y';
:             $eorcount = 0;
:             last;
:          }
:     }
:     if ($foundfield eq 'n') {
:           $eorcount++;
:     }

Replace with:
  else {
    $eorcount=0;
    $recorddata[$columnnames{$fieldname}]=$fieldvalue;
  }
: $j++;

You don't use $j anywhere.

: }

: print STDOUT "\nCompleted.  Results are in $outfile.\n";

IMHO, messages like that are gratuitous.  If you must print one, print it 
to STDERR.

:     close INPUT,OUTPUT;

close takes a single filehandle as its argument, not a list.  You need 
two statements here.

:     exit;

Superfluous.

You could still optimize things further by setting $/ to "\n\n\n\n" which 
would cause each read from INPUT to give you a complete record; you'd 
then have to split it into an array of lines and process each 
separately.  That would get rid of all the "eorcount" tests, which is 
probably worth it since they currently have to be done for every line.  
The exact code to do this is left as an exercise.



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

Date: Mon, 29 Mar 1999 03:45:14 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Writing isn't working, and the mode is set, Help!
Message-Id: <ebohlmanF9C7rF.C3t@netcom.com>

Eric Bohlman <ebohlman@netcom.com> wrote:
: Replace with:
:   else {
:     $eorcount=0;
:     $recorddata[$columnnames{$fieldname}]=$fieldvalue;

That should have been "$columnnames{$fieldname}-1"; I forgot that I had 
made the field numbers start with 1 rather than 0.

:   }
: : $j++;


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

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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.misc (and this Digest), send your
article to perl-users@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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 5247
**************************************

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