[11989] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5589 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu May 6 22:07:18 1999

Date: Thu, 6 May 99 19:00:25 -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           Thu, 6 May 1999     Volume: 8 Number: 5589

Today's topics:
    Re: ASCII databases <design@raincloud-studios.com>
        Cute Perl code (Sean McAfee)
    Re: DATE PROBLEM (Larry Rosler)
    Re: deleting files <ebohlman@netcom.com>
    Re: Editing a file "in-place" <emschwar@rmi.net>
    Re: Extracting Emails from TXT #2 (Tad McClellan)
    Re: Extracting Emails from TXT (Tad McClellan)
    Re: FAQ 1.3: Which version of Perl should I use? <ebohlman@netcom.com>
    Re: Frames in Perl Script <juex@my-dejanews.com>
    Re: Help w/ unique script!! <uri@sysarch.com>
    Re: how to round off numbers? <hunt@queen.es.hac.com>
    Re: how to round off numbers? <hunt@queen.es.hac.com>
    Re: how to round off numbers? <cassell@mail.cor.epa.gov>
    Re: how to round off numbers? (Tad McClellan)
    Re: How to use multi dimensional array in Perl <cassell@mail.cor.epa.gov>
    Re: Increment a variable's name (Tad McClellan)
        Maintaining File Timestamps <jalil@corp.home.net>
    Re: Maintaining File Timestamps (Larry Rosler)
    Re: Modulo <cassell@mail.cor.epa.gov>
        Newbie with a question about a pricing form <mgeusenet@usa.net>
    Re: OReilly bullshit.... Camel logo trademark <whm10@amdahl.com>
    Re: Pentium III Chips Released with IDs - Intel won't b (Andrew L. Peterson)
    Re: PERLFUNC: binmode - prepare binary files on old sys (Larry Rosler)
        Problem with s/foo \|\s// <design@raincloud-studios.com>
    Re: Problem with s/foo \|\s// <design@raincloud-studios.com>
    Re: Problem with s/foo \|\s// (Larry Rosler)
    Re: Q: checking wheather the user exists <uri@sysarch.com>
    Re: RegExp Help Please (Tad McClellan)
    Re: syswrite() lies (Sam Holden)
    Re: syswrite() lies (Tad McClellan)
    Re: syswrite() lies (Larry Rosler)
    Re: The Perl Index Project (Robert White)
        user-defined regex problem <pvorishatesspam@earthlink.net>
    Re: user-defined regex problem (Larry Rosler)
    Re: Using 'Require' in ASP <jalil@corp.home.net>
    Re: Which HTTP module for extracting tags? <ebohlman@netcom.com>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Fri, 07 May 1999 01:09:15 GMT
From: "Charles R. Thompson" <design@raincloud-studios.com>
Subject: Re: ASCII databases
Message-Id: <%2rY2.2267$iu1.1972@news.rdc1.tn.home.com>

>What would people recommend the upper limit for a tabdelimited text file
>database? 100k? 1meg? Was wanting to do a searchable events calendar and was
>wondering if it would be smart to do it with a flatfile dbase.


I remember asking this awhile back. If I remember right, it all depended on
the application itself. It may have been one of the Frequest Posters (I can't
remember) who mentioned using files well over 1 meg and it was a normal thing
to do for them. On the technical side, I'd say it would be a combination of
the machine, memory, traffic, (your code) , the availability of other DB
choices like SQL, Oracle, etc. that made the actual determination.

I myself use flat files for small online databases of store inventory, etc.
This of course takes place on web servers with virtual hosting, something alot
of the guys here don't really fiddle with. They do the more heavy duty stuff.
:)

On our servers there is a constant flow of users and web traffic
considerations in mind I try to keep the files under 100k. I am probably being
overly cautious with that, but I've always had good feedback on the speediness
of transfers and updates, etc.  If I had a dedicated server, or was in a LAN
situation I wouldn't think twice about going a great deal larger.

$0.02

CT




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

Date: Fri, 07 May 1999 00:13:30 GMT
From: mcafee@waits.facilities.med.umich.edu (Sean McAfee)
Subject: Cute Perl code
Message-Id: <KeqY2.3$Bd.1757@news.itd.umich.edu>

use DBI;
$dbh = DBI->connect(...);

 ...

sub insert_row {
    local *record = shift;
    local @keys = keys %record;
    local @? = ("?") x @keys;
    local $" = ", ";

    my $sth = $dbh->prepare("insert into table (@{keys}) values (@{?})");
    $sth->execute(@record{@keys});
}

-- 
Sean McAfee                                                mcafee@umich.edu
print eval eval eval eval eval eval eval eval eval eval eval eval eval eval
q!q@q#q$q%q^q&q*q-q=q+q|q~q:q? Just Another Perl Hacker ?:~|+=-*&^%$#@!


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

Date: Thu, 6 May 1999 17:08:42 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: DATE PROBLEM
Message-Id: <MPG.119bcee75e77052d9899e9@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <7gqeh2$bmi$1@nnrp1.deja.com> on Wed, 05 May 1999 21:51:31 
GMT, bababozorg@aol.com <bababozorg@aol.com> says...
> can you please tell me how can i find out if the date i have is later than
> today or earlier. for example:
> i have the date 31-5-99
> and i want to know if i have passed this date or not.
> i mean if i check it when my date is 01-6-99 the program should tell me the
> date is over (passed)

