[13412] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 822 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 16 17:07:31 1999

Date: Thu, 16 Sep 1999 14:05:12 -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: <937515912-v9-i822@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 16 Sep 1999     Volume: 9 Number: 822

Today's topics:
    Re: better soundex/metaphone? <cassell@mail.cor.epa.gov>
    Re: Can Perl talk to Javascript?? <cassell@mail.cor.epa.gov>
    Re: Closing a pipeline before the command is done (Larry Martell)
    Re: CONTEST: Range Searching (Abigail)
    Re: Critique/comments for web board? <cassell@mail.cor.epa.gov>
    Re: DBD::Sybase not testing correct - help <cfang@nwu.edu>
        Help needed about SENDMAIL! <ysroh@chat.carleton.ca>
    Re: Help needed about SENDMAIL! <makkulka@cisco.com>
    Re: Help with a regular expression <markm@nortelnetworks.com>
    Re: Homeworkers Needed! <cassell@mail.cor.epa.gov>
    Re: How to direct output to /dev/speech <gellyfish@gellyfish.com>
    Re: how to produce a 'beep'? <sjohns17@uic.edu>
    Re: Parsing Tab Delimited File (Abigail)
    Re: Parsing Tab Delimited File (Abigail)
    Re: PERL (cgi) and Databases -> How To? (Abigail)
    Re: Perl, Win32, GetPrivateProfileString sub/module ? <gellyfish@gellyfish.com>
    Re: Please help a newbie! - sorry for the mistake! <gellyfish@gellyfish.com>
    Re: Please help a newbie! <gellyfish@gellyfish.com>
        Problem with open() and probably something else (David Wall)
    Re: Question on Hash of Hash <cfang@nwu.edu>
    Re: references in dbms <cfang@nwu.edu>
    Re: REQ: tell-a-friend script (Abigail)
        slightly offtopic: who know ISPs with mod_perl support? <joern@netcologne.de>
    Re: unpack("%32C*", $text) <makkulka@cisco.com>
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: Thu, 16 Sep 1999 13:45:33 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: better soundex/metaphone?
Message-Id: <37E156ED.3AC1E2E0@mail.cor.epa.gov>

Larry Rosler wrote:
> 
> In article <37E033F4.66B01DF0@mail.cor.epa.gov> on Wed, 15 Sep 1999
> 17:04:04 -0700, David Cassell <cassell@mail.cor.epa.gov> says...
> ...
> > It will be more complex than this.  Consider whether you want
> > to then catch singular vs plural on your nouns.  Then make sure
> > you can handle:
> 
> Dangerous territory, man!

Indeed.  In fact, the point I was trying to make.
 
[snip]
> > octopus vs octopi
> 
> octopodes (Greek, not Latin)

If you want the classical plural instead of the common one..
or if you want to properly pluralize the word 'octopod'.
 
[more snipping]
> > formula vs formulas vs formulae
> 
> Any of the words above (except 'ox' or 'genus') can now be pluralized by
> 'normal' English inflection, so 'formulas' is not unique.

Good point.

> And there are tons more:
[snip of the list]
> I'm sure TomC has extensive lists.

I suspect so.  In fact, the short list I threw was taken from
my memory of his section in the Perl Cookbook on pluralization.

My point was only that there are many odd cases which the poster
was going to handle if he/she wanted to do the described task,
and that it wasn't as easy as it might seem at first glance.
Your examples hammer that home effectively.
 
How is it that we both omitted this one, or one like it:
goy vs goyim
Hasn't that slipped into the English vernacular? :-)


David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Thu, 16 Sep 1999 14:01:43 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Can Perl talk to Javascript??
Message-Id: <37E15AB7.C462A5C9@mail.cor.epa.gov>

Steven Smolinski wrote:
> abigail@delanet.com (Abigail) writes:
> > wolflake (wolflake@xxorn.net) wrote on MMCCVI September MCMXCIII in
> 
> > Of course, if JavaScript program is being run inside a wowser, you need to
> > figure out how to communicate with the wowser, not to JavaScript directly.
> 
> I know I'll regret this, but I cannot resist.  I'm familiar with the
> unfortunately-named "browser" family of applications; however, I've not
> encountered a "wowser."  What is such a beast?

It obviously is the browser written by Inspector Gadget.

Either that, or it is a popular browser written to be flashy
instead of conformant with the specs.  Not to name names, but
the usual suspects have initials which stand for Nyetscape
Nauseator and Internet Exploder.

HTH,
David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Thu, 16 Sep 1999 20:23:03 GMT
From: larrym@imsi.com (Larry Martell)
Subject: Re: Closing a pipeline before the command is done
Message-Id: <7rrjiv$2e1@titan.imsi.com>

