[7374] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 999 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Sep 9 01:07:21 1997

Date: Mon, 8 Sep 97 22:00:23 -0700
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, 8 Sep 1997     Volume: 8 Number: 999

Today's topics:
     Re: </.*?> vs. </[^>]*> (Tad McClellan)
     Re: A simpler perl question. <v3100411@student.anu.edu.au>
     Re: A simpler perl question. (Mike Stok)
     Re: A simpler perl question. (brian d foy)
     Re: A simpler perl question. <tlawallANTISPAM@concentric.net>
     Re: Beginner's question : Perl or Java ? <merlyn@stonehenge.com>
     Re: DNS lookup with gethostbyaddr? <peter@preview.org>
     Re: flock() problem (Lutz Albers)
     Re: Getting rid of \n in textarea input <ahr@hotmail.com>
     HELP!  Subroutine is making me cry! <jwest@pixelny.com>
     Re: HELP! subroutine is making me cry! (brian d foy)
     Re: HELP! subroutine is making me cry! (dave)
     Re: Hunh?  Why DOES this work??? <merlyn@stonehenge.com>
     Need some help with &parse_form_data <repearse@mail.utexas.edu>
     Re: Need some help with &parse_form_data (brian d foy)
     Re: Perl with cygnus (Danny Aldham)
     Printing table cells using "format" <rshadian@hawaii.edu>
     Re: regex problems <youngej@magpage.com>
     Re: script for UNIX .db file (Martien Verbruggen)
     Testing attempts fail.. <eric@garlic.com>
     Undefined subroutine &main::CgiDie called at util.pl li <daveck@top.monad.net>
     Re: unpack (Andrew D. Arenson)
     Re: What does "regexp *+ operand could be empty" mean? (Charles DeRykus)
     Re: What does "regexp *+ operand could be empty" mean? (Ilya Zakharevich)
     Re: Win95 Com Port Programming? <charlie@flychina.com>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Mon, 8 Sep 1997 20:04:47 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: </.*?> vs. </[^>]*>
Message-Id: <fb72v5.8qs.ln@localhost>

kendall shaw (kshaw@plight.lbin.com) wrote:
: tadmc@flash.net (Tad McClellan) writes:

: > kendall shaw (kshaw@plight.lbin.com) wrote:
: > : Duhhh. How come </.*?> doesn't do what I thought it did?
: > 
: > I dunno.
: > 
: > Would you care to share with us what you thought it did?
: > 
: > What *is* it anyway?
: > 
: > A glob?
: > 
: > A regex?

: Sheesh! 

: Well, I'm failing to repeat the problem. I probly just messed
: something up, but let me ask a question instead:

: Is there ever a difference between the regular expressions: </.*?> and
: </[^>]*>?


Yes.


1)

</[^>]*> works fine on multiline strings.

</.*?> would need the m//s modifier to get the same effect.



2)

</[^>]*> is faster  ;-)



I prefer to use non-greediness only when I cannot find any other way.


--
    Tad McClellan                          SGML Consulting
    tadmc@flash.net                        Perl programming
    Fort Worth, Texas


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

Date: Tue, 09 Sep 1997 10:52:57 +1000
From: "MJ.VAN OOSTERHOUT" <v3100411@student.anu.edu.au>
Subject: Re: A simpler perl question.
Message-Id: <34149DE9.61B4@student.anu.edu.au>

OrdwayNet Webmaster wrote:
> 
> I have a question that I need answered-
> 
> I have a directory full of files.  Lets say that I want to add something to
> each one of those files.  How would I do it?
> 
> I think it would be something like this, but it isn't enough-
> 
> foreach $file
> 
> print "bla bla"\n";
> 
> How do I make $file mean every file in the dir.   Thanks for any help!
> Email me at ordway@iwshost.net or post it on this newsgroup.

How about:

opendir(DH,$directory) || die;
@filelist = readdir(DH);
closedir(DH);
foreach $file (@filelist)
{ blah.... }