You can split out the pieces in any of several ways, then use them as 
arguments to the Time::timelocal function, which is part of the standard 
Perl distribution.  Don't forget to adjust the month and the year 
(thanks for the warning, Ala), as described in the documentation for the 
localtime() function.  Then you can compare the result with the result 
of the time() function.

Happy reading!

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


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

Date: Fri, 7 May 1999 00:01:32 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: deleting files
Message-Id: <ebohlmanFBC5EK.Mww@netcom.com>

Wyzelli <wyzelli@yahoo.com> wrote:
: I am using Activeperl 5.005

: When I run the above command I get:

: No documentation found for "perlfunc"

: Is this a known problem with the documentation on windoze?

It's a known problem with the documentation for the earlier ActiveState 
500-series builds.  perldoc looks for perlfunc.pod when invoked with the 
-f option.  The earlier 500-series builds supplied the documentation in 
HTML (and Microsoft HTMLHelp (.chm), ugh!) format only.  ActiveState's 
patch to the most recent version supplies the missing .pod files.



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

Date: 06 May 1999 18:11:00 -0600
From: Eric The Read <emschwar@rmi.net>
Subject: Re: Editing a file "in-place"
Message-Id: <xkfu2tplox7.fsf@valdemar.col.hp.com>

tingdale@c2o.com (Tom Tingdale) writes:
> Jim Thanks for your help. Have you ever used this method inside a sub
> function and not the main? Would this work? Is there a better way?

First off, it's very hard to follow a conversation when you insist on
replying to remarks that haven't been said yet.  English works on a
top-to-bottom, left-to-right sort of paradigm.  USENET works better that
way as well.

> #!/usr/local/bin/perl -wi.bak
> 
> #main
> {
>     # do this and do that
>     change_text($filename);
> }
> sub change_text {
>     my ($file) = shift;
>     $ARGV[0] = $file;
>     while (<>) {
>         s/text/newtext/;
>         print;
>     }
> }

So... what happened when you tried it?  Wait a second... do you mean to
say you could be bothered to type this up for USENET, but you couldn't
manage to exert the tiny additional amount of effort required to cut and
paste your own code into an editor and run it?

We're here to *help*, not babysit you.  If you can't be bothered to test
some code, and insist on letting other people do it for you, you're not
going to get very far.

Oh, and it really isn't required to post the same thing twice-- if people 
didn't get it the first time, it's not too likely they'll see it the
second time either.

-=Eric


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

Date: Thu, 6 May 1999 15:29:21 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Extracting Emails from TXT #2
Message-Id: <hiqsg7.sg7.ln@magna.metronet.com>

joeyandsherry@mindspring.com wrote:
: I have a txt file which let's say is a large letter. In it are Email
: addresses along with hundreds of other words. I'd like to write a script
: that would read this file and everytime it recoginized an "@" it would look
: for the beginning and the end, blank spaces...and write it to a separate
: file...I can handle the writing it's just the reading and recognition.


   There has been no major breakthrough in the last several hours.

   It still cannot be done.


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Thu, 6 May 1999 16:07:44 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Extracting Emails from TXT
Message-Id: <gqssg7.sg7.ln@magna.metronet.com>

joeyandsherry@mindspring.com wrote:
: I have a txt file which let's say is a large letter. In it are Email
: addresses along with hundreds of other words. I'd like to write a script
: that would read this file and everytime it recoginized an "@" it would look
: for the beginning and the end, blank spaces...and write it to a separate
: file...I can handle the writing it's just the reading and recognition.


   There have been no breakthroughs in the last several minutes.

   This still cannot be done.


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Fri, 7 May 1999 00:58:19 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: FAQ 1.3: Which version of Perl should I use?
Message-Id: <ebohlmanFBC818.4qM@netcom.com>

Tom Christiansen <perlfaq-suggestions@perl.com> wrote:
:     most recent production release is 5.005_02 (although 5.004_04 is
:     still supported). The most cutting-edge development release is

s/_02/_03/;
s/_04/_05/;



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

Date: Thu, 6 May 1999 18:26:49 -0700
From: "J|rgen Exner" <juex@my-dejanews.com>
Subject: Re: Frames in Perl Script
Message-Id: <7gtfd8$729@news.dns.microsoft.com>

<raj999@my-dejanews.com> wrote in message
news:7gt88l$rrc$1@nnrp1.deja.com...
> How do embed Frameset tags within perl script? Any Clue Appreciated.
Thanks in
> Advance.

 ... some perl code
# <FRAMESET></FRAMESET>
 ... some more perl code

Or did you mean something else?

jue
--
J|rgen Exner





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

Date: 06 May 1999 21:13:48 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Help w/ unique script!!
Message-Id: <x71zgtwuk3.fsf@home.sysarch.com>

