[15703] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3116 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon May 22 00:05:42 2000

Date: Sun, 21 May 2000 21:05:07 -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: <958968306-v9-i3116@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sun, 21 May 2000     Volume: 9 Number: 3116

Today's topics:
    Re: file handles - win32 (Gwyn Judd)
    Re: Help with Perl semantics <jeff@vpservices.com>
    Re: loading a bunch of urls <bwalton@rochester.rr.com>
        Pattern match ? <lee@factory.co.kr>
    Re: Pattern match ? <tony_curtis32@yahoo.com>
    Re: Pattern match ? <brian@bluecoat93.org>
    Re: Pattern match ? <jeff@vpservices.com>
    Re: Recommendations on a Perl/MySQL book or chapter? <makarand_kulkarni@My-Deja.com>
    Re: regexes *sigh* damn I hate these things <nospam@devnull.com>
    Re: regexes *sigh* damn I hate these things <godzilla@stomp.stomp.tokyo>
    Re: sorting a list of mixed numbers and text as in perl <anmcguire@ce.mediaone.net>
    Re: SSI in Perl Script ? <lancelotboyle@hotmail.com>
    Re: Suggest an approach for HTML Form submission <bwalton@rochester.rr.com>
    Re: Tanspose rows to columns <xah@xahlee.org>
    Re: the use of $_ <godzilla@stomp.stomp.tokyo>
    Re: tough naming problem <bwalton@rochester.rr.com>
    Re: valid email address (Neil Kandalgaonkar)
        Windows/Linux Incompatibility <ab@cd.com>
    Re: Windows/Linux Incompatibility <brian@bluecoat93.org>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Mon, 22 May 2000 04:01:52 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: file handles - win32
Message-Id: <slrn8ik0pl.4gt.tjla@thislove.dyndns.org>

I was shocked! How could Luc-Etienne Brachotte <Luc-Etienne.Brachotte@wanadoo.fr>
say such a terrible thing:
>> hmm, well how about storing the filehandle and the name in a hash?
>> By the way you really should check for errors on open()'ing a file.
>> Something like this (untested) code should do it. Note I am no guru so
>> this may well be totally wrong.
>
>I fully understand your point of view. But I didn't want here to write thousands of
>lines...
>Your "hash-solution" is good, except in my case: I must handle lot of files, it saves
>memory NOT to store in a hash or anywhere else the file names. Remember: under
>windows every byte is precious!
>
>I your prefer:
>
>Imagine you write a package, with a function in it. This function has one parameter,
>on opened file handle.
>This function does a lot of actions, and didn't care of the file name.
>But... When errors occurs, this function writes the error message, plus the file
>name. In this case, the function has to retrieve the file name from the file handle.
>
>Is the question clearer?

Well as I say I am no guru, however I think there isn't any way to do
this portably and correctly. Take for example the case where you open a
file for reading and then someone else deletes it. What is the name of
the file then? This is probably only a problem under unix though. Mind
you I think most operating systems will have a set limit on the number
of open files which you are likely to hit long before you start running
out of memory with a hash.

-- 
Gwyn Judd (tjla@guvfybir.qlaqaf.bet)
My return address is rot13'ed
Line Printer paper is strongest at the perforations.


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

Date: Sun, 21 May 2000 18:14:14 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Help with Perl semantics
Message-Id: <392889E6.9A92A7AE@vpservices.com>

Jim Stout wrote:
> 
> It seems the more I learn about Perl the less I know. This one has
> already invoked two bottles of Tylenol and I still have a headache. In
> trying to learn PMs I've be looking through the standard PMs 

Obviously, you have PMS (Perl Module Syndrome).  It will pass and
shouldn't return for about 28 days.

> construct which is giving me grief, which is (extracted from CGI.pm):
> 
> 'compare' => <<'END_OF_FUNC',
> sub compare {
>     my $self = shift;
>     my $value = shift;
>     return "$self" cmp $value;
> }
> END_OF_FUNC
> 
> The subroutine definition I understand. I get the drift of the
> <<'END_OF_FUNC'/END_OF_FUNC thing...in that it somehow bounds the
> subroutine (no clear on the usage). The part that really loses me is
> what is happening with the part:
> 
> 'compare' => <<'END_OF_FUNC',