or maybe even (I haven't tested this) :

opendir(DH,$directory) || die;
foreach($file = readdir(DH))
{ blah.... }
closedir(DH);

Martijn
Australia


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

Date: 9 Sep 1997 01:04:20 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: A simpler perl question.
Message-Id: <5v27ak$9tn@news-central.tiac.net>

In article <01bcbadc$fdfcb5e0$1f178cd0@presario>,
OrdwayNet Webmaster <ordway@iwshost.net> wrote:
>I have a question that I need answered-
>
>I have a directory full of files.  Lets say that I want to add something to
>each one of those files.  How would I do it?
>
>I think it would be something like this, but it isn't enough-
>
>foreach $file
>
>print "bla bla"\n";
>
>How do I make $file mean every file in the dir.   Thanks for any help! 
>Email me at ordway@iwshost.net or post it on this newsgroup.

One way would be to do something like this, assuming $dir contains a
directory name and the path spearator is / might be:

  opendir DIR, $dir or die "$0: opendir failed ($!)\n";
  while (defined ($entry = readdir DIR)) {
    $file = "$dir/$entry";

    next unless -f $file;

    unless (open FILE, ">>$file") {
      warn "$0: couldn't open $file to append ($!), skipping\n";
      next;
    }

    print FILE "another line\n";
    close FILE or warn "$0: error closing $file ($!)\n";
  }

  closedir DIR or warn "$0: error closing $dir ($!)\n";

Hope this helps,

Mike

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com                |      Pencom Systems Administration (work)


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

Date: Mon, 08 Sep 1997 21:24:19 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: A simpler perl question.
Message-Id: <comdog-ya02408000R0809972124190001@news.panix.com>

In article <34149DE9.61B4@student.anu.edu.au>, "MJ.VAN OOSTERHOUT" <v3100411@student.anu.edu.au> wrote:

>OrdwayNet Webmaster wrote:


>opendir(DH,$directory) || die;

such a useless death.  oh the humanity...

   opendir(DH,$directory) || die "$0: $!\n";

:)

-- 
brian d foy                                  <comdog@computerdog.com>


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

Date: Mon, 08 Sep 1997 20:02:42 -0600
From: "T. LaWall" <tlawallANTISPAM@concentric.net>
To: OrdwayNet Webmaster <ordway@iwshost.net>
Subject: Re: A simpler perl question.
Message-Id: <3414AE42.3AD0@concentric.net>

OrdwayNet Webmaster wrote:
> 
> I have a question that I need answered-
> I have a directory full of files.  Lets say that I want to add something to
> each one of those files.  How would I do it?
> I think it would be something like this, but it isn't enough-
> foreach $file
> print "bla bla"\n";
> How do I make $file mean every file in the dir.   Thanks for any help!
> Email me at ordway@iwshost.net or post it on this newsgroup.

Try this one:

@files = <*>;
foreach $file (@files){
	open(OUT, ">>$file") or die("cannot open $file! $!");
	# I used >> above to append, but you can use > for the start of file
	print OUT "Blah, Blabity Blah!\n";
	close(OUT);
}

Laters,
Todd

-- 
  -------------------------------------------------
  T. LaWall
  To reply, remove ANTISPAM from my address
  -------------------------------------------------
  Where do I want to go today? 
  With Linux, Anywhere I want, TOLL FREE!
  -------------------------------------------------


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

Date: 08 Sep 1997 21:14:40 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: "Michael A. Watson" <fishrman@shell.wco.com>
Subject: Re: Beginner's question : Perl or Java ?
Message-Id: <8c4t7v6s3z.fsf@gadget.cscaper.com>

>>>>> "Michael" == Michael A Watson <fishrman@shell.wco.com> writes:

Michael> JAVA's main advantage is that you can create an application
Michael> that runs on multi platforms.

Well, if that's your only comparison, Perl has been ported to *many*
more platforms (category and variant) than Java ever likely will.

Like, when are we gonna see an Atari JVM? :-)

print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 357 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: Mon, 8 Sep 1997 20:47:14 -0700
From: "Peter Tiemann" <peter@preview.org>
Subject: Re: DNS lookup with gethostbyaddr?
Message-Id: <5v2gm8$24g$1@ha1.rdc1.sdca.home.com>