>>>>> "ETR" == Eric The Read <emschwar@rmi.net> writes:

  ETR> Bruce <bruce@liquidblue.com> writes:
  >> Anyone have ANY ideas??

  ETR> Yes... I have many ideas.  I have this great idea on how to
  ETR> achieve world peace through the liberal application of foot
  ETR> massages and potato latkes to key USENET posters, such as myself.
  ETR> I also have a neat idea involving the entire cheerleading squad
  ETR> of the Lakers, a hot tub, and large ammounts of Jell-O.  And just
  ETR> now, I had an idea about how to achieve FTL travel using only a
  ETR> shoestring, three rubber bands, a peripatetic hamster, and Don
  ETR> King, but it disappeared before I could write it down.

i think the first one is done already on cpan in 
Jewish::Food::Latkes::Massage::Feet.pm

but i would love to download the second one but i can't find it. 

try using Margins::Descartes to get back your lost solution for
the third.

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com


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

Date: Thu, 06 May 1999 16:51:26 -0700
From: KC <hunt@queen.es.hac.com>
Subject: Re: how to round off numbers?
Message-Id: <37322AFE.12EB813D@queen.es.hac.com>

David Cassell wrote:
> Umm, KC, I don't know how to tell you this, but you really put your
> foot in your mouth on this one.  As a matter of fact, TomC *is*
> one of those all-knowing geniuses who only use the ng to answer
> questions and post examples of his brilliance.

After reading the negative response to my negative response, I glanced
over to my pile of web programming books. There on the top was my newly
acquired Perl Cookbook...by Tom Christiansen. Ouch.

That said, I'm sorry guys, I don't care if it's God himself. I can't
stand condesending how-dare-you-not-know-everthing-I-know attitudes.
-- 
-----

KC


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

Date: Thu, 06 May 1999 16:55:21 -0700
From: KC <hunt@queen.es.hac.com>
Subject: Re: how to round off numbers?
Message-Id: <37322BE9.5A6003D@queen.es.hac.com>

Uri Guttman wrote:
> perl -e '$n=3.95638576;$n=int($n*1000 + .5)/1000;printf "%.20f\n", $n'
> 3.95599999999999996092
> 
> looks accurate to me!

perl5 -e '$n=3.95638576;$n=int($n*1000 + .5)/1000;print $n'
3.956

Yea, it does...

-- 
-----

KC


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

Date: Thu, 06 May 1999 17:37:25 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: how to round off numbers?
Message-Id: <373235C5.2AE2B3C9@mail.cor.epa.gov>

KC wrote:
> 
> David Cassell wrote:
> > Umm, KC, I don't know how to tell you this, but you really put your
> > foot in your mouth on this one.  As a matter of fact, TomC *is*
> > one of those all-knowing geniuses who only use the ng to answer
> > questions and post examples of his brilliance.
> 
> After reading the negative response to my negative response, I glanced
> over to my pile of web programming books. There on the top was my newly
> acquired Perl Cookbook...by Tom Christiansen. Ouch.
> 
> That said, I'm sorry guys, I don't care if it's God himself. I can't
> stand condesending how-dare-you-not-know-everthing-I-know attitudes.

That's understandable.  But you'll see some here.  Not quite like
that, but more like why-the-bleep-can't-you-be-bothered-to-read-all-
-your-free-documentation-and-expect-others-to-do-it-for-you
attitudes.

Watch.  People who say, "I looked in the FAQ and couldn't find how to
do so-and-so, here's what I tried and it failed abysmally, what's
wrong?" will get a fair shake.  People who say "Hey, I'm sure it's a
FAQ, but how do you take exponents?" will get short shrift.

And watch Tom's posts.  You'll see some real in-depth discussion
when it's warranted.  The kind of Perlishness I don't feel
competent to provide, like Perl+sockets, or ...

And never let this stuff get to you personally.  It's bad for
your blood pressure, and it doesn't make anyone look good.

David
-- 
David Cassell, OAO                            cassell@mail.cor.epa.gov
Senior Computing Specialist                      phone: (541) 754-4468
mathematical statistician                          fax: (541) 754-4716


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

Date: Thu, 6 May 1999 16:09:33 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: how to round off numbers?
Message-Id: <ttssg7.sg7.ln@magna.metronet.com>

Tim Armbruster (t-armbruster@ti.com) wrote:

: Cim wrote in message <3732ac01.98382674@news.uninet.ee>...
: >On 6 May 1999 14:33:02 +0100, Jonathan Stowe <gellyfish@gellyfish.com>
: >wrote:
: >
: >Actually I have a similar problem. ceil() rounds 3.123 to 4 and
: >floor() to 3. But i need one that does it like round() function in
: >Excel - if it's 3.4 it rounds to 3 and if it's 3.6 it rounds to 4.
: >?

: Add .5 to your number
  ^^^

   And if "your number" happens to be less than zero?


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Thu, 06 May 1999 17:18:11 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: How to use multi dimensional array in Perl
Message-Id: <37323143.897B986A@mail.cor.epa.gov>

Nitesh Jhaveri wrote:
> 
> Hi:
> 
> I need to create a two dimensional array to store a result of the sql
> query.
> 
> can someone help me with some demo code on how to acomplish this using
> Perl Array?

There's a ton of it in the docs.  Use perldoc [or man, or the HTML
on-line docs, or peruse the POD, whatever you prefer].