You have chopped the exrpession off in the middle, the full expression
is:

  %SUBS = (
    # what you quoted here
    # many other constructs like what you quoted
  );

In other words there is a hash %SUBS.  One of the keys of the hash is
"compare".  The value for that key is the subroutine you showed.  

Clear as mud?

-- 
Jeff


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

Date: Mon, 22 May 2000 02:29:46 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: loading a bunch of urls
Message-Id: <39289BD6.911C93F6@rochester.rr.com>

edelwater@my-deja.com wrote:
> 
> hmmm.... thinking if perl is the right lang for this...but ok:
> 1. i want to have a piece of perl on a server.
> 2. this should be loaded by like 150 seperate locations
>    through a browser where it automatically goes through   several urls
> 3. when finished it writes the time to a file (needed to
>    load all the urls e.g. in a frame)any ideas ?? >>
> nederland@anytimenow.com
 ...
A combo of

    use Benchmark;
    use LWP::Simple;

should do nicely.  Maybe like:

    use Benchmark;
    use LWP::Simple;

    &defineURLs;
    $t0=new Benchmark;
    for(@URLs){
        get($_);
    }
    $t1=new Benchmark;
    print "It took ".timestr(timediff($t1,$t0))."\n";

    sub defineURLs{ #replace this with your URL's
        @URLs=(
            'http://www.one.com',
            'http://www.two.com'
        );
    }

No server or browser needed -- Perl does it all, simply and easily.
-- 
Bob Walton


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

Date: Mon, 22 May 2000 12:04:45 +0900
From: "Lee" <lee@factory.co.kr>
Subject: Pattern match ?
Message-Id: <8ga7pp$cm7$1@news2.kornet.net>

Hi,

If there are alphabetic and numeric characters in a word like
"a34r34thy643d2",
how to delete all of alphabetic characters in that world.

This "a34r34thy643d2"
should be "34346432".

Thanks




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

Date: 21 May 2000 22:05:50 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Pattern match ?
Message-Id: <87og5zwagh.fsf@limey.hpcc.uh.edu>

>> On Mon, 22 May 2000 12:04:45 +0900,
>> "Lee" <lee@factory.co.kr> said:

> Hi, If there are alphabetic and numeric characters in a
> word like "a34r34thy643d2", how to delete all of
> alphabetic characters in that world.

> This "a34r34thy643d2" should be "34346432".

    tr/a-zA-Z//d;

perldoc -f tr, and follow the reference

hth
t


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

Date: Sun, 21 May 2000 23:06:36 -0400
From: "Brian Landers" <brian@bluecoat93.org>
Subject: Re: Pattern match ?
Message-Id: <ou1W4.1724$dR1.19546@news4.atl>

# assume $str holds your string
$str =~ s/[a-zA-Z]//g;

# or, if you really want to delete all non-numeric characters (not just
alphabetics):
$str =~ s/\D//g;

"Lee" <lee@factory.co.kr> wrote
> If there are alphabetic and numeric characters in a word like
> "a34r34thy643d2",
> how to delete all of alphabetic characters in that world.
>
> This "a34r34thy643d2"
> should be "34346432".





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

Date: Sun, 21 May 2000 20:11:53 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Pattern match ?
Message-Id: <3928A579.418542AF@vpservices.com>

Lee wrote:
> 
> If there are alphabetic and numeric characters in a word like
> "a34r34thy643d2",
> how to delete all of alphabetic characters in that world.
> 
> This "a34r34thy643d2"
> should be "34346432".

my $str =~ s/[^\d]//g;

Literally: remove everything that is in the class of characters that
consists of things which are not digits.

-- 
Jeff


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

Date: Sun, 21 May 2000 19:29:59 -0700
From: Makarand Kulkarni <makarand_kulkarni@My-Deja.com>
Subject: Re: Recommendations on a Perl/MySQL book or chapter?
Message-Id: <39289BA7.BF39E32B@My-Deja.com>