I found the solution myself (in someone's script)

$ip = "207.36.32.122";
@numbers = split(/\./, $ip);
$address = pack("C4", @numbers);
($nam) = (gethostbyaddr($address, 2))[0];
this works - although I still do not understand why the stuff below is
wrong.


>At first, I tried a piece of code like this:
>
>----------
>print "Content-type: text/html\n\n";
>print "<html>\n <head>\n  <title>GET</title>\n </head>\n";
>print "<BODY>Start:<BR>\n";
>
>$paddr = "207.36.32.122";
>($a, $b, $c, $d) = split(/\./, $paddr);
>$address = pack('C4', $a, $b, $c, $d);
>($nam, $alias, $addrtype, $leng, @add) = gethostbyaddr($address, AF_INET);
>print "$nam,$alias,$addrtype,$leng\n";
>
>print "<BR>End</BODY>";
>----------




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

Date: Mon, 08 Sep 1997 10:57:58 +0200
From: lutz@muc.de (Lutz Albers)
Subject: Re: flock() problem
Message-Id: <lutz-ya023480000809971057580001@news>

In article <340F120B.2942BAC0@home.net>, zod@home.net wrote:

>Can someone please point out what is wrong:
>Platform: Sparc 5
>OS: Solaris 2.5.x
>open(FILE,"< /tmp/junk");
           ^^^^^
This looks bogus. Get rid of that space char. And check the return code of open.

>flock(FILE,2);
>Does not lock! Do I need rpc.lockd or some other thing running on my
>machine?

Not if your /tmp is not mounted via nfs (a damned stupid idea ... -)

ciao
  lutz
--
Lutz Albers, lutz@muc.de, pgp key available from <http://www.pgp.net>
Do not take life too seriously, you will never get out of it alive.


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

Date: Tue, 09 Sep 1997 18:05:27 -0500
From: Sendu <ahr@hotmail.com>
Subject: Re: Getting rid of \n in textarea input
Message-Id: <3415D637.2C69@hotmail.com>

Javier Figueroa wrote:
> 
> Please if anybody can help me I would really appreciate it.
> 
> I need to know how to get rid of carriage returns put in by users in
> textarea so I can put it in one continuous line in my database file.
> 
> I tried
> 
> $FORM{'information'} =~ s/\n/ /g;
> 
> but it does not work, the carriage return is still being displayed in my
> database file.
> 
> Please if you can post an answer or write me email I would greatly
> appreciate it.
> 
> Thank you very much,
> 
> Javier Figueroa
> figue@tld.net

In a ||r case I used chop($str) to get rid the \n at the end of the
input string 

Hope this works for you too
Sendu


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

Date: Mon, 08 Sep 1997 20:55:55 -0400
From: jenifer west <jwest@pixelny.com>
Subject: HELP!  Subroutine is making me cry!
Message-Id: <34149E9B.47AD@pixelny.com>


Hello, 

I am writing a script which sends images via sendmail to lucky
recipients based on user (form) inputs. Everything works perfectly with
the mailing and boundries, the mime attachemnts - my error checking, etc
- all fine.
Only I need to do some remedial logging of how many of each images are
sent. The simple routine i'm using to open and write to my count.file
works fine if it is called alone. But when it's after the sendamil sub
it is ignored. I've tried everything I can think of - Is there something 
I should be flushing after closing my mail program?

It's strange, I have my successful redirect in the sendmail sub and it's
seemless - but appending my <&count_these;> is ignored - or won't
increment.

As I said the counting sub works fine if called alone.

So - I'm going going to be out of a job if I don't get this right and
right quick! no suggestion to silly! (almost)

Thanks,

Jenifer West,
P I X E L, Inc.


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

Date: Mon, 08 Sep 1997 21:21:13 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: HELP! subroutine is making me cry!
Message-Id: <comdog-ya02408000R0809972121130001@news.panix.com>


In article <3414996C.7DF1@pixelny.com>, jscot@pixelny.com wrote:

[ is that *ny.com mean that you are in New York City?  if so,
you might want to check out NY.pm <URL:http://ny.pm.org> - the
fledgling New York Perl M((o|u)ngers|aniacs)* user group :) ]

>I am writing a script which sends images via sendmail on user (form)
>input. Everything works beautifully. However I must do some simple
>logging of how many of each image the user chooses to send. I'm using a
>simple sub which opens and increments a file. The subroutine works
>perfectly when called alone - but will not open and write to the file
>AFTER sending the image - it is just ignored.

are you sure that it is ignored (for instance, does open() return
an error and do you trap it?).

>I have my successfull redirect in the mail subroutine and it's seemless
>- but appending my <&count_this;> call seems to be ignored.

a redirect huh?  do i smell CGI?