With perldoc, you can read some relevant docs this way:

perldoc perlref
perldoc perldsc
perldoc perllol   [that's a list of lists, suitable as a 2-D array]

HTH,
David
-- 
David Cassell, OAO                            cassell@mail.cor.epa.gov
Senior Computing Specialist                      phone: (541) 754-4468
mathematical statistician                          fax: (541) 754-4716


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

Date: Thu, 6 May 1999 15:33:05 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Increment a variable's name
Message-Id: <hpqsg7.sg7.ln@magna.metronet.com>

Tom Pape (tom@ernieball.com) wrote:
: Is there a way I can increment a variable's name?   The form I am
: processing can have a different number of quantity variables depending
: on the number of items listed.  If I have $i number of items can I
: assign values to a variable that might look like qty$i?  I need to
: incerment the variables name by 1 each time a loop runs, for example:
: qty1, then qty2, then qty3 ....


   What you want to do is called "Symbolic references".

   You do not want to do what you want to do.

   Use an array instead, $qty[1], $qty[2], etc...


      http://www.plover.com/~mjd/perl/varvarname.html


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Fri, 07 May 1999 00:30:52 GMT
From: "Jalil Feghhi" <jalil@corp.home.net>
Subject: Maintaining File Timestamps
Message-Id: <926037052.176997@zeppelin.svr.home.net>

I am using the move and copy to move my files around but like to keep the
timestamps unchanged. Is there any way to do that?

Thanks,

-Jalil





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

Date: Thu, 6 May 1999 18:39:15 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Maintaining File Timestamps
Message-Id: <MPG.119be422dd4cf5bb9899ec@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <926037052.176997@zeppelin.svr.home.net> on Fri, 07 May 1999 
00:30:52 GMT, Jalil Feghhi <jalil@corp.home.net> says...
> I am using the move and copy to move my files around but like to keep the
> timestamps unchanged. Is there any way to do that?

perldoc -f utime

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


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

Date: Thu, 06 May 1999 17:27:15 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Modulo
Message-Id: <37323363.AA09EDD3@mail.cor.epa.gov>

Don Roby wrote:
> 
> In article <3731C773.A05F9636@mail.cor.epa.gov>,
>   David Cassell <cassell@mail.cor.epa.gov> wrote:
> > Robert E Webb wrote:
> > >
> > > Mathematicians out there I have a question. I am currently in a debate over
> > > the correct answer to the following: -6 % 7. Perl, and MS Excel give the
> > > answer of 1. PHP gives the answer of -6. I emailed the developer, and he is
> > > saying that -6 is correct...
> >
> > Well, he's wrong.
> >
> 
> Well, I prefer the answer 1 too, but he's not exactly wrong.  He's following
> C usage after all, though as Larry noted, it may be implementation-dependent
> in C.
> 
> And he's not mathematically wrong.

> Beware, math pedantry lies ahead.  ;-)

Good I like that.  :-)
 
> Both answers are mathematically correct, because they're mathematically
> equivalent.  In the field of integers mod 7, 1 and 6 represent equivalence
> classes (or cosets if you like) which are additive inverses.  So -6 and 1 are
> the same in this context.

Yes.  Egads!  If you read my post again, you'll see that I was guilty..
of bad eyesight.  For some reason (probably a caffeine shortage), I was
reading that PHP was giving a result of PLUS 6 as the answer.  Not -6.
+6.  Which we all agree would be very bad.

Mea culpa.  time for some new glasses or something. 

Maybe I'll take a vacation for a few days...  Yeah, that's the ticket...
 
> > [snip]
> >
> > [2] Don't let TomC or Uri find out that some BillWare gives the
> > same answer as Perl, where PHP doesn't.  :-)
> >
> 
> It's ok on the rare occasions that BillWare gets it right.

Maybe for you and me, but I don't think Tom believes BillWare can
ever be right.  In any sense of the word.  :-)

David the opthamologically-challenged  
-- 
David Cassell, OAO                            cassell@mail.cor.epa.gov
Senior Computing Specialist                      phone: (541) 754-4468
mathematical statistician                          fax: (541) 754-4716


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

Date: Thu, 6 May 1999 16:57:51 -0700
From: "Matt G. Ellis" <mgeusenet@usa.net>
Subject: Newbie with a question about a pricing form
Message-Id: <93B262C7AD18FB8B.B68A4EE187DED1CB.26A1B89ECB20E290@library-proxy.airnews.net>

Hi, I'm trying to write a form in which you pick some options, and submit
that data.

the CGI script then takes what was submited (using get, because i hear it is
easyer) puts each boxs value in to a different variable and then add the
values together (40+40+20=100) then outputs the final number.