In article <FI4H2u.Gpr@news.boeing.com>,
Charles DeRykus <ced@bcstec.ca.boeing.com> wrote:
>In article <7rmop3$s46@titan.imsi.com>, Larry Martell <larrym@imsi.com> wrote:
>>I have a script that opens a pipeline, and then when it sees a specific string
>>it's done with the output of that command. It does some processing, and
>>then issues another command. When it see the string that signals it's done
>>the command is not completed, but I don't care about the rest of the output.
>>
>>Initially I issued a close(PIPE) when I saw the string, but that hung. I
>>then captured the pid of the command and sent it a SIGKILL when I was done.
>>That worked as far as my script was concerned, but when it exited I found that
>>I had all these invocations of the command still hanging around.  (It issues
>>many of them.)
>>
>>I found that 2 processes actually get started, and I only get back the pid of 
>>the parent. I kill that, but the child stays around forever.
>>
>>For example, if I issue the statement:
>>
>>$pid = open(TICK, "mycmd |");
>>
>>and I do a ps I see:
>>
>>larrym    3462  0.0  1.3 1540  744 p0 S    19:36   0:00 mycmd
>>larrym    3461  0.0  0.0   28    0 p0 IW   19:36   0:00 sh -c mycmd
>>
>>The pid I get back is 3461, which does go away when I send the kill, but
>>3462 does not. As I said, even after the script exits, 3462 is still around.
>>
>>Is there a clean way I get get rid of these processes? I can't really do a
>>ps and grep for them because there may be other invocations running that are
>>not mine that I don't want to kill.

>One possibility, although not portable, is a negative 
>signal to kill process groups. See perldoc -f signal.

That didn't work for me at all (I'm running SunOS 4.1.4). Sending a negative
signal did not kill anything.

>Probably a better way is to let the piped program overlay 
>the shell Perl launches:
>
>  $pid = open(TICK, "exec mycmd |");

This worked great. Only one process was invoked, and I was able to kill it
when I was done with it.

>hth,

Tremendously! Thanks!

-larry


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

Date: 16 Sep 1999 16:03:57 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: CONTEST: Range Searching
Message-Id: <slrn7u2mus.vd4.abigail@alexandra.delanet.com>

Tom Christiansen (tchrist@mox.perl.com) wrote on MMCCVII September
MCMXCIII in <URL:news:37e1043e@cs.colorado.edu>:
<> 
<> So here's the challenge: devise idiomatic solutions to the
<> following problems.  
<> 
<>     1) Write a "patfore" program that prints out up to N lines
<>        before the match as well as the match itself.  Here's
<>        the usage message:
<> 
<> 	    patfore [-B N] pattern [files ...]

If the match appears on line N + 3, does that mean one has to print
lines 1 .. N, and line N + 3, or lines 3 .. N + 3?

What if there's no match at all?



Abigail
-- 
sub camel (^#87=i@J&&&#]u'^^s]#'#={123{#}7890t[0.9]9@+*`"'***}A&&&}n2o}00}t324i;
h[{e **###{r{+P={**{e^^^#'#i@{r'^=^{l+{#}H***i[0.9]&@a5`"':&^;&^,*&^$43##@@####;
c}^^^&&&k}&&&}#=e*****[]}'r####'`=437*{#};::'1[0.9]2@43`"'*#==[[.{{],,,1278@#@);
print+((($llama=prototype'camel')=~y|+{#}$=^*&[0-9]i@:;`"',.| |d)&&$llama."\n");


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Thu, 16 Sep 1999 13:59:22 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Critique/comments for web board?
Message-Id: <37E15A2A.118B1F93@mail.cor.epa.gov>

David Wall wrote:
> 
> In article <7rnome$ho2@dfw-ixnews19.ix.netcom.com>, ebohlman@netcom.com (Eric Bohlman) wrote:
> >David Wall (darkon@one.net) wrote:
> >: So...  comments, anyone?

[skip of concurrency problem]

> >2) You're using symbolic references just to reduce typing.  This is a
> >false economy.  Use a hash instead, and use strict.
[snip]
> What's so bad about symbolic references?  [Time passes while I look it up in
> the Camel]  Hmm, I suppose I could accidentally mix up a hard and a symbolic
> reference, and then have one hell of a time figuring out the bug, eh?

If you want to know what's so bad about symbolic references,
go to Mark-Jason Dominus' webpage on the subject.  You can
find it by searching at www.perl.com, I think.

Oh what the heck, I have his homepage bookmarked.  Look at
http://www.plover.com/~mjd/perl/#varvarname .

> Someone else suggested 'use strict' in an email message.  I plan to follow
> that suggestion, but I about half expect perl will barf all over the place the
> the first time I run it.  :-)  One of the things I really liked about Perl
> when I first started playing with it is the ability to use a variable without
> declaring it first.  Now it seems that even though I CAN do that, it's not
> good practice to do so.  Sigh....