>relevant code available upon request - no suggestion to silly.

well, how about the subroutine in question for starters?

-- 
brian d foy                                  <comdog@computerdog.com>


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

Date: Tue, 09 Sep 1997 01:17:31 GMT
From: over@the.net (dave)
Subject: Re: HELP! subroutine is making me cry!
Message-Id: <3414a208.286873@news.one.net>

js <jscott@pixelny.com> wrote:

>
>Hello - 
>
>I am writing a script which sends images via sendmail on user (form)
>input. Everything works beautifully. However I must do some simple
>logging of how many of each image the user chooses to send. I'm using a
>simple sub which opens and increments a file. The subroutine works
>perfectly when called alone - but will not open and write to the file
>AFTER sending the image - it is just ignored.
>
>Question:
>
>is there something I must flush after closing my mail program?  - in
>order to open and write to the count.txt file?
>
>I have my successfull redirect in the mail subroutine and it's seemless
>- but appending my <&count_this;> call seems to be ignored.
>
>I've tried everything I can think of - now I will be fired and homeless
>unless one of you super-heros assists!
>
>relevant code available upon request - no suggestion to silly.
>
>thank you - I love you!

I'm sure you will get better help in this group, but I'm acting fast
to get in a suggestion on this one :)

To do this I will assume the subroutine works from a shell account on
a UNIX machine, but does not work when ran from the browser.  This may
be because you are writing to a directory owned by you.  Problem can
occur from browser if browser logs on as a different user, which is
what happens at my ISP.  It can be solved by either writing to a
directory that you make writable by the browser uid, or by enabling
setuid for the perl script via a C wrapper.  I won't go into details
unless you think I guessed the problem.

Sorry if I completely missed the mark.

Dave

|
| Please visit me at http://w3.one.net/~dlripber
|
| For reply by email, use:
| dlripber@one.net
|________


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

Date: 08 Sep 1997 21:18:37 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: Eryq <eryq@harp.gsfc.nasa.gov>
Subject: Re: Hunh?  Why DOES this work???
Message-Id: <8c202z6rxe.fsf@gadget.cscaper.com>

>>>>> "Eryq" == Eryq  <eryq@harp.gsfc.nasa.gov> writes:

Eryq> Okay, I'm going a little nuts here... I would have
Eryq> thought the following would be a syntax error, 
Eryq> but 5.002 and 5.004 like it just fine:

Eryq> 	%ssn = (Fred   => 101,
Eryq> 	        Sue    => 102,
Eryq> 	        George => 103);
Eryq> 	$name = 'Sue'; 	
Eryq> 	print %ssn->{$name}, "\n";

Eryq> See what I mean with that %ssn->{$name} jazz?  I mean,
Eryq> I know it's SUPPOSED to be $ssn{$name}... so why is
Eryq> the above code legal?

Yes.  That's broken syntax, not currently detected, not likely to be
supported in a future release.

And a lot of this is sprinkled through the text of the draft I briefly
reviewed of "Perl 5 by Example", so please don't pick it up there.
(Sorry David, but I warned ya! :-)

print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 357 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: Mon, 08 Sep 1997 21:05:02 -0600
From: Robert Eric Pearse <repearse@mail.utexas.edu>
Subject: Need some help with &parse_form_data
Message-Id: <3414BCD7.7B41@mail.utexas.edu>

This is a multi-part message in MIME format.

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

Please find a copy of my code and corresponding HTML form. This is my
first foray into Perl and I can't say it's all that original. In fact
none of it is. I would just like it to work. I think the problem is with
the &parse_form_data subroutine. But, maybe not. Sure would appreciate
any help. The problem is that I don't know enough to ask the right
questions.

Thanks,


Robert

--------------71C36BA36BF1
Content-Type: video/x-mpeg; x-mac-type="3F3F3F3F"; x-mac-creator="3F3F3F3F"; name="manpage.cgi"
Content-Transfer-Encoding: base64
Content-Disposition: inline; filename="manpage.cgi"