I can do the output part, and the adding part (assuming that if i try to add
$valuea and $valueb, each with equal numbers, it ADDS the numbers, and
doesn't create a new varabile with the two values after eachother)  I just
need to know how to pharse the data.  Any help (for free) would be nice, or
if you know of a free script that i could use that would also work.

Thanks!
Matt E.




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

Date: Thu, 06 May 1999 17:46:44 -0700
From: Hal Mounce <whm10@amdahl.com>
Subject: Re: OReilly bullshit.... Camel logo trademark
Message-Id: <373237F4.6DA34FDD@amdahl.com>

Matt Kruse wrote:

> I realize companies need to make efforts to stop unauthorized trademark
> useage, but IMO, they are taking it too far in finding any and every perl
> site that may have some representation of a camel.
> 
> What O'Reilly should do is allow the camel to become a public symbol for
> Perl, but maintain the trademark for books about Perl. Seems logical to
> me.
> 

I agree.  ORA has taken the fun out of perl.  In retaliation, I shall
curb my purchases of ORA products, and will ask my librarian to do
likewise.  I'll miss those lay flat bindings.


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

Date: Fri, 07 May 1999 00:17:09 GMT
From: andrew@micron.net (Andrew L. Peterson)
Subject: Re: Pentium III Chips Released with IDs - Intel won't budge
Message-Id: <37322fe3.433346052@news.micron.net>


I was kind of upset when I first heard about these new chips with
serial numbers in them, however, the other day I noticed that my
mother board also has a serial number in it. I am sure there is a way
through software to find out what it is too. This was on a mother
board with P166 chip. I have a feeling tracking us by serial numbers
have been around longer that we think.

Andrew




On Wed, 05 May 1999 21:07:19 GMT, Intelz@nospam.net (Intel No Privacy)
wrote:

>
>	Pentium III chip with the individual serial number that can
>track your web surfing and buying habits can now have the ID number
>turned on and off by software.  Following some links I found the
>www.fightdivx.com website and noticed that they have a Intel Boycott
>page with links, quotes and info on why you should boycott the
>invasion of privacy Pentium III chips. Just like everyone suspected,
>the ID number can be taken without a customers knowledge. Just like
>cellular phone fraud, once someone has your unique ID number, they
>could pose as you on the internet.  Do not be fooled by reports that
>this problem is fixed because Intel disabled this feature by software
>on their up coming chips.  Information is power. They want to know
>your surfing and buying habits. That is what this is all about. Here
>is the link to the page with the boycott info and links. 
>
>http://www.fightdivx.com/intelboycott.htm
>
>Also you will find a Boycott Intel screen saver and banner on their
>page above. Spread it around.
>
>



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

Date: Thu, 6 May 1999 18:10:47 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: PERLFUNC: binmode - prepare binary files on old systems
Message-Id: <MPG.119bdd741d5065559899ea@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <373215ba@cs.colorado.edu> on 6 May 1999 16:20:42 -0700, Tom 
Christiansen <perlfaq-suggestions@perl.com> says...
> (This excerpt is from the perlfunc manpage, part of the standard set of
> documentation included with every valid Perl distribution--like the one on
> your own system.  See also http://language.perl.com/newdocs/pod/perlfunc/
> if your negligent system adminstrator has been remiss in his duties.)

As if in response to my diatribe this morning, lo and behold appears a 
greatly enlarged (and improved!) version of the binmode() doc.

> NAME
>     binmode - prepare binary files on old systems

But note the prejudicial and misleading rubric.  Ouch!

> SYNOPSIS
>     binmode FILEHANDLE
> 
> DESCRIPTION
>     Arranges for FILEHANDLE to be read or written in "binary" mode on
>     systems whose run-time libraries force the programmer to guess
>     between binary and text files.

It is hard to believe that a 'programmer' doesn't know!  A text file 
consists of a sequence of characters organized into lines (i.e., with 
chunks terminated by line endings, whatever they may be).  A binary file 
is a sequence of characters without such an organization.  Sheesh!

>                                    If FILEHANDLE is an expression, the
>     value is taken as the name of the filehandle. binmode() should be
>     called after the `open' but before any I/O is done on the
>     filehandle. The only way to reset binary mode on a filehandle is to
>     reopen the file.
> 
>     The operating system, device drivers, C libraries, and Perl run-
>     time system all conspire to let the programmer conveniently treat a
>     simple, one-byte `\n' as the line terminator, irrespective of its
>     external representation. On Unix and its brethren, the native file
>     representation exactly matches the internal representation, making
>     everyone's lives unbelievably simpler.

Agreed!  Well said.

>                                             Consequently, the binmode
>     manpage has no effect under Unix, Plan9, or Mac OS, all of which
>     use `\n' to end each line. (Unix and Plan9 think `\n' means `\cJ'
>     and `\r' means `\cM', whereas the Mac goes the other way--it uses
>     `\cM' for c<\n> and `\cJ' to mean `\r'. But that's ok, because it's
>     only one byte, and the internal and external representations
>     match.)

There's Plan9 again.  Someone outside of Lucent must care, but I'm not 
sure who.

>     In legacy systems like MS-DOS and its embellishments,

God Forbid you should name them!  Is it possible that not evey user of 
Perl on such systems knows that MS-DOS lurks underneath, either in 
reality or in its legacy of file formats?

>                                                           your program
>     sees a `\n' as a simple `\cJ' (just as in Unix), but oddly enough,
>     that's not what's physically stored on disk. What's worse, these
>     systems refuse to help you with this; it's up to you to remember
>     what to do. And you mustn't go applying binmode() with wild
>     abandon, either, because if your system does care about binmode(),
>     then using it when you shouldn't is just as perilous as failing to
>     use it when you should.