Well, you knew that already.  Using -w and 'use strict;' even
in my short programs prevents me from debugging for ten minutes
when the problem is fat-fingering.  Learn about using 'use vars'
to get around lots of annoying individual declarations.

> >3) You could use here-document syntax in a lot more places than you
> >presently are.
> 
> Yeah, I sure could.  More false laziness, I guess.  I'm never sure which is
> uglier, here-documents, or all those backslashes in print statements.  I like
> here-documents, but they screw up the indenting of my code.

Take a look in The Perl Cookbook for a variety of ways to
use here-docs while maintaining your indenting.

> Thanks!  I appreciate the time and comments!

A nice attitude.  Many people who ostensibly want some
comments get pretty irate when posters find more faults
than anticipated.  Good luck.

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Thu, 16 Sep 1999 15:44:46 -0500
From: "Chao Fang" <cfang@nwu.edu>
Subject: Re: DBD::Sybase not testing correct - help
Message-Id: <7rrl1f$40q@news.acns.nwu.edu>

I installed DBD::Oracle on my SparcStation 5 last week. I got plenty of
errors on 'make test' too. But I find not all subsets are necessary. I
installed it anyway, it works. At least those basic SQL command that I am
using.

Try a newer Perl and DBD, DBI (you installed it, right?) and read trouble
shooting carefully.