IyEvdXNyL2xvY2FsL2Jpbi9wZXJsIAoKcHJpbnQgIkNvbnRlbnQtdHlwZTogdGV4dFxodG1s
IiwgIlxuXG4iOwoKJHdlYm1hc3Rlcj0gIlJvYmVydCBFcmljIFBlYXJzZSAocmVwZWFyc2Vc
QG1haWxcLnV0ZXhhc1wuZWR1KSI7CiRzY3JpcHQgPSAkRU5WeydTQ1JJUFRfTkFNRSd9Owok
bWFuX3BhdGggPSAiL3Vzci9sb2NhbC9tYW4iOwokbnJvZmYgPSAiL3Vzci9iaW4vbnJvZmYg
LW1hbi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dFw/bWFucGFnZT0kMSZzZWN0aW9uPSQyIj4kMSgkMik8XC9hPi9nOwoJCQl9
CgkJfQoJCXByaW50OwoJfQp9CgpwcmludCAiPC9wcmU+PGhyPiIsICJcbiI7CnByaW50ICI8
L2JvZHk+PC9odG1sPiIsICJcbiI7CgpjbG9zZSAoTUFOVUFMKTsKCn0K
--------------71C36BA36BF1
Content-Type: video/x-mpeg; x-mac-type="3F3F3F3F"; x-mac-creator="3F3F3F3F"; name="manpage.html"
Content-Transfer-Encoding: base64
Content-Disposition: inline; filename="manpage.html"

PGh0bWw+CjxoZWFkPgo8dGl0bGU+TWFuIFBhZ2UgR2F0ZXdheTwvdGl0bGU+CjwvaGVhZD4K
Cjxib2R5IGJnY29sb3I9IjYzNjM5YyI+Cjxmb250IGZhY2U9YXJpYWw+Cgo8aDE+VU5JWCBN
YW51YWwgUGFnZSBHYXRld2F5PC9oMT4KPGhyPgo8Zm9ybQphY3Rpb249Imh0dHA6Ly9jY3dm
LmNjLnV0ZXhhcy5lZHUvY2dpLWJpbi9jZ2l3cmFwL3JlcGVhcnNlL21hbnBhZ2UuY2dpIgpt
ZXRob2Q9InBvc3QiPgo8ZW0+V2hhdCBtYW51YWwgcGFnZSB3b3VsZCB5b3UgbGlrZSB0byBz
ZWU/PC9lbT4KPGJyPgo8aW5wdXQgdHlwZT0idGV4dCIgbmFtZT0ibWFucGFnZSIgc2l6ZT00
MD4KPHA+CjxlbT5XaGF0IHNlY3Rpb24gaXMgdGhlIG1hbnVhbCBwYWdlIGxvY2F0ZWQgaW4/
PC9lbT4KPGJyPgo8c2VsZWN0IG5hbWU9InNlY3Rpb24iIHNpemU9MT4KPG9wdGlvbiBzZWxl
Y3RlZD4xCjxvcHRpb24+Mgo8b3B0aW9uPjMKPG9wdGlvbj40CjxvcHRpb24+NQo8b3B0aW9u
PjYKPG9wdGlvbj43CjxvcHRpb24+OAo8b3B0aW9uPkRvbid0IEtub3cKPC9zZWxlY3Q+Cjxw
Pgo8aW5wdXQgdHlwZT0ic3VibWl0IiB2YWx1ZT0iU3VibWl0IHRoZSBmb3JtIj4KPGlucHV0
IHR5cGU9InJlc2V0IiB2YWx1ZT0iQ2xlYXIgYWxsIGZpZWxkcyI+CjwvZm9ybT4KPGhyPgo8
L2JvZHk+CjwvaHRtbD4K
--------------71C36BA36BF1--



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

Date: Mon, 08 Sep 1997 22:37:29 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Need some help with &parse_form_data
Message-Id: <comdog-ya02408000R0809972237290001@news.panix.com>

In article <3414BCD7.7B41@mail.utexas.edu>, Robert Eric Pearse <repearse@mail.utexas.edu> wrote:

>Please find a copy of my code and corresponding HTML form. This is my
>first foray into Perl and I can't say it's all that original. In fact
>none of it is. I would just like it to work. I think the problem is with
>the &parse_form_data subroutine. But, maybe not. Sure would appreciate
>any help. The problem is that I don't know enough to ask the right
>questions.

if you just want something that works, take a look at CGI.pm [1],
which does all of the hard work for you (correctly even).

[1]
<URL:http://www-genome.wi.mit.edu/ftp/pub/software/WWW/cgi_docs.htm>