Once again, the dichotomy is clear to the programmer.  It would be 
catastrophic if the system tried to help by actually applying some sort 
of heuristic, as the old Unix 'file' command tries to do -- and fails 
miserably on text files that happen to use Latin-1 instead of ASCII.

>     That means that on any version of Microsoft WinXX that you might
>     care to name (or not),

Well, you finally included the magic characters 'Win', but you still 
refuse to say the dirty word that might make grepping the file for the 
name of the operating system actually succeed.  Even that must have been 
hard.  I hope your psychiatrist helped you through your phobia.  :-)

>                             binmode() causes `\cM\cJ' sequences on disk
>     to be converted to `\n' when read into your program, and causes any
>     `\n' in your program to be converted back to `\cM\cJ' on output to
>     disk. This sad situation discrepancy leads to no end of problems in
>     not just the readline operator, but also when using seek(), tell(),
>     and read() calls. See the perlport manpage for other painful
>     details. See the `$/' and `$\' variables in the perlvar manpage for
>     how to manually set your input and output line-termination
>     sequences.

The relevant heading in perlport (which ActiveState provided, but didn't 
link from their HTML index -- I wonder why?)  is 'DOS and Derivatives'.  
But at least the dirty word appears (several times) in the body text.

It also has the following sentence:  "Since it is a noop on other 
systems, binmode should be used for cross-platform code that deals with 
binary data."  I think that is fine, except that it shouldn't say 
'cross-platform'.  That is my point in a nutshell.  Teach it as Perl -- 
when you open a binary file, you use binmode().  Period. 

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


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

Date: Fri, 07 May 1999 00:59:19 GMT
From: "Charles R. Thompson" <design@raincloud-studios.com>
Subject: Problem with s/foo \|\s//
Message-Id: <HVqY2.2239$iu1.1957@news.rdc1.tn.home.com>

I've used a basic regex from the Cookbook (I know.. I read the warning) to
extract the titles from HTML pages.

($pagetitle) = ($pagelines =~  m#<title>\s*(.*?)\s*</title>#is);

The Titles are prefixed with company name followed by a space-pipe-space, then
a page title. For the site-local search engine I want to strip the company
name off in the results so it's no so redundant to look at.

A title Format is...

<title>Company Name | Page Name</title>

This works, but of course will not remove the trailing space...

$pagetitle =~ s/Company Name \|//;

This won't match the trailing space for the substitution to go through...

$pagetitle =~ s/Company Name \| //;

and neither will this...

$pagetitle =~ s/Company Name \|\s//;

I thought \s was for one whitespace character. I have checked the pages and
they are formatted in the manner I mention. Is the pipe or previous regex
doing something to the substitution that I'm totally unaware of here?

CT




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

Date: Fri, 07 May 1999 01:16:52 GMT
From: "Charles R. Thompson" <design@raincloud-studios.com>
Subject: Re: Problem with s/foo \|\s//
Message-Id: <8arY2.2270$iu1.2031@news.rdc1.tn.home.com>

Sorry... this newsgroup won't let me cancel.

I got it.




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

Date: Thu, 6 May 1999 18:50:17 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Problem with s/foo \|\s//
Message-Id: <MPG.119be6b06f057d179899ed@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <HVqY2.2239$iu1.1957@news.rdc1.tn.home.com> on Fri, 07 May 
1999 00:59:19 GMT, Charles R. Thompson <design@raincloud-studios.com> 
says...
 ...
> The Titles are prefixed with company name followed by a space-pipe-space, then
> a page title. For the site-local search engine I want to strip the company
> name off in the results so it's no so redundant to look at.
> 
> A title Format is...
> 
> <title>Company Name | Page Name</title>
 ...
> This won't match the trailing space for the substitution to go through...
> 
> $pagetitle =~ s/Company Name \| //;
> 
> and neither will this...
> 
> $pagetitle =~ s/Company Name \|\s//;
> 
> I thought \s was for one whitespace character.

It is.

>                                                I have checked the pages and
> they are formatted in the manner I mention. Is the pipe or previous regex
> doing something to the substitution that I'm totally unaware of here?

I don't know.  Each of these regexes works fine for me, which is no 
surprise at all.

What makes you think it fails?  Obviously your real data aren't 'Company 
Name | Page Name', because that would be rather boring, wouldn't it?

What is the regex you actually used, and some real data?

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


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

Date: 06 May 1999 21:05:58 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Q: checking wheather the user exists
Message-Id: <x74slpwux5.fsf@home.sysarch.com>

>>>>> "JS" == John Stanley <stanley@skyking.OCE.ORST.EDU> writes:

  JS> In article <x790b1x6kb.fsf@home.sysarch.com>,

  JS> Uri Guttman <uri@sysarch.com> wrote: >> is this a perl question?
where is the perl content? and without going >> thru the passwd file
which IS the map of user names to uid's, how else would >> you find out
if a user exists?

  JS> The file /etc/passwd is not the only map of user names to uids.

i do know that. you have nis/yp, nis+, shadow, nsswitch.conf (solaris), etc.

but my point was valid, if he figures out how other programs do it, then
he could figure out how perl can do it. 

i was talking to someone today and i told him, high level certification
in computer stuff is worthless. but what about low level ones? if you
can't do basic research given mans pages, faq, on-line docs, the web,
etc., you should not be allowed to program in any language on any machine
anywhere!

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com


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

Date: Thu, 6 May 1999 16:19:21 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: RegExp Help Please
Message-Id: <9gtsg7.sg7.ln@magna.metronet.com>

nkaiser@my-dejanews.com wrote:
: This seems so simple, but I can't get it to work....

: I want to replace %WHATEVER% with "+WHATEVER+"

: Here's what I have:

: $str="name1=%val1%&name2=%val2";
: $str=~s/%(.*)%/"+$1+"/g;

: It's not working. It prints out:
: name1="+val1%&name2=%val2+"


   Please don't post "approximations" of your code and output.

   Post your real code.

   Post your real output.


   1) that code has no output statements, therefore it cannot
      "print" _anything_

   2) if you did happen to have an output statement somewhere
      it would not give the output that you claim. It would
      output this:

         name1="+val1%&name2=+"val2
                              ^
                              ^

   We cannot help you if we are not looking at the 
   same code that you are looking at...


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: 7 May 1999 01:20:43 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: syswrite() lies
Message-Id: <slrn7j4fvb.lrm.sholden@pgrad.cs.usyd.edu.au>