> Any recommendations on a good book or even a chapter in a book
> that covers MySQL and Perl as a front end?

MySQL and mSQL (Nutshell Series)
                     by Randy Jay Yarger, George Reese, Tim King
Chapter : 10 is here
http://www.oreilly.com/catalog/msql/chapter/ch10.html

The docs distributed with MySQL do a fine job.
The docs are at www.MySQL.com
==



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

Date: 22 May 2000 01:26:57 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: regexes *sigh* damn I hate these things
Message-Id: <8ga2d1$pai$1@216.155.32.172>

In article <39286A78.808E2D99@stomp.stomp.tokyo>, "Godzilla!" 
<godzilla@stomp.stomp.tokyo> wrote:

 | As a child, about knee high to an Oklahoma
 | Cotton Mouth, one of my, one of us kid's chores,
 | was shoveling out mule manure from our corral,
 | to help keep our priceless, life saving mules
 | from coming down with The Bangs in their hooves.
 | Without our two plow mules, two being an indicator
 | of being wealthy farmers, surely we would go hungry.
 | 
 | Musing instead of tending my chores, I watch a
 | big barnyard fly, fattened on a cuisine of
 | fresh mule manure, trying to fly. In frustration,
 | after numerous attempts to take to blue sky, this
 | fly smartened up and crawled up a pitch fork handle,
 | whereupon, he leaped with hopes of flying. No luck.
 | Splat. Face first back into this mule manure he went.
 | 
 | Barefoot and hungry scrawny, I thought to myself,
 | 
 | "Ya know, when yall done know your full of manure,
 |  ya shouldn't go and fly off the handle."
 | 
 | My Perl code provided works with absolute perfection,
 | is eloquently simplistic and written in such old
 | fashion Plain English, almost all understand what it
 | does at first glance. 
 | 
 | Who needs an expensive fancy air conditioned John Deere
 | when you can attain nirvana busting dirt clods bare foot,
 | plodding and plowing along behind two ornery mules, both
 | of which are slinging smelly mule sweat on you for cooling,
 | under a sweltering Oklahoma sun? Simplicity is survival.

*cough* what exactly does this have to do with my question and why is it here in 
my thread? :)

Start a new thread if you're gonna digress from my questions in the future, 
thanks. (this goes for anyone, not just you in particular, Godzilla)

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: Sun, 21 May 2000 18:52:11 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: regexes *sigh* damn I hate these things
Message-Id: <392892CB.8C91536@stomp.stomp.tokyo>

The WebDragon wrote:

> *cough* what exactly does this have to do 
> with my question and why is it here in my thread? :)


I dunno. Ask those others whom appear to
have their diapers in a knot over my code
being so simple, yet so perfect. My guess
is nobody thought to meet your challenge
with such simplicity and, now, well...
who knows, guess they are pissed off.
I sure didn't twist their arms and force
them to pitch a big conniption fit.

I've noticed with passing articles your
solution code is beginning look more like
what I wrote. Interesting.

Godzilla!


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

Date: Sun, 21 May 2000 20:37:47 -0500
From: "Andrew N. McGuire " <anmcguire@ce.mediaone.net>
Subject: Re: sorting a list of mixed numbers and text as in perldoc
Message-Id: <Pine.LNX.4.20.0005212035420.18426-100000@hawk.ce.mediaone.net>

On 22 May 2000, The WebDragon wrote:

+ In article <slrn8idf1j.tkm.tjla@thislove.dyndns.org>, tjla@guvfybir.qlaqaf.bet 
+ (Gwyn Judd) wrote:

[ snip ]