-- 
brian d foy                                  <comdog@computerdog.com>


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

Date: 8 Sep 1997 19:18:28 -0700
From: danny@lennon.postino.com (Danny Aldham)
Subject: Re: Perl with cygnus
Message-Id: <5v2bll$l1b$1@lennon.postino.com>

Jason Kruse (jason.kruse@teldta.com) wrote:
: Ok, I was bored last week, so I tried to get perl running on my NT box
: at work.  After a little searching, I found that there were free
: development tools available for NT which also were pre-configured to
: compile perl easilly.  Here's a listing of the steps I took.
: 1)  Downloaded beta 18 version, installed, configured environment, and
: tested gcc and all other utils.
: 2)  Transfered perl5.004_02, unpacked in /perl5.004, and followed steps
: in README.cygwin32.
: 3) Multiple problems were found, however all were fixed except the
: following:  When making Fcntl.c, the compiler would complain about a bad
: defenition in op.h where the defenition for op was detailed:

You need a couple of patches. First, you need a new patch program,
available at ftp.ai.mit.edu , so you can patch the perl code. Then
get Chris Faylors perl patches at www.tiac.net/users/cgf , and install
them. Then run Configure and check the generated Makefile for the 
correct PERL_Path variable. It _will_ build. 

--
Danny Aldham           SCO Ace , MCSE , JAPH , DAD
I don't need to hide my e-mail address, I broke my sendmail.


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

Date: Mon, 8 Sep 1997 18:21:39 -1000
From: Ritchard Shadian <rshadian@hawaii.edu>
Subject: Printing table cells using "format"
Message-Id: <Pine.GSO.3.95q.970908180559.17906A-100000@uhunix3>


I defined a format with the declaration:

format STDOUT =
----------------------------------
| Name: @<<<<<<<<<<<<<<<<<<<<<<< |
$name
| Phone: @<<<<<<<<               |
$phone
----------------------------------
 .