On Thu, 6 May 1999 09:07:45 -0700, Larry Rosler <lr@hpl.hp.com> wrote:
>In article <slrn7j3bll.sgs.sholden@pgrad.cs.usyd.edu.au> on 6 May 1999 
>
>Historical continuity of design and data are just as important in the 
>CP/M -> DOS -> Windows evolution as in other technological streams. 
<snip>
>
>The original 'brilliant' decision in Unix was to reinterpret the ASCII 
>LF (line-feed) character "\012" to mean "start a new line", which 
<snip>
>
>The CP/M decision was to retain the literal meaning of LF (which 
>simplifies the TTY driver a smidgen) and to translate the "\n" to CR/LF 
>not only in the TTY driver but also in the external-storage drivers.  
<snip>

>
>So we are stuck forever with text files that have more bytes when stored 
>externally than internally, with FTP 'ASCII' and 'binary' modes, with 
>here-docs that don't terminate, and ...

I can see problems with all the choices as well. I just find having to 
munge from 1 byte to two bytes and back again the most tedious. I
don't think unix is the be all and end all. I like other systems more
in fact, but unix is what we use here. Plan9 was used in the past and
droppings remain, the shell, wily, sam...

>> Windows people don't seem to read the documentation as much (I have no
>> evidence, it's my opinion - I'm probably wrong) as unix people.
>
>If true, that changes fast when they encounter Perl!  :-)
> 
>> Unix people read about binmode in that documentation and then should use
>> it (many write non-portable code and don't use it, but that is OK in a lot
>> of situations (code that does very unixy things for example)).
>> 
>> Windows people don't read about binmode and thus don't use it.
>
>No.  They don't see it in the examples or in the code they are copying, 
>and thus don't use it.

But almost all the examples I've seen are processing text not binary files
anyway. So they don't see not out of people not using it when they should,
but because it is used in the less common case.

-- 
Sam

Every human culture has good and bad points. Every computer program has
Eveone more bug. Even Perl.
	--Larry Wall


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

Date: Thu, 6 May 1999 16:02:49 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: syswrite() lies
Message-Id: <9hssg7.sg7.ln@magna.metronet.com>

Larry Rosler (lr@hpl.hp.com) wrote:

[snip stuff about virulent anti-Windows diatribes in the
 Standard Perl Docs (SPD)
]

: CONCLUSION

: There is only one conclusion to be drawn from all this BIGOTRY:  We 
: collectively are diminishing the utility of Perl by biasing its 
: documentation in this way.  


   I agree 100%.

   I am incorrigibly bigoted in line with the bigotry that you
   refer to. 

   I have even saved off some of the more amusing windows-bashing
   statements that I have encountered.

   I am awed that so many people are content with the servitude
   that goes along with selling your soul to Bill.

   I could have written the windows-bashing language in the SPD 
   myself (if I was knew enough about Perl to contribute).


   Yet having it be part of the Official Perl Distribution 
   has bothered me for some years.

   (Strange. I guess I am an "open minded bigot". An oxymoron...)


: I urge a bunch of *real* 'winblows perl 
: hackers' to put together documentation patches that will deal with this 
: BIGOTRY, and force the patches into the Perl corpus.


   Windows Perl programmers, stand up for yourselves!

   A well-respected champion for Perl on Windows would be a
   great service to the Perl community.

   Where are you? 


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Thu, 6 May 1999 18:55:29 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: syswrite() lies
Message-Id: <MPG.119be7eda407ea729899ee@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <slrn7j4fvb.lrm.sholden@pgrad.cs.usyd.edu.au> on 7 May 1999 
01:20:43 GMT, Sam Holden <sholden@pgrad.cs.usyd.edu.au> says...
> On Thu, 6 May 1999 09:07:45 -0700, Larry Rosler <lr@hpl.hp.com> wrote:
 ...