<sparky21@my-deja.com> wrote in message news:7rr9ce$la4$1@nnrp1.deja.com...
> The make works, but when I do the make test I get:
>
>
> Running make test
> PERL_DL_NONLAZY=1 /usr/local/bin/perl -Iblib/arch -Iblib/lib
> -I/usr/local/lib/perl5/5.00502/sun4-solaris
> -I/usr/local/lib/perl5/5.00502 -e 'use Test::Harness qw(&runtests
> $verbose); $verbose=0; runtests @ARGV;' t/*.t
> t/autocommit........install_driver(Sybase) failed: Panic: clientmsg_cb:
> Can't find handle from connection at
> /usr/local/lib/perl5/5.00502/sun4-solaris/DynaLoader.pm line 187.
>
>  at t/autocommit.t line 40
> dubious
>         Test returned status 2 (wstat 512, 0x200)
> DIED. FAILED tests 2-4
>         Failed 3/4 tests, 25.00% okay
> t/base..............install_driver(Sybase) failed: Panic: clientmsg_cb:
> Can't find handle from connection at
> /usr/local/lib/perl5/5.00502/sun4-solaris/DynaLoader.pm line 187.
>
>  at t/base.t line 18
> dubious
>         Test returned status 2 (wstat 512, 0x200)
> Undefined subroutine &Test::Harness::WCOREDUMP called at
> /usr/local/lib/perl5/5.00502/Test/Harness.pm line 288.
> *** Error code 2
> make: Fatal error: Command failed for target `test_dynamic'
>   /usr/ccs/bin/make test -- NOT OK
> Running make install
>   make test had returned bad status, won't install without force
>
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.




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

Date: 16 Sep 1999 20:02:32 GMT
From: Young-Soo Roh <ysroh@chat.carleton.ca>
Subject: Help needed about SENDMAIL!
Message-Id: <37E14DFC.90363DA7@chat.carleton.ca>

Hello everyone?

Is anybody know how to attach the file(ex. postscript) using sendmail?
I am trying to send email using sendmail in Perl.
ex)
open(MAIL, "|/usr/lib/sendmail -t");
print MAIL "To: xxx";
print MAIL "Subject:xxx";

But I don't know how to attatch the file.

Please help..

Thanks in advance..



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

Date: Thu, 16 Sep 1999 13:22:27 -0700
From: Makarand Kulkarni <makkulka@cisco.com>
Subject: Re: Help needed about SENDMAIL!
Message-Id: <37E15183.1BF07919@cisco.com>

[ Young-Soo Roh wrote:

> Is anybody know how to attach the file(ex. postscript) using sendmail?
> But I don't know how to attatch the file.

You content type should be multipart/mixed and the parts should be
separated
with a separator (what else). Something like I show below --
--
#!/usr/local/bin/perl5 -w
use FileHandle;
my $fh = new FileHandle  "attachment.txt" , "r"  || die "Cannot open the
file \n" ;
        open ( MAIL, "| /usr/lib/sendmail -t" ) || die " Tragic Death !.
Heck with Sendmail " ;
        print MAIL "To:makkulka\@cisco.com\n" ;
        print MAIL "MIME-Version: 1.0\n" ;
        print MAIL "Content-Type: multipart/mixed;
boundary=\"gc0y0pkb9ex\"\n";
        print MAIL "\n--gc0y0pkb9ex\n" ;
        print MAIL "Content-type: text/plain; charset=\"iso-8859-1\";\n";
        print MAIL " this is the message content \n" ;
        print MAIL "\n--gc0y0pkb9ex\n" ;
        print MAIL "Content-type: text/plain; charset=\"iso-8859-1\"\n";
        print MAIL "Content-Disposition:
attachment;filename=\"attachment.txt\"\n\n";
        while  (<$fh>) { print MAIL; } ; # attach content of attachment.
        $fh->close;
        print MAIL "\n--gc0y0pkb9ex\n" ;
        print MAIL "\n--gc0y0pkb9ex--\n" ;
        close(MAIL) ;
--




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

Date: 16 Sep 1999 16:21:36 -0400
From: Mark Mielke <markm@nortelnetworks.com>
Subject: Re: Help with a regular expression
Message-Id: <lq1vh9ali9b.fsf@bmers31f.ca.nortel.com>

Chris Koharik <koharik@primenet.com> writes:
> > Date: Thu, 16 Sep 1999 18:48:32 GMT
> > From: Kragen Sitaker <kragen@dnaco.net>
> > In article <Pine.BSI.3.96.990916102741.19323C-100000@usr05.primenet.com>,
> > Chris Koharik  <koharik@primenet.com> wrote:
> > >foreach (@strings) {
> > >  print STDOUT "$_\n";
> > You can just say print "$_\n", or print $_, "\n" if you like.
> Another habit I've picked up because I usually have several file handles
> being used.  One more you forgot to mention is print $_ . "\n"

Both '"$_\n"' and '$_."\n"' will actually perform slower, as an additional
"concatenation" operation is required.

There is NO problem with specifically writing STDOUT. The only benefit
to "leaving it out" is that it can then be easily changed using select().

It's not a bad habit, it's just unnecessary. If you prefer to write
it out in full, then by all means go right ahead. (Sometimes writing
it out in full is actually more _accurate_, for instance if select()
points you to some other file handle...)

> > >  $_ =~ s/.*\//$newsrc/;
> > s/// operates on $_ by default; no need for the $_ =~.
> Bad habit 3.  But it never hurts to be specific.  Makes it a bit more
> readable to someone who is having problems. <--lame excuse

It's not a bad habit, it's just unnecessary. If you prefer to write
it out in full, then by all means go right ahead. (i.e. ditto)

mark

-- 
markm@nortelnetworks.com/mark@mielke.cc/markm@ncf.ca __________________________
 .  .  _  ._  . .   .__    .  . ._. .__ .   . . .__  | CUE Development    (4Y21)
|\/| |_| |_| |/    |_     |\/|  |  |_  |   |/  |_   | Nortel Networks
|  | | | | \ | \   |__ .  |  | .|. |__ |__ | \ |__  | Ottawa, Ontario, Canada

  One ring to rule them all, one ring to find them, one ring to bring them all
                       and in the darkness bind them...

                           http://mark.mielke.cc/


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

Date: Thu, 16 Sep 1999 14:03:55 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Homeworkers Needed!
Message-Id: <37E15B3B.5893BC03@mail.cor.epa.gov>

mowhco@att.net wrote:
> 
> Dear Future Associate,
> 
> You Can Work At Home & Set Your Own Hours.  Start earning Big
> Money in a short time
> 
>                                     NO Newspaper Advertising!
> 
> Your job will be to stuff and mail envelopes for our company. You
> will receive $.25 for each and every envelope you stuff and mail
> out.
[major snip]

Wow!  And I've been wasting my time doing statistics and
computer programming!  D'OH!

Anyone else who saw this should feel free to write to
    abuse@nero.net
and complain, as I already did.

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: 16 Sep 1999 20:57:29 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: How to direct output to /dev/speech
Message-Id: <7rrljp$jg$1@gellyfish.btinternet.com>

On Thu, 16 Sep 1999 18:47:35 GMT David wrote:
> When is the correct format for redirecting a variable's contents to
> /dev/speech?   or a sound file to /dev/audio?

You can open these devices just the same as any other file if you
have permission to do so and then you can simply print to them.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: Thu, 16 Sep 1999 14:43:16 -0500
From: Seth David Johnson <sjohns17@uic.edu>
Subject: Re: how to produce a 'beep'?
Message-Id: <Pine.A41.4.10.9909161437260.540132-100000@tigger.cc.uic.edu>

On 16 Sep 1999, Tom Christiansen wrote:

> In comp.lang.perl.misc, 
>     Nick Lee <leenick@interchange.ubc.ca> writes:
> :I guess the title explains itself. My question is: how to produce a
> :beep from a perl program?
> 
>     use Curses;
>     initscr();
>     beep();
>     endwin();

What about simply:

print "\a";

-Seth



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

Date: 16 Sep 1999 15:23:32 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Parsing Tab Delimited File
Message-Id: <slrn7u2kj1.vd4.abigail@alexandra.delanet.com>

Tom Christiansen (tchrist@mox.perl.com) wrote on MMCCVII September
MCMXCIII in <URL:news:37e0f584@cs.colorado.edu>:
 ..      [courtesy cc of this posting mailed to cited author]
 .. 
 .. In comp.lang.perl.misc, 
 ..     "Samuel Kilchenmann" <skilchen@swissonline.ch> writes:
 .. :Neither regexps nor split are particularly useful for simple things like
 .. :parsing csv files, so this extension module is exactly the right thing
 .. :to use.
 .. 
 .. You misstate yourself. Regexps and split certainly are 
 .. useful for simple data parsing, as seen in 
 .. 
 ..     @fields = split(' ', $line);
 ..     @pwent  = split(/:/, $line, -1);
 .. 
 .. Or even for complex files like termcap:
 .. 
 ..     while (<>) {
 .. 	next if /^(#.*)?\s*$/;			# comments
 .. 	$_ .= <> while s/\\$// && !eof;		# continuations
 .. 	@fields = split /:(?:\s*:)*/;		# colon-separated w/glitch
 .. 	printf "%d fields in %s\n", 0+@fields, $fields[0] =~ /^([^|]+)/;
 ..     }
 .. 
 .. 
 .. In a sane world, where "comma-separated values" actually happens to mean
 .. the remarkably surprising "comma-separated values", this is all it takes:
 .. 
 ..     @fields = split(/,/, $line, -1);
 .. 
 .. You'll notice that this approach also suffices for the passwd file, etc. 
 .. Those were designed for simplicity.

On the expense of usefullness. You can't for instance put a ':' in a
comment in the password file. Now, for special purpose things like termcap
file, and even password files, that's acceptable. 

For a general format, where you don't want to make restrictions on what
characters can be stored in your dataset, yet you do want to have a
simple, portable exchange format, foo-separated without the ability to
escape foo just doesn't work.

 .. However, programmer-hostile systems seem riddled with programmer-hostile
 .. files mis-designed by evil and stupid sado-masochistic programmers who
 .. should have all their fingernails torn out, very slowly.  No thought
 .. is given to simplicity of parsing, which means you get something
 .. that is *not* simple to parse.  Do not call things so-called "CSV
 .. files" simple, because if they were, then a split would suffice.

Bullocks. If a split would suffice, the format is too restrictive. CSV files
aren't there to satisfy the programmer. They are there for the user. And if
a programmer complains it's too hard to parse them - boohoo, fire him, and 
get a better programmer.

 .. It doesn't, so they aren't.  And they're hardly "comma-separated".
 .. They're "quasi-comma-separated with inane hacks and idiosyncrasies
 .. bearing only a superficial and conquently deceptive resemblance to actual
 .. comma-separated data".

Too make them useful. Other techniques could have been used as well, but
then you still won't be able to parse them with just a split.



Abigail
-- 
echo "==== ======= ==== ======"|perl -pes/=/J/|perl -pes/==/us/|perl -pes/=/t/\
 |perl -pes/=/A/|perl -pes/=/n/|perl -pes/=/o/|perl -pes/==/th/|perl -pes/=/e/\
 |perl -pes/=/r/|perl -pes/=/P/|perl -pes/=/e/|perl -pes/==/rl/|perl -pes/=/H/\
 |perl -pes/=/a/|perl -pes/=/c/|perl -pes/=/k/|perl -pes/==/er/|perl -pes/=/./;


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 16 Sep 1999 15:28:59 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Parsing Tab Delimited File
Message-Id: <slrn7u2kt9.vd4.abigail@alexandra.delanet.com>

Tom Christiansen (tchrist@mox.perl.com) wrote on MMCCVII September
MCMXCIII in <URL:news:37e11a5f@cs.colorado.edu>:
--      [courtesy cc of this posting mailed to cited author]
--
-- In comp.lang.perl.misc, 
--     kragen@dnaco.net (Kragen Sitaker) writes:
-- :>Those were designed for simplicity.
-- :
-- :It's not a general-purpose data format, though; you can't store commas
-- :in its fields.
--
-- And a C string is not a general purpose data format because
-- you can't use nulls in it.  Well, perhaps, but we seldom
-- care.  The normal thing is to use an alternate representation.

Hmm. Then why did Larry decide to do it different in Perl?

-- :>No thought
-- :>is given to simplicity of parsing, which means you get something
-- :>that is *not* simple to parse.  Do not call things so-called "CSV
-- :
-- :"things like"?
--
-- This is not CSV:
--
--     this,"peter, paul, and mary",jane
--     this,"peter, paul, and mary","jane"
--     this,"peter, paul, and mary",'jane''s game',here
--
-- Because any xSV can be processed with split /x/.  Those are 
-- just screwed up idiocies.  I hate them.  They were designed
-- by someone who didn't design.

Like the people designing shells, where whitespace separates arguments,
except inside quotes, or when backwacked?

-- None of that crap is present in any of the Unix colon-separated data
-- formats.  You don't have the quote crap.  And even if you have colons
-- in your fields, you simply do something like:
--
--     for (@fields = split /:/) { s/\\0(\d+)/ord $1/ge }


Which means, a split no longer sufficies. And you'd have to escape
all your \0\d+ present in the data. And it makes it very hard to read,
and/or hand edit.



Abigail
-- 
$" = "/"; split // => eval join "+" => 1 .. 7;
*{"@_"} = sub {foreach (sort keys %_) {print "$_ $_{$_} "}};
%_ = (Just => another => Perl => Hacker); &{%_};


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 16 Sep 1999 15:50:35 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: PERL (cgi) and Databases -> How To?
Message-Id: <slrn7u2m5q.vd4.abigail@alexandra.delanet.com>

Jon S. (jonceramic@nospammiesno.earthlink.net) wrote on MMCCVII September
MCMXCIII in <URL:news:37e0fdc8.2974524@news.earthlink.net>:
{} On 15 Sep 1999 21:52:08 -0500, abigail@delanet.com (Abigail) wrote:
{} >Do you however not
{} >need your ISP to install modules, but you knew that, because you
{} >read the FAQ, didn't you?
{} 
{} Abigail, I too am a newbie working on this, and, given the immense
{} numbers of FAQs, I haven't been able to find this one yet.
{} 
{} Can you direct me to where I should look?  Is it in the FAQs at
{} www.perl.com?


No. It's the FAQs that come with Perl.  "man perlfaq".

But you knew that, didn't you, because you read the main perl manpage,
didn't you?



Abigail
-- 
               split // => '"';
${"@_"} = "/"; split // => eval join "+" => 1 .. 7;
*{"@_"} = sub {foreach (sort keys %_)  {print "$_ $_{$_} "}};
%{"@_"} = %_ = (Just => another => Perl => Hacker); &{%{%_}};


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 16 Sep 1999 21:00:43 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Perl, Win32, GetPrivateProfileString sub/module ?
Message-Id: <7rrlpr$jl$1@gellyfish.btinternet.com>

On 15 Sep 1999 22:36:43 GMT A.Warnier wrote:
> 
> Although it would probably be a breeze for any of the gurus that post in this 
> group, it wouldn't for me, and I am being lazy (which I read somewhere is a 
> quality of Perl programmers).
> So, does anyone know of an existing module or sub that emulates the Windows 
> GetPrivateProfileString routine (parse an INI file) ?
> 

Possibly one of the Win32::* modules will encapsulate this API - This will
be preferable as it might not actually be an .ini file but the registry
you are looking at.  Although alternatively you can use the module IniConf
available from CPAN.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: 16 Sep 1999 21:23:25 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Please help a newbie! - sorry for the mistake!
Message-Id: <7rrn4d$jr$1@gellyfish.btinternet.com>

On Thu, 16 Sep 1999 07:56:52 GMT makau@my-deja.com wrote:
> <Larry Rosler Wrote but not cited>
>
>> But still worth improvement.
>> You certainly didn't test it at all before posting it.
> 
> Yep, i didn't.
> I thought it would work.
> But seems it doesn't? :-(
> 

If there's one thing that I have learned it is that almost any untested
code will not work when you post it to this group - of course I'm sure
that this doesnt happen if you post to alt.perl ;-}

>> WHY, oh why, do you quote the whole article, *after* your response to
>> it?
> 
> 1- The more interesting part is the reply, NOT the former post.
> 2- Because it takes on one's nerves to scroll the original post down to
> the reply (when the original post is indeed put before the reply).
> 
> Ain't I right?
> 

Nope.  The interesting part is your response to the points in the post
to which you are responding - to most logical people it makes more sense
when they can see the specific parts to which you are responding.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: 16 Sep 1999 21:12:51 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Please help a newbie!
Message-Id: <7rrmgj$jo$1@gellyfish.btinternet.com>

On Thu, 16 Sep 1999 00:11:59 GMT Kragen Sitaker wrote:
> In article <7rp3l6$10j$1@gellyfish.btinternet.com>,
> Jonathan Stowe  <gellyfish@gellyfish.com> wrote:
>>On Wed, 15 Sep 1999 18:06:12 GMT Kragen Sitaker wrote:
>>> Oh yes, I forgot to flame about this.  Whoever defined this mm/dd/yy
>>> format for storing your data should be taken out and shot in 01/01/00.
>>
>>Why ?
>>
>>I for one have no way of knowing whether this will cause a problem or
>>whether '01/01/00' will be ambiguous (as to the year) within the context
>>of the dataset it comes from.
> 
> It's a trap.  Different people will write programs that will
> disambiguate the year in different ways.

The context of the dataset might not cause this to be ambiguous - to say
that a fully qualified year *must* be used to prevent ambiguity in all
data is mere dogma IMO.  There may be no need to disambiguate the data
whatsoever if the life cycle of the data allows of no amibiguity.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: Thu, 16 Sep 1999 20:41:54 GMT
From: darkon@one.net (David Wall)
Subject: Problem with open() and probably something else
Message-Id: <37e15620_1@news2.one.net>

I recently posted a request to have people critique a simple bbs script I 
wrote. (http://w3.one.net/~darkon/darkboard)(and free on the odd chance 
someone might like it)  Among a number of useful suggestions was one major 
thing I thought I should fix first before tackling the rest.  The problem was 
that I opened a file, read from it, closed it, and then reopened it for 
writing.  I locked it each time, but of course in the interval between the 
close and the second open() another copy of the program could rewrite the 
file.

As a first step, I commented out the first close(), the second open(), and 
changed the first open to read/write access instead of read-only.  The code 
now looks like this:

sub GetIndex {
   my ($id, $subject, $name, $email, $date, $replies, $replyto);
   open MSGS, "+<$dir/$dbname" or die("Cannot open $dir/$dbname for 
reading/writing: $!\n");
   flock MSGS, 2  unless $nolock;
   my @lines = <MSGS>; # slurp in the file
   # if ($closeDB eq 'close') { close MSGS or die("Error closing $dbname: 
$!\n");}
   # other data processing here...... (read data into hash, etc)
   }
} 

sub WriteIndex {
   my $id;
   # open MSGS, ">$dir/$dbname" or die("Cannot open $dir/$dbname for writing: 
$!\n");
   #flock MSGS, 2  unless $nolock;
   truncate MSGS, 0;
   # stuff to print the data to the file.....
   }
   close MSGS or die("Error closing $dbname: $!\n");
} 

For some reason I don't understand, the MSGS file ends up completely blank!  
Can't I open a file in one subroutine and expect to use the same filehandle in 
another subroutine?  I've certainly done it before.....

The only other thing I can think of is that both of the above functions are in 
a file that I pull into my main program with 'require'.  

I've probably done something that I'll feel silly about once I see it, but for 
now I'm still running in circles wondering why it doesn't work....  :-)

David Wall
darkon@one.net


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

Date: Thu, 16 Sep 1999 15:37:40 -0500
From: "Chao Fang" <cfang@nwu.edu>
Subject: Re: Question on Hash of Hash
Message-Id: <7rrkk4$3pd@news.acns.nwu.edu>


<namnan@my-deja.com> wrote in message news:7rr8v7$ku3$1@nnrp1.deja.com...
> I am trying to print my hash of hash of the following code.  It is not
> printing anything.
Common phenomina when playing with hash of hash. there is problem with
dereference.

> foreach $cookie (keys (%hash))
> {
> print "$cookie, $hash->{$cookie}";
> }
Try to use print "$cookie, $$hash{$cookie}";
I am not sure it works, but I think it is how it will be solved. when
playing with hash of hash, you need more layers of $, @, % also.


>
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.




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

Date: Thu, 16 Sep 1999 15:29:18 -0500
From: "Chao Fang" <cfang@nwu.edu>
Subject: Re: references in dbms
Message-Id: <7rrk4e$3m5@news.acns.nwu.edu>

How about the following script, which create a multilayer hash, each element
is a reference to next hash.

$items = {};   # create a empty hash
@key = ... put your keys here;

for ($i=0; $i<$numOfLayer; $i++) {

        # when the record does not exist
        $$items{$key[$i]} = {} if (!$$items{$key[$i]});

        # otherwise
        $items = $$items{$key[$i]};
}


Todd Smith <todds@infotraxsys.com> wrote in message
news:7rr919$kue$1@nnrp1.deja.com...
> I'd like to store complicated data structures, such as lots of
> references inside references, into a db file. Is there any way to do it?
>
> --
> --
> ---------------------
> Todd Smith - japh
> Perl Programmer, InfoTrax
>
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.




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

Date: 16 Sep 1999 15:56:09 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: REQ: tell-a-friend script
Message-Id: <slrn7u2mg7.vd4.abigail@alexandra.delanet.com>

chetohevia@my-deja.com (chetohevia@my-deja.com) wrote on MMCCVII
September MCMXCIII in <URL:news:7rr7jl$jth$1@nnrp1.deja.com>:
`` 
`` I can indeed use  $ENV{HTTP_REFERER} (pls. note-- this is a PERL
`` variable, in PERL syntax, making this a PERL question) to access the
`` referring page's URL, but--as you said-- only if that variable exists,
`` which is not the case when a page is accessed in any other way than
`` click-through.
`` 
`` my CGI tutorials, PERL tutorials, Deja.com searches, c|net searches, FAQ
`` searches, calls to friends, etc. yielded no more sure way to access a
`` previous page than the referer--in PERL.(javascript *can* do it with the
`` window.parent and history objects, and i'm pretty much resigned to
`` teaching myself javascript this week in order to do it)
`` 
``  what I want to know is this-- can perl be used to access a parent
`` window's url or the browser history object?  yes, i'm working on a CGI-
`` based web application, but **i'm doing it in perl**.  so, can I ask a
`` perl question here? can perl access a parent window/history object's URL,
`` and if so, how?

You are awfully mistaken. You are doing this *WITH A COMPUTER*. A computer
is an *INANIMATE THING*. Inanimate things are *DEAD*. Please ask your
question in alt.dead.



Abigail
-- 
perl -we '$@="\145\143\150\157\040\042\112\165\163\164\040\141\156\157\164".
             "\150\145\162\040\120\145\162\154\040\110\141\143\153\145\162".
             "\042\040\076\040\057\144\145\166\057\164\164\171";`$@`'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Thu, 16 Sep 1999 22:35:42 +0200
From: Joern Reder <joern@netcologne.de>
Subject: slightly offtopic: who know ISPs with mod_perl support?
Message-Id: <37E1549E.C5DEDF3F@netcologne.de>


Hi,

I'm looking for a good internet provider for our uncommercial german
satire magazine ZYN! (http://www.zyn.de/). We developed a completely
mod_perl and MySQL based content management system and are preparing to
relaunch the site, but our provider is unable to support this
configuration (although he told us so for months...).

Apparently this is not an easy task, because I asked many providers
(most of the list posted on www.apache.org), but either they are too
expensive or incapable of installing mod_perl! :(

Does anyone know ISPs who offer this features:

- Unix System (eg. Solaris, Linux, BSD)
- virtual account with full ftp/telnet/ssh access
- min. 200 MB disk space
- no additional charge for data transfer
  (actually about 10-15GB / month, 30GB peak)
- Apache 1.3.x with builtin Perl 5.004_04 (or better)
  Support (mod_perl), administrated by us
- MySQL database 3.21 or better, administrated by us
- unlimited number of POP3/SMTP mailboxes, administrated by us
- possibility to install additional software (e.g. Majordomo,
  Perl modules, etc.)
- location of server preferable in USA or Canada

Costs of about 150$ per month would be OK.

Thanks,

Joern 

-- 
#!/usr/bin/perl     -- Joern Reder --     mailto:joern@netcologne.de
&_,s~(.)~chr(1^ord($1))~eg;sub _{$_=q;%}<0:%^<857790311,uhld:gns):;.
q+:(z)%^=1(`oe!%^<1:Au<mnb`muhld)%^(:qshoug!#x3j>!$ei-!$el-!$er!!]+.
q/s#-%^.2711-%uZ0\-%uZ1\:,,%^:rmddq!0|/}eval# http://www.zyn.de/y2k/


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

Date: Thu, 16 Sep 1999 13:04:36 -0700
From: Makarand Kulkarni <makkulka@cisco.com>
Subject: Re: unpack("%32C*", $text)
Message-Id: <37E14D54.B227DDB1@cisco.com>

[andy_muscat@my-deja.com wrote:

> Does anyone know what the C/C++ version of unpack("%32C*",$text) would
> be?
> I want to produce a checksum for a piece of text in C++ to mimic the way
> it is done in a Perl script. The perl is
> $checksum  = unpack ("%32C*",$text);

(1)There is a program which you can get here.
http://www.cps.msu.edu/~leekukji/cps422/checksum.html
I have not used or tested this program.

(2)Utilities sum and cksum on unix can do this.
--




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

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

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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu. 

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


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