I want to use this as a cell in a table, but the problem is that everytime
I "write" it, it prints the info with a newline between each cell.  Is
there a way I can supress the newline so that the next time the format is
written, it goes next to the previous cell, instead of below it?  Or can
someone think of a different way to redefine the format so that it will
place the information in the desired position as it's being processed
(I'm using a while loop). 

Thanks,

Ritchard



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

Date: 9 Sep 1997 01:47:59 GMT
From: Ed Young <youngej@magpage.com>
To: David Siebert <dsiebert@gate.net>
Subject: Re: regex problems
Message-Id: <5v29sf$niq$0@204.179.92.15>

David Siebert wrote:
> 
> how can a replace any amount of whitespace follwed by a ; with just a ;.

  s/\s+;/;/g;


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

Date: 9 Sep 1997 00:38:09 GMT
From: mgjv@mali.comdyn.com.au (Martien Verbruggen)
Subject: Re: script for UNIX .db file
Message-Id: <5v25ph$7u6$1@comdyn.comdyn.com.au>

In article <5v14vr$bhb@news1.saix.net>, 
	Gavin Pollock <clearn@cis.co.za> writes:

> I'm looking for a script to read the UNIX file .netscape.db , which 
> stores the history of the browser. Does anyone have one lying 
> around somewhere?

Have a look at CPAN, and get the module Netscape::History

http://www.perl.com/CPAN/modules/00modlist.long.html

Martien
-- 
Martien Verbruggen                      |
Webmaster www.tradingpost.com.au        | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


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

Date: Mon, 08 Sep 1997 17:23:37 -0700
From: Eric Hilding <eric@garlic.com>
Subject: Testing attempts fail..
Message-Id: <34149709.1498@garlic.com>

I'm trying to modify a perl script which processes info from a web 
form, but first testing the proposed mods first on my PC.  I've tried 
various syntax combinations one at a time and would like to know where 
I'm screwing up.  Thanks for any help.

###### Testing Attempts #######
#### Various Combinations ####
#### Tried One At A Time ####
#$FORM{'e2'} eq "Test Name";
#$FORM{'e2'} eq 'Test Name';
#$FORM{'e2'} eq {'Test Name'};
#$FORM{'e2'} eq  /'Test Name'/;
#$FORM{'e4'} eq "Morgan Hill";
#$FORM{'e4'} eq 'Morgan Hill';
#$FORM{'e4'} eq /Morgan Hill/;
#$FORM{'e4'} eq {'Morgan Hill'};
#$FORM{'r9'} eq "r9a";
#$FORM{'r9'} eq 'r9a';
#$FORM{'r9'} eq /r9a/;
#$FORM{'r9'} eq {'r9a'};
#$FORM{'r9'} eq "r9b";
#$FORM{'r9'} eq 'r9b';
#$FORM{'r9'} eq /r9b/;
#$FORM{'r9'} eq {'r9b'};
###### End Testing Attempts Tried ######

if ($FORM{'r9'} =~ /'r9a'/)
 {
  $Subject eq "WWW Inquiry & Referral - $FORM{'e2'}\n\n";
 }
if ($FORM{'r8'} =~ /'r8a'/)
 {
  $Subject eq "WWW Possible Agent - $FORM{'e2'}\n\n";
 }
if ($FORM{'r9'} =~ /'r9b'/)
 {
  $Subject eq "WWW NON-REFER - $FORM{'e2'}\n\n";
 }
if ($FORM{'e4'} =~ /[\s]?.*(Morgan Hill|Gilroy|San
Martin|Hollister)\s.*/)
 {
  $Subject eq "WWW Local - $FORM{'e2'}\n\n";
 }
if ($FORM{'loc'} =~ /[\s]?.*(Morgan Hill|Gilroy|San
Martin|Hollister)\s.*/)
 {
  $Subject eq "WWW Local - $FORM{'e2'}\n\n";
 }

print "Subject: $Subject\n";  # To test the above only


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

Date: Mon, 08 Sep 1997 22:12:32 -0400
From: David Eck <daveck@top.monad.net>
Subject: Undefined subroutine &main::CgiDie called at util.pl line 75.
Message-Id: <3414B090.3F38434C@top.monad.net>

Hi,
I am using cgi-lib.pl.  I am getting this message wherever I try to call
&CgiDie.
> Undefined subroutine &main::CgiDie called at util.pl line 75.

Can anyone help me?

Driving me crazy.

Please email

Thanks in advance,
David Eck


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

Date: 08 Sep 1997 21:00:38 -0500
From: arenson@hen.imgen.bcm.tmc.edu (Andrew D. Arenson)
Subject: Re: unpack
Message-Id: <wqen6zw8jc.fsf@hen.imgen.bcm.tmc.edu>

Tom Phoenix <rootbeer@teleport.com> writes:

> 
> On 5 Sep 1997, Andrew D. Arenson wrote:
> 
> > 	What happens if you try to unpack something which isn't as
> > big as you think it is?
> > 
> > 	Let's say you do:
> > 
> > 	$newvalue = unpack("L",$value,0,4)
> > 
> > but $value only actually has 2 bytes of data. I think I'm seeing that
> > this causes memory problems in other psuedo-random places in one's script.
> 
> That shouldn't be a problem, but you _may_ have found a bug in Perl. (I
> heard that there was one left. :-)  If you can verify it with a short
> script using the latest version of Perl, run perlbug to file a bug report. 
> Or post it here, and somebody will show you where your mistake is. :-) 
> 
> Thanks! 

Harumph! Go ahead! Steal my thunder! I'd been using perl-5.003. Turns
out that the bug completely dissappears with perl-5.004_01. Them
Perl people, always getting rid of bugs even before you knew you 
had 'em. Oh well. At least we have the latest version of perl now.


Andy

PS The same bug was in perl-5.001m and perl-5.002. 

-- 
Andrew D. Arenson            | http://gc.bcm.tmc.edu:8088/cgi-bin/andy/andy
Baylor College of Medicine   | arenson@bcm.tmc.edu        (713)  H 520-7392
Genome Sequencing Center, Molecular & Human Genetics Dept.     | W 798-4689
One Baylor Plaza, Room S903, Houston, TX 77030                 | F 798-5386


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

Date: Mon, 8 Sep 1997 23:38:41 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: What does "regexp *+ operand could be empty" mean?
Message-Id: <EG7r0I.Btq@bcstec.ca.boeing.com>