> >> Windows people don't read about binmode and thus don't use it.
> >
> >No.  They don't see it in the examples or in the code they are copying, 
> >and thus don't use it.
> 
> But almost all the examples I've seen are processing text not binary files
> anyway. So they don't see not out of people not using it when they should,
> but because it is used in the less common case.

>From another post by me in this thread:

"... the only mention of 'binary' in perlfaq5:  "How do I randomly 
update a binary file?" shows an 'open' without a 'binmode'.  Surprise, 
surprise!" 

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


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

Date: Fri, 07 May 1999 00:17:08 GMT
From: richly@samart.co.th (Robert White)
Subject: Re: The Perl Index Project
Message-Id: <37323057.1104620@news.samart.co.th>

 tshinnic@io.com (Thomas L. Shinnick) wrote:

>Thus the online index (with accompanying search engine) could
>become the "index as large as the text" that no publisher can
>afford to produce.

ecco!
	Publishers would go for that angle.  Now to persuade them to adopt
a common format.


Robert
http://members.xoom.com/robertmwhite/perl.html


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

Date: Thu, 06 May 1999 17:04:01 -0700
From: Phil Voris <pvorishatesspam@earthlink.net>
Subject: user-defined regex problem
Message-Id: <37322DF0.B3BB848B@earthlink.net>

Here's a challenge which I thought might be solved with eval, but with
which I've had no luck thus far.

Say I'm taking user input for both parts of a regex substitution.  They
fill in the $old and $new parts of:

s/$old/$new/g;

How do I make it so that the $new can utilize capturing parens in $old? 
Right now, I can find regexes, but their substitution must be a static
string -- it won't work properly with 

$old = '(\d) ';
$new = '$1_';  # or the like

Thank you for your input.
Phil



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

Date: Thu, 6 May 1999 18:37:43 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: user-defined regex problem
Message-Id: <MPG.119be3bfcfd4a0659899eb@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <37322DF0.B3BB848B@earthlink.net> on Thu, 06 May 1999 
17:04:01 -0700, Phil Voris <pvorishatesspam@earthlink.net> says...
> Here's a challenge which I thought might be solved with eval, but with
> which I've had no luck thus far.
> 
> Say I'm taking user input for both parts of a regex substitution.  They
> fill in the $old and $new parts of:
> 
> s/$old/$new/g;
> 
> How do I make it so that the $new can utilize capturing parens in $old? 
> Right now, I can find regexes, but their substitution must be a static
> string -- it won't work properly with 
> 
> $old = '(\d) ';
> $new = '$1_';  # or the like

eval "s/$old/$new/g";

Maybe you didn't use double-quotes on the eval. 

#!/usr/local/bin/perl -w
use strict;
$_ = 'Is it 63 or 42 ?';
my $old = '(\d) ';
my $new = '$1_';  # or the like
eval "s/$old/$new/g";
print "$_\n";
__END__

Is it 63_or 42_?

Of course, you need checks on the result of the eval, because you can't 
trust user input for syntactic correctness.  Fortunately, I think you 
are safe from semantic malice, because there is no /e on the regex. 

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


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

Date: Fri, 07 May 1999 00:32:31 GMT
From: "Jalil Feghhi" <jalil@corp.home.net>
Subject: Re: Using 'Require' in ASP
Message-Id: <926037151.177101@zeppelin.svr.home.net>

Actually my files have gotten corrupted somehow. I can require files now w/o
any problems.

Thanks,

-Jalil

Jonathan Stowe wrote in message <372ecc80@newsread3.dircon.co.uk>...
>Jalil Feghhi <jalil@corp.home.net> wrote:
>> Lennart,
>>
>
>The last time anyone called 'Lennart' posted here was 23 March 1998 as
>far as I can determine.
>
>> I would appreciate it if you could help me here.
>>
>> I am using a function in my ASP page that is defined in another perl file
I
>> am including in my program using 'require' but ASP interpreter complains
>> that it can't find the function. I think the interpreter looks for the
>> function w/o knowing what 'require' means.
>>
>
>If it doesnt understand 'require' then it aint Perl - What is the error
>you are getting ?  Doris reckons that you are trying to use the default
>language - which is not Perl and thus is not really a Perl question.
>
>/J\
>
>--
>Jonathan Stowe <jns@gellyfish.com>
>




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

Date: Fri, 7 May 1999 00:56:24 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Which HTTP module for extracting tags?
Message-Id: <ebohlmanFBC7y0.4MC@netcom.com>

Jonathan Stowe <gellyfish@gellyfish.com> wrote:
: On Thu, 06 May 1999 21:20:14 GMT Charles R. Thompson wrote:
: > I'm looking on CPAN and seeing a bit too much. Which HTTP module will allow me
: > the quickest way to extract text between specific HTML tags with the least
: > amount of overhead? I also need it to handle tags across newlines.
: > 
: > Say if I wanted to jerk just the title out of a page or get an array of all
: > the a href links. That kind of simple flexibility.
: > 

: Look at the HTML::* modules available from CPAN.

Particularly HTML::TokeParser and HTML::HeadParser (Toke?? Head??  Mr. 
Aas seems to have come up with some rather cannabinoid names for his 
modules.)



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

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

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