[19333] in Perl-Users-Digest
Perl-Users Digest, Issue: 1528 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Aug 15 06:15:55 2001
Date: Wed, 15 Aug 2001 03:15:24 -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: <997870522-v10-i1528@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 15 Aug 2001 Volume: 10 Number: 1528
Today's topics:
Re: Reaping zombies in Win32 Perl CGIs <goldbb2@earthlink.net>
Re: Reaping zombies in Win32 Perl CGIs <goldbb2@earthlink.net>
Re: regex with ascii code - chr(0) ? <gbeymk@sgh.com.sg>
screen resolution detection <lukehall@ace-net.com.au>
Re: screen resolution detection (Logan Shaw)
Re: Sorting Hash of Arrays (Tad McClellan)
Re: Stateful CGI - user auth <Dave.Stafford@globis.net>
Re: Stateful CGI - user auth <flavell@mail.cern.ch>
substitution - Linux v Win32 <wyzelli@yahoo.com>
Re: Test coverage without Devel:Coverage (Chris Fedde)
Using a fake name on this newsgroup and in places like <miscellaneousemail@yahoo.com>
Re: Using a fake name on this newsgroup and in places l <godzilla@stomp.stomp.tokyo>
Re: Using a fake name on this newsgroup and in places l (Eric Bohlman)
Re: Using a fake name on this newsgroup and in places l <paul@net366.com>
What is a typeglob?? <miscellaneousemail@yahoo.com>
Re: What is a typeglob?? <miscellaneousemail@yahoo.com>
Re: What is a typeglob?? (Tad McClellan)
Why is there so much white space in perl documentation? <miscellaneousemail@yahoo.com>
Re: Why is there so much white space in perl documentat <dtweed@acm.org>
Re: Why is there so much white space in perl documentat <miscellaneousemail@yahoo.com>
Re: Why is there so much white space in perl documentat (Tad McClellan)
Re: Why is there so much white space in perl documentat <krahnj@acm.org>
Re: Why is there so much white space in perl documentat <miscellaneousemail@yahoo.com>
Re: Win32::GUI <kalinabears@hdc.com.au>
Re: Write to middle of file <goldbb2@earthlink.net>
Re: Zapping a DB_File hash? (Tad McClellan)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 15 Aug 2001 05:22:53 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Reaping zombies in Win32 Perl CGIs
Message-Id: <3B7A3F6D.9E2AD9B3@earthlink.net>
Bart Lateur wrote:
>
> Moth Mann wrote:
>
> >Unfortunately, even though I do not have to worry about zombies, I still
> >cannot seem to do what I want. Testing on the command line, when I do a
> >fork in ActiveState Perl in Winblows 2000, I don't get the prompt back
> >until the children finish executing.
The reason for this is that Winblows, fork() is implemented by
creating a program thread, not an actual new process.
>
> Ah, yes. That's true.
>
> Perhaps you can try a Windows-only solution, and use the ShellExecute()
> API call, through the Win32::API module. ShellExecute() is much like
> system() in concept, but it mainly serves to launch Windows programs,
> which means that it won't wait until they're finished to return. It
> returns immediately. The launched programs run asynchronously.
>
> But it does involve an elaborate scheme for passing your data to the
> program. You could save your data to a temporary file and pass that to
> your program, but then you'd still need to delete it when you're done.
> Perhaps there are better solutions specific for NT, but I'm not too
> familiar with that. What I described here would work on all flavours of
> Windows.
Write your data to a file, use ShellExecute to call a *second* perl
program which reads from that file, passes it's contents to blat or
whatever, then deletes that file. You can pass the filename of the
data from the perl/cgi program to the second perl program using the
commandline.
--
I'm not a programmer but I play one on TV...
------------------------------
Date: Wed, 15 Aug 2001 05:27:03 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Reaping zombies in Win32 Perl CGIs
Message-Id: <3B7A4067.EC643421@earthlink.net>
Moth Mann wrote:
>
> I'm writing a CGI in Perl that wants to send mail. Unfortunately, I
> have to do it under some wierd operating system marketed by MicroSoft.
> (It's the misnamed Windows 2000.) And this wierd OS does not have
> sendmail. So I use Net::SMTP to send the mail, which works.
>
> But! Sending the mail through the local SMTP sever takes a few
> seconds, which means that the web page takes a few seconds to come
> back, and that's a little annoying.
Then close the STDIN and STDOUT file descriptors after you've written
the web page, but before you do the SMTP stuff.
This is the portable solution.
> So! I came up with the bright idea of forking off a child process to
> do the actual talking to the SMTP server so I can return a page
> quickly and still have the mail be sent. Thanks to the heroic efforts
> of people I have never met, I can do this in ActiveState Perl 5.6.1
> for lame Win32.
Sadly, fork() on Win creates threads, not true child processes.
They might look like children, but they're evil monsters.
--
I'm not a programmer but I play one on TV...
------------------------------
Date: Wed, 15 Aug 2001 09:35:22 +0800
From: YMK <gbeymk@sgh.com.sg>
Subject: Re: regex with ascii code - chr(0) ?
Message-Id: <3B79D1DA.1B15324C@sgh.com.sg>
Thank you. I got 3 replies for my question. They worked !
I still have a long way to go with perl !
> ## 1: by John Taylor ##
> $theChar = sprintf("%c", 0); # 0 being the character code in question. This
> can be changed to any ASCII code.
> $inputField =~ s/$theChar//;
>
> ## 2: by Bart ##
> You mean "\c@"? Or "\000". Yes, both work in regexes (without the
> quotes).
>
> ## 3: by John W. Krahn ##
> s/\0//;
>
> Or if you have more than one.
>
> tr/\0//d;
>
> ## my question ##
> YMK wrote:
> >
> > I have a field which allow pressing <Enter> key within it !
> > When I take a look on it, I see "...^@ ...", i.e. whenever a <Enter>
> > is pressed,
> > it will shown as ^@ follow by 4 spaces.
> >
> > ^@ is a single character (as in vi), when I read it (i.e. substr), that
> > give chr(0)!
> >
> > I am trying to get rid of ^@ with s/chr(0)//, but it did not work !
> > How should I do it ?
------------------------------
Date: Wed, 15 Aug 2001 13:33:06 +1000
From: "MrMean" <lukehall@ace-net.com.au>
Subject: screen resolution detection
Message-Id: <3b79ece7@nap-ns1.netconnect.net.au>
I'm trying to resize erverthing on my site to allow for users who are
browsing in 640x480, 800x600, 1024x768.
I've built the site on 800x600.
Anyone know how to detect the screen resolution?
------------------------------
Date: 15 Aug 2001 01:46:29 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: screen resolution detection
Message-Id: <9ld5s5$5av$1@charity.cs.utexas.edu>
In article <3b79ece7@nap-ns1.netconnect.net.au>,
MrMean <lukehall@ace-net.com.au> wrote:
>I'm trying to resize erverthing on my site to allow for users who are
>browsing in 640x480, 800x600, 1024x768.
>
>I've built the site on 800x600.
My screen resolution is 1280x1024. Why should I help you when you want
to exclude me?
>Anyone know how to detect the screen resolution?
You can't. No HTML or HTTP standard that I know of even specifies that
there has to BE a screen resolution at the other end. Some users are
blind, and don't use a screen at all. Some use text-based browsers
where resolution is meaningless and all that matters is rows and
columns of text.
In theory, one could use a vector-based display to implement a
graphical browser, and also one could certainly use a scalable outline
format (like display postscript) so that how much the web browser
displays isn't directly connected to the screen resolution.
Or, like I do, one could set their fonts to a larger size than you
might expect, so that if you attempt to guess at things based on
resolution, you'll be way off.
The best idea is to make a web site that will look reasonable on all
reasonable web browsers. Since you can never predict how all
reasonable web browsers will behave, the only real way to do this is to
avoid doing things on a case-by-case basis.
Also, what does this have to do with Perl?
- Logan
--
"Our grandkids love that we get Roadrunner and digital cable."
(Advertisement for Time Warner cable TV and internet access, July 2001)
------------------------------
Date: Tue, 14 Aug 2001 21:45:28 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Sorting Hash of Arrays
Message-Id: <slrn9njl1o.bt7.tadmc@tadmc26.august.net>
Malcolm Dew-Jones <yf110@vtn1.victoria.tc.ca> wrote:
>Tad McClellan (tadmc@augustmail.com) wrote:
>: Malcolm Dew-Jones <yf110@vtn1.victoria.tc.ca> wrote:
>: >Drew Myers (bh_ent@hotmail.com) wrote:
>: >: 1) Is it possible to sort any field of a hash of arrays via the
>: >: Schwartzian Transform?
>
>
>: You can sort arrays.
>: >%HoA is a hash. It isn't possible to sort the keys of a hash, you can
>: >only sort elements in an array.
^^^^
^^^^
>: A "list" actually:
>
>Are you saying you can "only sort elements in a *list*". ?
Yes.
And I'm not the only one that says that:
perldoc -f sort
=item sort SUBNAME LIST
=item sort BLOCK LIST
=item sort LIST
lotsa lists, zero arrays :-)
The difference between lists and arrays often doesn't make
much difference due to Perl's DWIMery, but sometimes it
does. Hence the Perl FAQ:
"What is the difference between a list and an array?"
>I meant an
>array as opposed to a hash - i.e. given a hash and an array, only the
>array can be sorted.
Yes, I knew that was what you meant. My followup was for the
benefit of any less discerning readers :-)
If you hadn't included the "only", I wouldn't have said anything
about it.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 15 Aug 2001 07:54:27 GMT
From: "Dave Stafford" <Dave.Stafford@globis.net>
Subject: Re: Stateful CGI - user auth
Message-Id: <TUpe7.424131$XL1.7073760@nlnews00.chello.com>
"Dan Baker" <dan@nospam_dtbakerprojects.com> wrote in message
> the simplest *fairly* secure method is not perl at all, but to use the
> webserver's auth system by adding a .htaccess file to the tree you are
> trying to restrict.
With the caveat that the password is transmitted unencrypted in the header.
So if you use this you should use a secure session for the login.
> There are other *secure* schemes, (but cookies are NOT one of them!).
There is no such thing as a truely secure system as they usually involve
people:-)
However Dan is wrong. Cookie-based authentication can be much more secure
than basic authentication which is *very* insecure. Paswords are transmitted
clear text, it is extremely vulnerable to spoofing, brute force and replay
attacks, it has no timeout mechanism, etc. etc.
You have several advantages with cookies, the primary being you can
manipulate (and encrypt) the information in it, thereby reducing (not
eliminating) the above problems.
If the cookie is held in memory (i.e. not written to disk), and uses a
session string that is encrypted it is significantly more secure as you can
invoke a timeout on the session, and if you add a digest based login
mechanism, the password never has to be transmitted across the network. (See
http://pajhome.org.uk/crypt/md5/index.html for a good example)
> But they can get pretty involved. I wish I knew more about how some of
> the big boys do it, and if it would be reasonable to implement for
> smaller clients...
Many of the "big boys* do use cookies, basic auth combined with secure
sessions etc. Very few use digital certificates, lots use time-based systems
like Secure ID.
The biggest problem is however password maintenance. Users will choose weak,
easy to guess passwords which immediately screw up the strongest
authentication systems. You can generate passwords for them, but then the
user with often write it down because it is too hard to remember.
Public/private key systems can also be used, but frankly at this time they
are just as weak as userid/passwords because users do not sufficiently
understand them, and do not properly protect them. During security scans, I
have gone to unattended PC's and saved unencrypted public/private key pairs
to a floppy.
Systems like SecurID cards can help with password maintenance as they use a
time-based mechanism which effectively changes the password every 10
seconds. However, they only authenticate the card, not the person.
Basically there are no easy answers.
The easiest mechanism with reasonable security is to use a secure session
combined with basic authentication, ie. userid/password. Let the user choose
his own password, but check it for strength before accepting it. Change
passwords reasonably often (3/4 months), and scan logs for repeated failed
attempts. Disable login accounts after e.g. 4 failed attempts.
Dave
------------------------------
Date: Wed, 15 Aug 2001 11:27:19 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Stateful CGI - user auth
Message-Id: <Pine.LNX.4.30.0108151116330.27957-100000@lxplus023.cern.ch>
On Aug 15, Dave Stafford twiddled the eigenstates thus:
> With the caveat that the password is transmitted unencrypted in the header.
right
> So if you use this you should use a secure session
If your security audit calls for that level of safety then yes, you
should; but use of https has other significant consequences, so it
should not merely be adopted by rote.
> for the login.
This is basic authentication we're talking about here. There _is_ no
"login": it's sloppy talk to call it that, and it routinely leads to
misunderstandings and additional insecurities. Access to web pages is
inherently stateless, there is _no_ ongoing "session" in the formal
sense, credentials are exchanged on every access to protected pages,
and the client software's maintenance of those credentials is
undefined: they might persist indefinitely.
[your other comments, with which I had no fundamental disagreement,
now snipped]
------------------------------
Date: Wed, 15 Aug 2001 14:29:12 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: substitution - Linux v Win32
Message-Id: <nfne7.73$1T.191471@wa.nnrp.telstra.net>
I have a squid log file on my Linux server, which I want to copy onto my
local drive (win2k) before processing.
Naturally if I copy the file from the Samba share, I have the \r\n v \n
problem which I can easily fix by doing:
perl -p -i*.bak -e "s/\r\n/\n/g" filename
I thought, to make life easier (laziness part of things?) I would cp the
file via a cron job, and I may as well run the substitution there as well,
that way the file is all ready for me in the morning.
But alas, running the same command on the Linux box via telnet (s/"/'/) does
not affect the original file at all, though the .bak is created quite
happily.
I have not yet delved much into Perl's command line options, and wonder if I
am missing something, or is this not something I can do on the Linux box?
Any ideas?
Wyzelli
--
push@x,$_ for(a..z);push@x,' ';
@z='092018192600131419070417261504171126070002100417'=~/(..)/g;
foreach $y(@z){$_.=$x[$y]}y/jp/JP/;print;
------------------------------
Date: Wed, 15 Aug 2001 05:31:24 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: Test coverage without Devel:Coverage
Message-Id: <MOne7.112$V3.170765312@news.frii.net>
In article <9lb565$eg$3@proxy.fe.internet.bosch.com>,
Rui Nogueira <Rui.Nogueira@de.bosch.com> wrote:
>Hi to all,
>
>I want to know the test coverage of my Perl-script (some thousands of code
>lines).
>I found the Devel::Coverage module. But as this tool is still in the alpha
>phase I now want to make something own.
>Does anybody of you know how I can do it without using the Devel::Coverage
>module?
>The point would be to know, when a certain sub routine of my script is
>calling another routine or an "if", "foreach" or "while" command is reached
>in my code.
>
I'd down load and install the Devel::Coverage and figure out how
it goes about it's work. Then I'd figure out why it is alpha and
start working on what needs to be fixed. Some where along the
line you could contact the author and ask for his comments too.
Good Luck
chris
--
This space intentionally left blank
------------------------------
Date: Wed, 15 Aug 2001 03:12:47 GMT
From: Carlos C. Gonzalez <miscellaneousemail@yahoo.com>
Subject: Using a fake name on this newsgroup and in places like perlmonks??
Message-Id: <MPG.15e396a698e576af989748@news.edmonton.telusplanet.net>
Hi everyone,
I've been looking around at www.perlmonks.org and noticed that everyone
there goes by fake names such as reptile, ChemBoy, and others. Sometimes
I see some usenet messages from others that way too. I've even gotten
some usenet messages that have real sounding names only to learn later
when the authors email me that they are called by some other name.
Maybe I am being naive about the Internet or something but I was
wondering why people use fake names so much? Especially when discussing
something as acceptable as Perl?
I could understand it if say one was the President and wanted to remain
anonymous in order to be able to speak freely without having the press
blow everything out of proportion but for the average Perl programmer is
there a reason to hide one's identity?
I don't know. I am asking sincerely. Maybe I am missing something and
should start hiding my real name too but it would seem that using a fake
name would open the door for me to not be accountable for what I say
(since it wouldn't be me saying it sort of thing).
Any thoughts on this?
---
Carlos
www.internetsuccess.ca
*NOTE*: Internet Success is NOT yet fully operational so although you are
welcomed to visit and take a look, trying to subscribe will only be a
frustration for you as your data will not be saved at this time.
------------------------------
Date: Tue, 14 Aug 2001 21:26:35 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Using a fake name on this newsgroup and in places like perlmonks??
Message-Id: <3B79F9FB.B206DB4A@stomp.stomp.tokyo>
Carlos C. Gonzalez wrote:
(snipped)
> Maybe I am missing something...
> Any thoughts on this?
Yes, one thought.
What you are missing leaves you without an
ability to think about what you are missing.
Godzilla!
------------------------------
Date: 15 Aug 2001 04:46:18 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: Using a fake name on this newsgroup and in places like perlmonks??
Message-Id: <9lcuqq$2ub$1@bob.news.rcn.net>
Carlos C. Gonzalez <miscellaneousemail@yahoo.com> wrote:
> I've been looking around at www.perlmonks.org and noticed that everyone
> there goes by fake names such as reptile, ChemBoy, and others. Sometimes
> I see some usenet messages from others that way too. I've even gotten
> some usenet messages that have real sounding names only to learn later
> when the authors email me that they are called by some other name.
> Maybe I am being naive about the Internet or something but I was
> wondering why people use fake names so much? Especially when discussing
> something as acceptable as Perl?
Some people simply like constructing artificial personas for themselves.
I don't know if you're old enough to remember the CB craze of the 1970s,
but people always made up "handles" for themselves. It's also very common
in chat rooms, and among people into role-playing games. I've never been
into handle-creation myself, but I can sort of understand why some people
like to do it.
------------------------------
Date: Wed, 15 Aug 2001 08:34:10 +0100
From: "Paul Fortescue" <paul@net366.com>
Subject: Re: Using a fake name on this newsgroup and in places like perlmonks??
Message-Id: <997860777.9224.0.nnrp-07.d4f094e4@news.demon.co.uk>
"Carlos C. Gonzalez" <miscellaneousemail@yahoo.com> wrote in message
news:MPG.15e396a698e576af989748@news.edmonton.telusplanet.net...
> Hi everyone,
>
> I've been looking around at www.perlmonks.org and noticed that everyone
> there goes by fake names such as reptile, ChemBoy, and others. Sometimes
> I see some usenet messages from others that way too. I've even gotten
> some usenet messages that have real sounding names only to learn later
> when the authors email me that they are called by some other name.
>
> Maybe I am being naive about the Internet or something but I was
> wondering why people use fake names so much? Especially when discussing
> something as acceptable as Perl?
>
> I could understand it if say one was the President and wanted to remain
> anonymous in order to be able to speak freely without having the press
> blow everything out of proportion but for the average Perl programmer is
> there a reason to hide one's identity?
>
> I don't know. I am asking sincerely. Maybe I am missing something and
> should start hiding my real name too but it would seem that using a fake
> name would open the door for me to not be accountable for what I say
> (since it wouldn't be me saying it sort of thing).
>
> Any thoughts on this?
>
> ---
> Carlos
I wondered about that too. If I had a name like Arthur Shithead, I might
disguise it. I think people might think it's clever to use pseudonyms (and
indeed to be able to spell same). However, if you look at some of the
'greats' on these pages, like Ilya, Tad, Bart etc, they don't need to
disguise themselves, so I would take encouragement from that!
Regards - Paul Fortescue, (my real name), good isn't it?
------------------------------
Date: Wed, 15 Aug 2001 02:33:38 GMT
From: Carlos C. Gonzalez <miscellaneousemail@yahoo.com>
Subject: What is a typeglob??
Message-Id: <MPG.15e38d34bf483741989745@news.edmonton.telusplanet.net>
Hi everyone,
I was reading through the section titled "Typeglobs and Filehandles" in
perldata and was left wondering what a typeglob is. Can someone explain
this term to me?
I think from what I was reading that a typeglob is any variable that has
a "*" before it. Does this allow that variable to be a reference to any
other type (like a hash, scalar, array, etc.)?
Are typeglobs anything like void pointers in C?
Thanks.
---
Carlos
www.internetsuccess.ca
*NOTE*: Internet Success is NOT yet fully operational so although you are
welcomed to visit and take a look, trying to subscribe will only be a
frustration for you as your data will not be saved at this time.
------------------------------
Date: Wed, 15 Aug 2001 02:38:57 GMT
From: Carlos C. Gonzalez <miscellaneousemail@yahoo.com>
Subject: Re: What is a typeglob??
Message-Id: <MPG.15e38e746e7f5f86989746@news.edmonton.telusplanet.net>
In article <MPG.15e38d34bf483741989745@news.edmonton.telusplanet.net>,
Carlos C. Gonzalez at miscellaneousemail@yahoo.com says...
From from perlfaq7....
"If you're passing around filehandles, you could usually just use the
bare typeglob, like *STDOUT, but typeglobs references would be better
because they'll still work properly under use strict 'refs'..."
Are there two types of typeglob? A bare typeglob and then a typeglob
reference?
I think a bare typeglob is *<variable name> whereas a typeglob reference
is \*<variable>. Is that right?
Thanks.
---
Carlos
www.internetsuccess.ca
*NOTE*: Internet Success is NOT yet fully operational so although you are
welcomed to visit and take a look, trying to subscribe will only be a
frustration for you as your data will not be saved at this time.
------------------------------
Date: Wed, 15 Aug 2001 00:57:06 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: What is a typeglob??
Message-Id: <slrn9nk092.c6u.tadmc@tadmc26.august.net>
Carlos C. Gonzalez <miscellaneousemail@yahoo.com> wrote:
>In article <MPG.15e38d34bf483741989745@news.edmonton.telusplanet.net>,
>Carlos C. Gonzalez at miscellaneousemail@yahoo.com says...
>
>From from perlfaq7....
>
>"If you're passing around filehandles, you could usually just use the
>bare typeglob, like *STDOUT, but typeglobs references would be better
>because they'll still work properly under use strict 'refs'..."
>
>Are there two types of typeglob?
No.
>A bare typeglob and then a typeglob
>reference?
read "typeglobs references" as "references to typeglobs".
>I think a bare typeglob is *<variable name> whereas a typeglob reference
^^^^^^^^^^^^^
>is \*<variable>. Is that right?
^^^^^^^^
Right. (assuming the meta-names where meant to be the same)
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 15 Aug 2001 02:12:53 GMT
From: Carlos C. Gonzalez <miscellaneousemail@yahoo.com>
Subject: Why is there so much white space in perl documentation??
Message-Id: <MPG.15e388087826383c989744@news.edmonton.telusplanet.net>
Hi everyone,
I was reading through some more Perl documentation (good stuff) and
couldn't help but notice again that there is a lot of white space in the
code examples given. All code examples are double spaced and sometimes
even triple spaced.
I noticed this today because I was trying to follow some code in my
browser and was having to scroll up and down to see it well.
Of all the documentation that I have read on the web, in books, and
otherwise the perl documentation on-line is the only place where the code
is at least double spaced if not more. I daresay that if I wrote my code
snippets that way in usenet messages I would get a lot of comments asking
me not to do that.
Any comments on this double spacing as to why it is that way in the
documentation and whether code examples will be single spaced in future
versions of the documenation?
Thanks. Just my two cents worth for what it is worth.
--
Carlos
www.internetsuccess.ca
*NOTE*: Internet Success is NOT yet fully operational so although you are
welcomed to visit and take a look, trying to subscribe will only be a
frustration for you as your data will not be saved at this time.
------------------------------
Date: Wed, 15 Aug 2001 02:52:28 GMT
From: Dave Tweed <dtweed@acm.org>
Subject: Re: Why is there so much white space in perl documentation??
Message-Id: <3B79E2EE.A0F2EF1B@acm.org>
"Carlos C. Gonzalez" wrote:
> I was reading through some more Perl documentation (good stuff) and
> couldn't help but notice again that there is a lot of white space in the
> code examples given. All code examples are double spaced and sometimes
> even triple spaced.
>
> I noticed this today because I was trying to follow some code in my
> browser and was having to scroll up and down to see it well.
It's a bug in your browser. For example, I noticed that Netscape puts
an extra ^M at the end of each line under certain circumstances. This
has no effect when laying out regular HTML, but in a <pre> section (such
as code examples), this causes the doublespace effect.
No, I don't know how to fix it, other than to save the page locally and
use a text editor to remove the extra ^Ms.
-- Dave Tweed
------------------------------
Date: Wed, 15 Aug 2001 04:33:21 GMT
From: Carlos C. Gonzalez <miscellaneousemail@yahoo.com>
Subject: Re: Why is there so much white space in perl documentation??
Message-Id: <MPG.15e3a3acaffce49498974a@news.edmonton.telusplanet.net>
In article <3B79E2EE.A0F2EF1B@acm.org>, Dave Tweed at dtweed@acm.org
says...
> It's a bug in your browser. For example, I noticed that Netscape puts
> an extra ^M at the end of each line under certain circumstances. This
> has no effect when laying out regular HTML, but in a <pre> section (such
> as code examples), this causes the doublespace effect.
Thanks Dave. I feel kinda stupid. After looking at it some and going
out to www.perldoc.com I realized that what I had been looking at was my
local copy of the documentation put out by ActiveState. I guess I will
go back to learning how to traverse through the www.perldoc.com stuff.
The documentation looks much better there than on my local machine.
Sometimes in the multitude of open windows that I have I get somewhat
confused as to what is what. Must be my advancing age =:).
---
Carlos
www.internetsuccess.ca
*NOTE*: Internet Success is NOT yet fully operational so although you are
welcomed to visit and take a look, trying to subscribe will only be a
frustration for you as your data will not be saved at this time.
------------------------------
Date: Wed, 15 Aug 2001 01:12:24 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Why is there so much white space in perl documentation??
Message-Id: <slrn9nk15o.c6u.tadmc@tadmc26.august.net>
Carlos C. Gonzalez <miscellaneousemail@yahoo.com> wrote:
>In article <3B79E2EE.A0F2EF1B@acm.org>, Dave Tweed at dtweed@acm.org
>says...
>
>> It's a bug in your browser.
>Thanks Dave. I feel kinda stupid.
For using a browser to read docs, I hope?
>After looking at it some and going
>out to www.perldoc.com I realized that what I had been looking at was my
>local copy of the documentation put out by ActiveState. I guess I will
>go back to learning how to traverse through the www.perldoc.com stuff.
>The documentation looks much better there than on my local machine.
Heavens no!
I use the raw *.pod files and a programmer's editor.
Does AS give you the actual .pod files that the .html files
are derived from?
If not, then I'd go get the *.pods. Once you have those, you
can run them through pod2html, pod2latex, or whatever.
I only use HTML versions of the docs for printing. Then I put
the printouts in the smallest room in my house for when ...
uhh... I have time to read them.
>Sometimes in the multitude of open windows that I have I get somewhat
>confused as to what is what. Must be my advancing age =:).
Birthdays are good for you! A federally funded study has shown
that people with the most birthdays live the longest!
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 15 Aug 2001 06:27:19 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Why is there so much white space in perl documentation??
Message-Id: <3B7A16EB.EADAE516@acm.org>
Tad McClellan wrote:
>
> I only use HTML versions of the docs for printing. Then I put
> the printouts in the smallest room in my house for when ...
The hall closet? You're a closet reader? I'd heard rumours about
Texans but ...
> uhh... I have time to read them.
:-{)
John
--
use Perl;
program
fulfillment
------------------------------
Date: Wed, 15 Aug 2001 06:59:15 GMT
From: Carlos C. Gonzalez <miscellaneousemail@yahoo.com>
Subject: Re: Why is there so much white space in perl documentation??
Message-Id: <MPG.15e3cb50c7bc407698974f@news.edmonton.telusplanet.net>
In article <slrn9nk15o.c6u.tadmc@tadmc26.august.net>, Tad McClellan at
tadmc@augustmail.com says...
> >Thanks Dave. I feel kinda stupid.
> For using a browser to read docs, I hope?
>
Nope. For having thought what I was looking at was the official Perl
documentation instead of realizing I was looking at a copy of it made by
ActiveState.
> >The documentation looks much better there than on my local machine.
> Heavens no!
>
> I use the raw *.pod files
Ugh. Yuk. On my Windows 98 the pod files look absolutely terrible from
the DOS prompt. I feel like I am looking into a black hole with little
white letters in it =:).
> and a programmer's editor.
Getting the output of something like "perldoc -f push" into my editor of
choice is a pain on Windows. Maybe I will have to switch editors. I
have been toying with VIM lately but whew! What a different way of doing
things. Where did all the menus and nice clean, mouseable interfaces go?
=:). Got to hand it to you Unix types.
>
> Does AS give you the actual .pod files that the .html files
> are derived from?
Yup. But trying to read them in an editor is not very good for me.
There are a bunch of =head1, =pod, etc.. statements in them. And they
are not nicely formatted in color like the www.perldoc.com ones are.
>
> If not, then I'd go get the *.pods. Once you have those, you
> can run them through pod2html, pod2latex, or whatever.
Oh. I see what you mean. I may try that but it sure is a lot easier
just to go to www.perldoc.com and link through everything that is already
created for me. Did someone say laziness is a mark of a good programmer?
=:).
> Birthdays are good for you! A federally funded study has shown
> that people with the most birthdays live the longest!
Hmmm....food for thought. =:).
---
Carlos
www.internetsuccess.ca
*NOTE*: Internet Success is NOT yet fully operational so although you are
welcomed to visit and take a look, trying to subscribe will only be a
frustration for you as your data will not be saved at this time.
------------------------------
Date: Wed, 15 Aug 2001 18:35:20 +1000
From: "Sisyphus" <kalinabears@hdc.com.au>
Subject: Re: Win32::GUI
Message-Id: <997900796.5031@clover.origin.net.au>
"Philippe PERRIN" <philippe.perrin@sxb.bsf.alcatel.fr> wrote in message
news:3B791306.4F6CF974@sxb.bsf.alcatel.fr...
> could anyone tell me where I can find detailed reference for this
> package (syntax, examples...) ?
>
> Thanks !
Download the module from cpan. That distribution contains good tuts and
samples. ( Just check that nothing came with the AS dist. if you haven't
already.)
There's also a Win32::GUI-specific mailing list.
Cheers,
Rob
------------------------------
Date: Wed, 15 Aug 2001 04:01:25 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Write to middle of file
Message-Id: <3B7A2C55.F824A732@earthlink.net>
Sean Hamilton wrote:
>
> Greetings,
>
> I have a fairly large (50+mb) file, into which I wish to write.
>
> I'd rather not read the whole thing into memory, modify, clear, write,
> for obvious reasons.
>
> The logical thing to do seems to be:
>
> Open file A for reading.
> Apply shared lock onto A.
> Open temp file B for writing.
> Apply exclusive lock onto B.
> Write A into B until arriving at the point at which stuff needs to be
> written.
> Write new stuff to B.
> Write A into B until eof.
Person X opens B and gets a lock [either shared or exclusive] on it in
between the time you open it and the time you lock it. Then, person X
opens A, and requests an exclusive lock on A. Deadlock!
Perhaps there's some order of opening and locking which avoids this?
> Now here is the problem: I should then delete A and rename B to A.
> However, I fear the brief period of time in which A is absent will
> break things.
renaming B to A should also delete the old contents of A, in a manner
that looks atomic. However, if anyone has open file descriptors to A
[with or without locks], they will end up getting the old contents of A,
possibly without realizing it.
To avoid this, the program editing A needs to get an exclusive lock on A
[after all, you *are* going to be changing it, sorta], and the programs
reading from A should do something like the following:
open( my $file, "<", "fileA" ) or die ...
GETLOCK: {
flock( $file, LOCK_SH ) or die ...
open( my $test, "<", "fileA" ) or die ...;
my $f_dev_inode = join $;, (stat $file)[0,1];
my $c_dev_inode = join $;, (stat $test)[0,1];
last GETLOCK if $f_dev_inode eq $c_dev_inode;
$file = $test;
redo GETLOCK;
}
The only times you can "just" get a lock, and be sure of safety, is when
you really are editing the file. If you're making a modified version
and replacing the original with the new version, ensuring safety gets a
tad more complicated.
--
I'm not a programmer but I play one on TV...
------------------------------
Date: Tue, 14 Aug 2001 23:37:59 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Zapping a DB_File hash?
Message-Id: <slrn9njrkn.bt7.tadmc@tadmc26.august.net>
Carlos C. Gonzalez <miscellaneousemail@yahoo.com> wrote:
>In article <slrn9nj8a9.bh8.tadmc@tadmc26.august.net>, Tad McClellan at
>tadmc@augustmail.com says...
>> Carlos C. Gonzalez <miscellaneousemail@yahoo.com> wrote:
>> >
>> >I am learning to work with hashes and was wondering if there was some way
>> >to zap a hash completely?
>>
>>
>> %hash = (); # empty out the hash, keep its memory in case
>> # you put anything back into it
>>
>
>When you say keep it's memory I am assuming you mean the memory taken up
>by the hash variable and not by the contents of the hash. Is this
>assumption correct?
I'm not sure what "contents of the hash" means. All of the
keys and values, I assume?
The above "keeps" the memory that was used for all the keys
and values in %hash. The memory is still associated with %hash,
so it won't need to be reallocated when you start putting
things in there again.
Maybe you mean the memory associated with references in the
hash values? If so, _that_ memory would go back to the perl
process to be used for other things in your program (subject
to reference counting).
>When you put something back into a hash does Perl dynamically allocate
>increased memory for the contents and then shrink (free) it as you delete
>items from the hash? Or does a Perl hash just grow and grow and grow
>without it's memory storage ever being dynamically decreased?
I don't know perl's internals. I know it grows, I doubt that
it shrinks. Perhaps I should go have a look at the source code...
If you're worried about it, just ensure that it goes out of scope
as soon as you are done with it.
>(leading to
^^^^^^^^^^
>it being better to read parts of a file into a hash rather than the whole
>thing all at once).
It is _always_ better to do parts of a file rather than the
entire file, if you can.
So even if they did shrink, it would _still_ be better to do parts. :-)
>> undef %hash; # get the memory back for other uses
>
>Does undefining a hash release the memory taken up by the hash variable
>as well as that taken up by it's contents. All in one operation?
Yes. (for _either_ interpretation of "hash contents", with ref counting)
There are some bits in the Perl FAQs:
"How can I free an array or hash so my program shrinks?"
"How can I make my Perl program take less memory?"
Worrying about memory usage is not something I'm going to spend
much time on. That's why I use Perl, I don't want to have to
spend time with "housekeeping" tasks, I just want to finish
the task the program is supposed to perform.
Memory management is not My Job. Accomplishing the processing
required is My Job.
:-)
(tempered with _some_ consideration of memory, as prudent of course)
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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 V10 Issue 1528
***************************************