In article <3414687D.41C6@lmtas.lmco.com>,
Brett Denner  <Brett.W.Denner@lmtas.lmco.com> wrote:
 > I'm trying to match patterns like this:
 > 
 >   abc = 
 >   abc = 10
 >   abc = 10 20
 >   abc = 10 20 30 (etc.)
 > 
 > When I run this script:
 > 
 >   $_ = 'abc = 10 20 30';
 >   s<\b(abc \s* = \s*) (\d* \s*)*><$1 20>x;
 > 
 > I get the following error message:
 > 
 >   /(abc = )(\d*\s*,?)*/: regexp *+ operand could be empty at (eval 5)
 > line 2, <IN> chunk 2.
 > 
 > What does this mean?  I've looked in the Camel book, and searched the
 > perldiag man page, but had no luck.  Any ideas?
 > 


Your regex has some serious maladies. Since I'm fresh from
J.Friedl's regex talk, I'll hazard a guess that the error message 
is generated by the tautology lurking in the 2nd backreference:

  (\d* \s*)*  

That's because all the quantifers could match nothing at all. In 
other words \d* could match nothing. Ditto for \s* and the whole 
backref. The space between \d* and \s* is the only thing that can't 
be nullified. But even that lone survivor could be eaten by the 
trailing \s* in the first backref. Is it any wonder Perl issues an 
error :) 

At any rate, you can make eliminate the message by quantifying
one or more of the tokens in the 2nd backref with + instead of
*.  Almost certainly though the whole regex needs rewriting. 
Maybe you could elaborate more about what're you're trying
to substitute and someone can suggest a clever solution.  


HTH,
--
Charles DeRykus


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

Date: 9 Sep 1997 02:45:52 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: What does "regexp *+ operand could be empty" mean?
Message-Id: <5v2d90$oan@agate.berkeley.edu>

In article <EG7r0I.Btq@bcstec.ca.boeing.com>,
Charles DeRykus <ced@bcstec.ca.boeing.com> wrote:
> In article <3414687D.41C6@lmtas.lmco.com>,
> Brett Denner  <Brett.W.Denner@lmtas.lmco.com> wrote:
>  >   s<\b(abc \s* = \s*) (\d* \s*)*><$1 20>x;
>  > 
>  > I get the following error message:
>  > 
>  >   /(abc = )(\d*\s*,?)*/: regexp *+ operand could be empty at (eval 5)
>  > line 2, <IN> chunk 2.

> is generated by the tautology lurking in the 2nd backreference:
> 
>   (\d* \s*)*  
> 
> That's because all the quantifers could match nothing at all. In 
> other words \d* could match nothing. Ditto for \s* and the whole 
> backref. The space between \d* and \s* is the only thing that can't 
> be nullified. But even that lone survivor could be eaten by the 
> trailing \s* in the first backref. Is it any wonder Perl issues an 
> error :) 

There is no space between \d* and \s*! ;-)

You overlooked the s<><>x modifier.

Note that this (very useful) message is gone with the latest jumbo RE
patch.  Now Perl can handle (blah)* even if blah is complicated and
can match 0-length string (Perl *could* do it before *in most cases*,
but if it could not, this was a segfault due to stack overflow.  It is
because of this segfault that the message was there).

Cry loudly on p5p if you will long for this message (yes, in most
cases it indicates a pilot error).

Ilya


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

Date: 9 Sep 1997 01:55:59 GMT
From: "Charlie" <charlie@flychina.com>
Subject: Re: Win95 Com Port Programming?
Message-Id: <01bcbcc3$917a7ea0$245ce3c7@flychina>

Frank R. Anderson <frank_a1@sfov1.verifone.com> wrote
> I think I know part of the answer to your question.  You have to
> flush the characters out the port.  Use the library flush.pl and
> use &flush( COM ) or &printflush( COM, "AT" ).  You can also use
> select( COM ); $|=1; to enable the flush.  I'm still not convinced
> that programming comp ports with Perl for Win95 is robust.

Thank you for answering my questions.  After I added the auto-flush
commands, the perl program did send something to the modem.  I then tested
sending a dialing sequence

print COM "ATDT 426-0228\r\n";

but the modem did not attempt to dial.  So I wonder there are still
something wrong even in the writing to the port, not to say about reading
from the port which always hangs.  I also turned the modem's TR always on. 
Still no success.  I guess serial port programming isn't as easy as file
I/O programming.  Line setting, handshake, IRQ etc may need to be handled
as well.

Thanks again for your help, Greg, Frank and Sigurdur.

Charlie Li


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

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

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