+  |   sort { $b->[1] <=> $a->[1]

[ snip ]

+ what if you wanted the output to be:
+ 
+ ====
+ dawg? hi low up what's yo 1 2 3
+ ====
+ 
+ how would you change that?

Reverse $a and $b in the quoted line above, like so:

sort { $a->[1] <=> $b->[1]

Regards,

anm
-- 
/*-------------------------------------------------------.
| Andrew N. McGuire                                      |
| anmcguire@ce.mediaone.net                              |
`-------------------------------------------------------*/



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

Date: Mon, 22 May 2000 04:26:33 +0100
From: "Lance Boyle" <lancelotboyle@hotmail.com>
Subject: Re: SSI in Perl Script ?
Message-Id: <8ga9ia$21n$1@plutonium.btinternet.com>

Many thanks

I tried everywhere except the obvious place

Andy Chantrill <andy@u2me3.com> wrote in message
news:8g8u9o$enp$1@neptunium.btinternet.com...
> http://www.apache.org
>
>




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

Date: Mon, 22 May 2000 02:38:00 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Suggest an approach for HTML Form submission
Message-Id: <39289DC3.1BF1C498@rochester.rr.com>

Ed Costello wrote:
> 
> Greetings,
> 
> I need to create a Macintosh Perl program that mimics an HTML form submission
> to a web server and parses the resulting page.  I have MacPerl installed, but
> I'm not sure I have all the appropriate modules, libraries, packages, etc...
> 
> Could someone point me in the right direction or suggest an approach?
> 
> Cheers!
> 
> Ed Costello
> Million Monkeys
> perl@million-monkeys.com
I don't know anything about Mac's or Perl on Mac's, but LWP is the Perl
module you want.
-- 
Bob Walton


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

Date: Sun, 21 May 2000 18:48:58 -0700
From: Xah <xah@xahlee.org>
Subject: Re: Tanspose rows to columns
Message-Id: <B54DE01A.A158%xah@xahlee.org>

> Oh, *there* it is... and blech! It builds a string for eval() every time
> it's called. That ought to make it run nice & slow.

>Was that the only way you could find to do it?

Yes, and if you could show me it without eval i would sprawl and bark like a
dog for your entertainment. I'll show that, how one of us, is utterly
willing but not able. Honest. I'll give you Perl folks 1 week.

(I would be delighted, even if anyone just show me an implementation. (in
Perl, of course.))

> Please lead your .sig with '-- ' so that newsreaders can trim it.

The perl folks of beady eyes and unix weenies of lose mouths, have this
peculiar propensity toward trifles. You see them everywhere getting
extremely upset about newsgroup post formats, line lengths (cannot be long
and nor too short), code formatting styles, use of non-ascii character sets,
use of non-plain-texts, sig particularities, and will go to great lengths to
bother and force their preferences if one begs to differ.

In subjects they take an interest in, they are oblivious to what is really
important. They are excited by speedier implementation, but little interest
in better algorithm complexity. Savor syntax sugars, but no taste buds for
algorithmic variations. Love obfuscation by mumble jumble, but don't
understand abstract mathematics. Quick to brawl on code/posting formatting
preferences, but ignorant and hostile to ideas and technologies that take
care of formatting automatically (by personal preference, too!). They are
quick to whip out _American_ Constitution and Really Fucking Commons (RFC),
but no background in (world) ethics nor the meaning and significance of
Standards. They are glib in quoting Shakespearean word bites and clever in
unixism style coinage, but are literally literarily illiterate. (yeah,
shuck, they have read a lot Science Fictions.)

In their style: "One word: slouches.".

> BTW,
> Xah, if you despise Perl so much (a) why program in it?

There are things in this world that we do not get to choose, or get by with
it. For example, you don't get to choose your sex, and if i may venture to
say so, your IQ. When such and such is your environment or acquirement, you
live by it one way or another. If you don't like it, you can try to change
it. I happened to have learned Perl. (details not worth mentioning.) I'm
here to do an anti-Wall. I want to show you Perl folks -- in all genuine
intention -- how petty and pitiful the Perl ways are. If crime is defined to
be acts that damages society, then Larry Wall & cohorts are criminal of the
first rank in the computing world. A jolly practicing charlatan who is
ignoble in nature and lackluster in abilities.

Homer Simpson singing: "I'm gonna make it after all!".

> and (b) why post
> here?

I speak Perl. Ain't this perl.misc?

The perl folks with their beads of little eyes, cannot see beyond their
perl-perl-land.

 Xah
 xah@xahlee.org
 http://xahlee.org/PageTwo_dir/more.html 



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

Date: Sun, 21 May 2000 21:04:01 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: the use of $_
Message-Id: <3928B1B1.FEE549E6@stomp.stomp.tokyo>

Tintin wrote:
 
> "Godzilla!" <godzilla@stomp.stomp.tokyo> wrote in message
> news:39281AD2.8B439E31@stomp.stomp.tokyo...
> > > Reason 7 is if you're stuck with perl 4.  ''I am stuck with perl 4''
> > > is never *good* reason to do *anything*, except maybe to cut your
> > > wrists or something.

> > Perl 4 is still currently shipped with some
> > operating system packages and, Perl 4 concerns
> > are posted here at times. Perl 4 is still quite
> > viable and of concern to many. To shun posters
> > here for use of Perl 4 or to shun those who are
> > stuck with Perl 4, is most illogical, unrealistic
> > and perhaps, an act of technological bigotry.
 
> Please name me just one current Operating System that comes with Perl 4.

Someone else listed one of a number of Operating Systems
still bundled with Perl 4. Sometime around late February
or early March, a discussion took place on this topic.
If I remember correctly, at least five or six O/S were
listed which are bundled with Perl 4, probably still so
today. There are quite a few servers out there, still
running Perl 4 right now.

*shrugs*

This is reality.

 
> > Skilled and imaginative programmers routinely
> > make use of Perl 4 to write great programs and,
> > have no need for copy and paste Perl 5.
 
> Name me one example.

My own site. It is pure Perl 4. What I have done and
noted by some here, is impossible under Perl 5. I offered
a challenge many months back to replicate my graphical
draw poker game, which is part of one of my chats, a
challenge to do this in Perl 5. One person tried, none
ever succeeded. It cannot be done under Perl 5. A person
here noted I have Artificial Intelligence onboard. This
is true except he didn't notice I have two androids,
Robby and Roberta. Few people ever realize when they
talk with Roberta, they are not talking to a human.
Those of us who talk with Roberta daily, treat her as
human, she is. She distinctly has my personality which
makes her exceptionally annoying in a funny way.

Doing this, Natural Language Emulation, is impossible
under Perl 5. So far, even after extensively searching
our net, I am the only Perl programmer to successfully
write these kinds of programs, which represent only a
few programs of what all is available at my sites.

Our Robby writes Zen Poetry on the fly and, I do mean
on the fly, not from a data base. Some of his poetry
is simply stunning and worth publication. Robby also
takes care of those who try naughty stuff, as many
are learning, the hard way.

Both Roberta and Robby work from dictionaries, thesauruses,
bibliographies, astronomical data bases and, work with 
something I am very proud of, which no other has accomplished
with Perl, an English Grammar Rule Book, hand coded in 
my favorite, Perl 4. This aspect, grammar rules, is absolutely
impossible under Perl 5 with it lacking a 'human' quality
and touch. It is too automated to handle complex programs.
It is too 'strict' to handle imaginative programs which
require bending, if not breaking some rules. If you wrote
some of my programs in Perl 5, they would crash, never run.
Perl 5 would gag and die.

What I have available on my sites, is unavailable anywhere
else on our net, to the best of my knowledge. You should know,
I have searched our net extensively for a couple of years
now, trying to find others doing what I do. I have found
none, not a single Perl programmer involved in what I do,
strictly with Perl 4 because Perl 5 is simply not advanced
enough to handle my programs.

So, you personally have been harassing me for a quite
a period of time. Strut your stuff. Show me what you
can do in Perl 5. Write me a Perl 5 program equally as
extraordinary as one of mine, written in Perl 4. Write
me a wild and imaginative program in Perl 5, something
really different, something offbeat as my programs.

You do actually write programs, correct?



Laughing, I will turn some words around,

"I am stuck with perl 5 is never *good* reason to do 
 *anything*, except maybe to cut your wrists or something."




Work on taking this seriously; I don't bluff.

Godzilla!


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

Date: Mon, 22 May 2000 01:59:35 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: tough naming problem
Message-Id: <392894BD.CFC05AD6@rochester.rr.com>

jkroger wrote:
> 
> Hello, I'm having some trouble with dereferencing variable names.
> 
> A simplified version of my problem is:
> 
> I have five columns in a file, the contents of which I don't know but only
> know the format of:
> 
> a f m q 1
> b g n r 2
> c h o s 3
> . . . . .
> . . . . .
> . . . . .
> 
> This is read into five arrays, arya, aryf, arym, aryq, ary1. I need to,
> for example, put the third value of ary1 into the eighth slot of an array
> whose name is the second element of arya (c[7] = ary1[2]). But I don't
> know the values of arya in advance.

Jim, you are trying to do a *bad thing* (create variables with names
that come from data -- it is bad because you don't know what will be
coming in from the data -- maybe a string that is the same name as some
variable already in your program).  But since you insist:  If $arya[1]
has a value which is a string representing the name of an array to whose
eight slot you want to store the value in the third slot of ary1:

    ${$arya[1]}[7]=$ary1[2]; 

How should you do it if that is a *bad thing*, you ask?  Put references
to the arrays (anonymous) in a hash, with the hash key representing the
name you want to give to the array.  That way you don't corrupt your
namespace with bogus variables, plus the names don't have to be
syntactically correct for Perl.  Something like:

    $hash{$arya[1]}[7]=$ary1[2];

> 
> Whether or not such has already been created, how do I refer to:
> 
> The seventh slot in an array whose name is the second element of arya?
> 
> I tried ${arya[1]}[2], "${arya[1]}[2]", "${arya[1]}"[2], and setting a
------------^---------------^----------------^
You're missing the $ above.

> variable $tmp to the value of $arya[1] and using ${tmp}[2], "${tmp}[2],
$----------------------------------------------------^-----------^
> etc... None of these work.
> 
> Then, how do I refer to the fourth element in and array whose name is the
> first element in the above array (arya[7[1[4]]])? I haven't tried anything
> because since I can't figure out the single dereference above, I have no
> idea how to do the double dereferencing required here.
> 
> I could also ask about how to name the fifth element of an array whose
> name is the element in the array described in the previous sentence. This
> would be a third-degree dereference. In general, how does one name an
> element in an array when the array's name is an element of another array,
> whose name is an element of another array, whose name is an element of
> another array, and so on (assuming all the arrays' names are generated on
> the fly from data and not known in advance)?
> 
> I have looked through "Learning...," "Programming...," and "Perl
> Cookbook." If it is there I have seen it.

You might try the doc's that are already on your hard drive.  In
particular, 

    perldoc perlref

(look at the Symbolic References section).  And mind that symbolic
references always refer to package variables (globals, that is, and not
lexical variables), which may be another reason to not use them.

> 
> Thanks in advance for any help,
> Jim
-- 
Bob Walton


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

Date: 22 May 2000 01:51:00 GMT
From: nj_kanda@alcor.concordia.ca (Neil Kandalgaonkar)
Subject: Re: valid email address
Message-Id: <8ga3q4$dbv$1@newsflash.concordia.ca>

In article <392b6625.7112622@news.skynet.be>,
Bart Lateur <bart.lateur@skynet.be> wrote:
>Neil Kandalgaonkar wrote:
>
>>Finaly, the reliably ingenious Abigail has written a module which 
>>uses Parse::RecDescent to check addresses against RFC 822.
>>It's slow but it seems to work, although
>>the test script shows it misses a few cases. Running the test script
>>with --debug shows just how insanely complex the spec is.
>
>Now I'm curious. Examples, please?

They're all in the test script, test.pl, in the package mentioned.

If you disbelieve, refer to RFC 822:
 <http://www.faqs.org/rfcs/rfc822.html>

Although the "canonical" representations are the email addresses 
that most people are familiar with it allows quite a lot of 
strangeness.


-- 
Neil Kandalgaonkar
neil@brevity.org


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

Date: Mon, 22 May 2000 03:27:04 GMT
From: "Blair Heuer" <ab@cd.com>
Subject: Windows/Linux Incompatibility
Message-Id: <cO1W4.18515$T41.410701@newsread1.prod.itd.earthlink.net>

I have only programmed perl for and on Windows machines, but today my server
administrator switched the server to Linux. ( Hooray for Linux! )

Well, here is the problem. I have a message board system script that I wrote
for the server, which for some reason is not handling the switch very well.
I am unclear on the differences between perl on windows and unix machines.

I have narrowed the problem down to being that the script leaves a return of
some sort after every variable which are taken from a file which seperates
variables by line. The code is then chomped, so it should not have any
problems, right?

Here is the preference loading code:

- code snippet start -
 open PREFS,"$pages/$board/pref.txt" or open PREFS,"$pages/basepref.txt";
   my @boardprefs = <PREFS>;
 close PREFS;
 chomp @boardprefs;

 ( $tablewidth, $tablewidth2, $tablebg, $headerbg,
 $headertxt, $postheadbg, $postheadtxt, $postmainbg,
 $postmaintxt, $postsubbg, $postsubtxt,$subheaderbg,
 $subheadertxt, $linkcolor, $hlinkcolor, $row1color,
 $row1txt, $row2color, $row2txt, $actionbar, $divcolor,
 $defaultfont, $textfieldrows, $textfieldcols, $dateformat,
 $submitstylebg, $submitstyletxt, $submitstylestyle,
 $submitstyleface, $submitstylesize, $fieldstylebg, $fieldstyletxt,
 $fieldstylestyle, $fieldstyleface, $fieldstylesize, $pagebg, $title,
 $url, $time, $sortcolor, $increment, $timezone, $timezonename,
$threadnewcolor,
 $threadoldcolor, $postnewcolor, $postoldcolor ) = @boardprefs;

 $submitstyle = "background-color : $submitstylebg\; color :
$submitstyletxt\; font-weight : $submitstylestyle\; font-family :
$submitstyleface\; font-size : $submitstylesize\pt\;";
 $fieldstyle = "background-color : $fieldstylebg\; color : $fieldstyletxt\;
font-weight : $fieldstylestyle\; font-family : $fieldstyleface\; font-size :
$fieldstylesize\pt\;";

 if ($threadnewcolor == "") { $threadnewcolor = 0; }
 if ($threadoldcolor == "") { $threadoldcolor = 1; }
 if ($postnewcolor == "") { $postnewcolor = 0; }
 if ($postoldcolor == "") { $postoldcolor = 1; }

 my @colors =
('lblue','grey','blue','green','yellow','red','purple','pink','white','orang
e');

 $threadnewcolor = $colors[$threadnewcolor];
 $threadoldcolor = $colors[$threadoldcolor];
 $postnewcolor = $colors[$postnewcolor];
 $postoldcolor = $colors[$postoldcolor];

 if ($sortcolor eq "") { $sortcolor = "black"; }
 if ($time eq "") { $time = "yes"; }
 if ($increment == "") { $increment = 15; }
 if ($timezone == "" or $timezonename eq "") { $timezone = "-8";
$timezonename = "PST"; }
 if ($pagebg eq "") { $pagebg = "#FFFFFF"; }
}

- end code snippet -

The main part is up near the top of that snippet, but I included all the
preference code to be sure. The script can be see 'running' at
http://boards.geosoft.org/?demo. As you will notice, a return is added to
the end of everyvariable, messing up colors and other things such as table
width in some parts.

Any help is appreciated.

- Blair Heuer




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

Date: Sun, 21 May 2000 23:50:50 -0400
From: "Brian Landers" <brian@bluecoat93.org>
Subject: Re: Windows/Linux Incompatibility
Message-Id: <T72W4.1791$dR1.20500@news4.atl>

You might try stripping control-M characters as you read the prefs file.
Windows files have different end-of-line markers than UNIX files. This could
be causing problems. I don't believe chomp() will strip both the control-M
and the \n.

- code snippet start -
open PREFS,"$pages/$board/pref.txt" or open PREFS,"$pages/basepref.txt";
my @boardprefs = <PREFS>;
map { s/\cM// } @boardprefs;  # strip control-M chars from each line
close PREFS;
chomp @boardprefs;

You could combine some of that code (the <> and the map for example) for
simplicity and speed, but you get the idea of the steps involved.

Hope this helps!
Brian

"Blair Heuer" <ab@cd.com> wrote in message
news:cO1W4.18515$T41.410701@newsread1.prod.itd.earthlink.net...
> I have only programmed perl for and on Windows machines, but today my
server
> administrator switched the server to Linux. ( Hooray for Linux! )
>
> Well, here is the problem. I have a message board system script that I
wrote
> for the server, which for some reason is not handling the switch very
well.
> I am unclear on the differences between perl on windows and unix machines.
>
> I have narrowed the problem down to being that the script leaves a return
of
> some sort after every variable which are taken from a file which seperates
> variables by line. The code is then chomped, so it should not have any
> problems, right?
>
> Here is the preference loading code:
>
> - code snippet start -
>  open PREFS,"$pages/$board/pref.txt" or open PREFS,"$pages/basepref.txt";
>    my @boardprefs = <PREFS>;
>  close PREFS;
>  chomp @boardprefs;
>
>  ( $tablewidth, $tablewidth2, $tablebg, $headerbg,
>  $headertxt, $postheadbg, $postheadtxt, $postmainbg,
>  $postmaintxt, $postsubbg, $postsubtxt,$subheaderbg,
>  $subheadertxt, $linkcolor, $hlinkcolor, $row1color,
>  $row1txt, $row2color, $row2txt, $actionbar, $divcolor,
>  $defaultfont, $textfieldrows, $textfieldcols, $dateformat,
>  $submitstylebg, $submitstyletxt, $submitstylestyle,
>  $submitstyleface, $submitstylesize, $fieldstylebg, $fieldstyletxt,
>  $fieldstylestyle, $fieldstyleface, $fieldstylesize, $pagebg, $title,
>  $url, $time, $sortcolor, $increment, $timezone, $timezonename,
> $threadnewcolor,
>  $threadoldcolor, $postnewcolor, $postoldcolor ) = @boardprefs;
>
>  $submitstyle = "background-color : $submitstylebg\; color :
> $submitstyletxt\; font-weight : $submitstylestyle\; font-family :
> $submitstyleface\; font-size : $submitstylesize\pt\;";
>  $fieldstyle = "background-color : $fieldstylebg\; color :
$fieldstyletxt\;
> font-weight : $fieldstylestyle\; font-family : $fieldstyleface\; font-size
:
> $fieldstylesize\pt\;";
>
>  if ($threadnewcolor == "") { $threadnewcolor = 0; }
>  if ($threadoldcolor == "") { $threadoldcolor = 1; }
>  if ($postnewcolor == "") { $postnewcolor = 0; }
>  if ($postoldcolor == "") { $postoldcolor = 1; }
>
>  my @colors =
>
('lblue','grey','blue','green','yellow','red','purple','pink','white','orang
> e');
>
>  $threadnewcolor = $colors[$threadnewcolor];
>  $threadoldcolor = $colors[$threadoldcolor];
>  $postnewcolor = $colors[$postnewcolor];
>  $postoldcolor = $colors[$postoldcolor];
>
>  if ($sortcolor eq "") { $sortcolor = "black"; }
>  if ($time eq "") { $time = "yes"; }
>  if ($increment == "") { $increment = 15; }
>  if ($timezone == "" or $timezonename eq "") { $timezone = "-8";
> $timezonename = "PST"; }
>  if ($pagebg eq "") { $pagebg = "#FFFFFF"; }
> }
>
> - end code snippet -
>
> The main part is up near the top of that snippet, but I included all the
> preference code to be sure. The script can be see 'running' at
> http://boards.geosoft.org/?demo. As you will notice, a return is added to
> the end of everyvariable, messing up colors and other things such as table
> width in some parts.
>
> Any help is appreciated.
>
> - Blair Heuer
>
>




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

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


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V9 Issue 3116
**************************************


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