[8831] in Perl-Users-Digest
Perl-Users Digest, Issue: 2448 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Apr 28 21:04:31 1998
Date: Tue, 28 Apr 98 18:00:33 -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 Tue, 28 Apr 1998 Volume: 8 Number: 2448
Today's topics:
Re: "Slurp"? (Craig Berry)
Re: 'each' and recursion, do they mix? (Ken Fox)
Re: ANNOUNCE: Perl Builder IDE Now Available (Dr. Fridemar Pache)
Re: ANNOUNCE: Perl Builder IDE Now Available (Craig Berry)
Re: ANNOUNCE: Perl Builder IDE Now Available <grinch@whoville.com>
Re: cgi-lib.pl or CGI.pm? (Martien Verbruggen)
Child in separate window? How? <NOSPAMkEynOn@panix.comNOSPAM>
Re: Defending Perl (Abigail)
generating barcodes (Michael Coffman)
Re: generating barcodes (Martien Verbruggen)
Re: Getting the filehandle from a typeglob (Jason Gloudon)
Re: Grabbing a webpage with Perl (with https) (Martien Verbruggen)
Help Sending MIME attachment (Samuel G. Williams)
Help: carriage return errors <phillipu@home.net>
Re: How do I execute a program with Perl? (Jonathan Stowe)
Re: How do I print one of each group occurance? (Martien Verbruggen)
Re: How do you make delay program? <dformosa@st.nepean.uws.edu.au>
Re: How to read command line literally? (Martien Verbruggen)
Re: How to read command line literally? (Ilya Zakharevich)
Initializing hash with null array: which is best? (Chris Sherman)
Re: Matts Script Archive-WWWBoard-FrontPage-Suddenly No (brian d foy)
Re: Mutliple emails (Martien Verbruggen)
Re: o-modifier (Martien Verbruggen)
Re: Perl Editor?? <birgitt@order.booktraders.com>
Re: Permutations in hashes make Perl hurt (Mark-Jason Dominus)
Portable Perl HTTP web server w/fast Perl CGI now avail (Clay Kasow)
Re: QRe: == vs. eq (Greg Bacon)
Re: Question about Pattern Matching (brian d foy)
Re: Splitting a variable ??? (Martien Verbruggen)
Re: Statistics for comp.lang.perl.misc (Martien Verbruggen)
Re: Strange Behavior Of "gethostbyaddr" (Martien Verbruggen)
Re: System call in Perl not working (Martien Verbruggen)
Re: what is wrong with this code ? (Jonathan Stowe)
Re: what is wrong with this code ? <zenin@archive.rhps.org>
Re: While Loop Gets Skipped (Martien Verbruggen)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 28 Apr 1998 23:08:05 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: "Slurp"?
Message-Id: <6i5ngl$ku1$1@marina.cinenet.net>
root (jimmer@charm.net) wrote:
: I vaguely remember seeing a technique once where an entire input file
: is read in with a single command, carriage returns and all. My poor
: memory also seems to think it was called "slurping" the file, but I
: cannot find any reference to it in the camel book, the newsgroup, or
: the FAQ. Is there such a thing. If so, how is it done (and what is
: it really called)?
"Slurping" is indeed what I've most often heard it called.
There are two ways, depending on whether you want to slurp into a list of
lines, or one long string with embedded newlines. Presuming we want to
slurp from stdin:
# Slurp to list version
my @lines = <>;
# Slurp to string version
$/ = undef;
my $text = <>;
It is often a good idea to localize the change to $/ to a block around the
slurping, in order to avoid breaking other file reads elsewhere that
expect the standard line terminator (\n) to be in effect.
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: 28 Apr 1998 23:01:18 GMT
From: kfox@pt0204.pto.ford.com (Ken Fox)
Subject: Re: 'each' and recursion, do they mix?
Message-Id: <6i5n3u$m5b5@eccws1.dearborn.ford.com>
Jean-Louis Leroy <jll@skynet.be> writes:
> ..and it all boils down to this: global variables are bad.
Don't think so. Look back at the example bug -- it was a *local*
lexical variable. Global variables are sometimes bad, but lets
not change our definition of global to be mean any variable that
causes problems!
Perl's closures are pretty robust these days. I'm glad to see
them being discussed here. I was afraid that the regular perl
user was going to be frightened off. Anybody want to port
e-lisp to the perl VM just to have an alternative to guile? ;)
- Ken
--
Ken Fox (kfox@ford.com) | My opinions or statements do
| not represent those of, nor are
Ford Motor Company, Powertrain | endorsed by, Ford Motor Company.
Analytical Powertrain Methods Department |
Software Development Section | "Is this some sort of trick
| question or what?" -- Calvin
------------------------------
Date: Tue, 28 Apr 1998 23:41:37 GMT
From: dr.pc@t-online.de (Dr. Fridemar Pache)
Subject: Re: ANNOUNCE: Perl Builder IDE Now Available
Message-Id: <6i5p2l$cvn$1@rznews.rrze.uni-erlangen.de>
Marty Ford <perl@solutionsoft.com> wrote:
>We would like to invite everyone here to try a pre-release
>copy of Perl Builder--the first complete, integrated
H
after three unsuccessful download tries, I'm in conflict between
laziness and impatience ..
anyhow I make a 4th try: if I again get an 'access denied'-message
then it's your turn to reconcile the conflict :-)
S
Dr. Fridemar Pache
PS.:
If you don't get any further emails from me, you know that it was
another unsuccessful try.
------------------------------
Date: 28 Apr 1998 23:53:00 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: ANNOUNCE: Perl Builder IDE Now Available
Message-Id: <6i5q4s$ku1$2@marina.cinenet.net>
Grinch (grinch@whoville.com) wrote:
: Seriously, though. Color syntax highlighting is maybe too stong a term to
: use. The editor highlights keywords, comments, and quoted strings,
Does it handle all flavors of string quoting? If it doesn't, highlighting
just the easy cases ("", '') may do more cognitive harm than good...I
don't like the idea of being fed a subliminal queue that qq!fooBarBaz! is
not a string, for example.
For that matter, how well does it do pulling out comments? Will it parse
$foo =~ s#wah#woo#ig; # Fix the wahs
correctly?
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: Tue, 28 Apr 1998 20:37:03 -0400
From: "Grinch" <grinch@whoville.com>
Subject: Re: ANNOUNCE: Perl Builder IDE Now Available
Message-Id: <6i5rpr$35q@fridge.shore.net>
Tom Mornini wrote in message ...
>Grinch (grinch@whoville.com) wrote:
>
>: Tool tips, btw, are the little text messages that, in many apps, appear
when
>: you "hover" the mouse pointer for a second or two. Apple, as usual,
insists
>: on being different and calls them "Balloon Help." In this case, they
display
>: the value of the variable over which the pointer is hovering.
>
>Oh, please! Apple has enough problems without this sort of misinformation.
Misinformation!? Apple's own ads say "think different." When it first came
out it was "the computer for the rest of us." I think that qualifies as
insisting on being different.
Why are so many Mac users so damned touchy, anyway? I said nothing negative
about the Mac, and mentioned the difference because I figured that the
person unfamiliar with "tooltips" may be using a system that refers to them
differently.
As for who invented tooltips or Balloon Help or whatever, who cares? It's
all based on the same research anyway, which was being done at Xerox's Palo
Alto Research Center when Steve & Bill were in grade school.
That's also, btw, where the mouse was invented. If I recall correctly, the
original model had two buttons, and Apple, as usual, insisted on being
different. ;-)
-grinch
--
-----
"Yes, I'm paranoid, but that doesn't mean
no one's out to get me." - me
Sherm Pendley
grinch@whoville.com
http://www.whoville.com
------------------------------
Date: 29 Apr 1998 00:16:50 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: cgi-lib.pl or CGI.pm?
Message-Id: <6i5rhi$lh4$4@comdyn.comdyn.com.au>
In article <6i4r3i$s29$1@nntp1.ba.best.com>,
David Fetter <dfetter@shell4.ba.best.com> writes:
> OBTW, it's an 8 line signature ;)
hehe, it is this time :) Making progress :)
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | "In a world without fences,
Commercial Dynamics Pty. Ltd. | who needs Gates?"
NSW, Australia |
------------------------------
Date: 28 Apr 1998 23:17:56 GMT
From: k y n n <NOSPAMkEynOn@panix.comNOSPAM>
Subject: Child in separate window? How?
Message-Id: <6i5o34$nqp@news1.panix.com>
Keywords: fork, pipe
Does anyone know how to fork out a child process with its own separate
X window, so that keyboard input will go to the parent or the child
depending on which window has the focus?
Thanks!
K.
--
To reply directly by e-mail, remove the upper-case letters from the
return address in the header.
------------------------------
Date: 29 Apr 1998 00:30:47 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Defending Perl
Message-Id: <6i5sbn$al3$3@client3.news.psi.net>
Ilya Zakharevich (ilya@math.ohio-state.edu) wrote on MDCCI September
MCMXCIII in <URL: news:6i5jll$fdg$1@mathserv.mps.ohio-state.edu>:
++ [A complimentary Cc of this posting was sent to Abigail
++ <abigail@fnx.com>],
++ who wrote in article <6i58jn$68r$1@client3.news.psi.net>:
++ > I'm not denying Configure is useful. It is. It just makes installation
++ > more difficult.
++
++ Words, words, words...
++
++ Can you *explain* what your problem is/was? I never need to do
++ anything harder than
- Wrong email address.
- For some reason, it thinks putting man pages in 2 different
places is a feature.
- The need to have the site specific directory not where the rest
of the installation goes.
Abigail
--
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET", "http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content)) =~ /(.*\))[-\s]+Additional/s) [0]'
------------------------------
Date: 28 Apr 1998 23:15:27 GMT
From: coffman@fc.hp.com (Michael Coffman)
Subject: generating barcodes
Message-Id: <6i5nuf$9kh@fcnews.fc.hp.com>
Anyone written anything to generate code-39 compliant barcodes??
Please email me as I don't normally read this group.
--
-MichaelC
------------------------------
Date: 29 Apr 1998 00:25:10 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: generating barcodes
Message-Id: <6i5s16$lh4$5@comdyn.comdyn.com.au>
In article <6i5nuf$9kh@fcnews.fc.hp.com>,
coffman@fc.hp.com (Michael Coffman) writes:
> Anyone written anything to generate code-39 compliant barcodes??
You can find BarCode modules on CPAN:
http://www.perl.com/CPAN/modules/00modlist.long.html
> Please email me as I don't normally read this group.
That's a pity, because then you won't see this answer.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | "In a world without fences,
Commercial Dynamics Pty. Ltd. | who needs Gates?"
NSW, Australia |
------------------------------
Date: Wed, 29 Apr 1998 00:38:21 GMT
From: jgloudon@hyssop.bbn.com.bbn.com (Jason Gloudon)
Subject: Re: Getting the filehandle from a typeglob
Message-Id: <slrn6kctie.lhf.jgloudon@hyssop.bbn.com>
yary h. <fecund@fatnet.net> wrote:
.
>sub socket_to_me {
> my $sock = ++$sockname;
> socket(*sock, PF_INET, SOCK_STREAM, getprotobyname('tcp'))
.
.
>My guess is that "my $sock" creates a single variable, so using
>*sock{FILEHANDLE} will always return the same thing once it's
*sock returns the entry for 'sock' in the symbol table for the current package.
'my $sock' creates a lexical variable $sock, which does not exist in any
package's symbol table. Your subroutine keeps returns the same glob because
you are requesting the same symbol table entry each time.
*{$sockname} is what you wanted there.
--
jason gloudon
------------------------------
Date: 28 Apr 1998 23:20:29 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Grabbing a webpage with Perl (with https)
Message-Id: <6i5o7t$l6s$4@comdyn.comdyn.com.au>
In article <6hqb8s$nal$1@venus.mcs.net>,
les@MCS.COM (Leslie Mikesell) writes:
> Is there anything free that will grab a page via https? Or a way
> to control a browser that could do it?
Again, like most other answers in this thread: LWP will do that.
For anything webclient related, the answer simply is: get LWP. If that
doesn't do what you want, you probably will have to write it yourself.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | "In a world without fences,
Commercial Dynamics Pty. Ltd. | who needs Gates?"
NSW, Australia |
------------------------------
Date: 28 Apr 1998 23:38:21 GMT
From: aadlpsw@wwa.com (Samuel G. Williams)
Subject: Help Sending MIME attachment
Message-Id: <6i5p9d$ktp$1@hirame.wwa.com>
I have written several perl programs used for security auditing. The end
results are tabular reports being formatted with format statements. My
problem, one among many, is that these reports get submitted to several
security auditors through the mail system. Their mail client is groupwise
v5.0. Unfortunately the readers user proportional spaced fonts and really
make a mess of the report.
THE QUESTION: What codes need to be added to a stock text file to cause
it to be interpreted as a MIME attachment and can these codes be easily
embedded within an email message and run through a normal unix mail
program.
Thanks for your help in advance.
--
Sam Williams wb5yni samw@wwa.com
Systems Programmer Staff Specialist samw@sinnfree.org
---------------------------------------------------------------------------
simplicity is the ultimate form of sophistication....
Leonardo Da Vinci
------------------------------
Date: Tue, 28 Apr 1998 08:22:37 -0400
From: "Phil" <phillipu@home.net>
Subject: Help: carriage return errors
Message-Id: <6i5rko$5au$2@ha1.rdc1.nj.home.com>
Hi:
I recently installed a shopping cart script. I checked the syntax from the
command line and got an aoky.
When I tried to execute the script in the shell, it ran about half way
through and gave me this error:
"Illegal chracter \015
(carriage return) at ./Library/Web_store.setup.frames.javascript
line 4
Then it tells me "Maybe you didn't strip carriage returns after a network
transfer.
Well, I uploaded the file in ASCII mode. I've tried everything.
Have you run into this before?
Thanks for any help!
------------------------------
Date: Tue, 28 Apr 1998 02:01:11 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: How do I execute a program with Perl?
Message-Id: <354530ba.19204691@news.btinternet.com>
On Tue, 28 Apr 1998 16:48:33 -0600, mhannam@gardner-webb.edu wrote :
>Hi. How might one go about executing a program on a remote Win32 host with
>Perl? I want to use a Perl CGI script to call a small program that turns on
>an LED light attached to a RS-232 connector. Can it be done? Do I need a
>special module? Thanks for any help you can offer. Matt
>
So you found a partial solution for your project then ? ;-}
You might care to try
perldoc -f system
However you will have other considerations in creating a CGI to do
what you want, but you knew that didnt you?
/J\
Jonathan Stowe
Some of your questions answered http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm
------------------------------
Date: 29 Apr 1998 00:12:08 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: How do I print one of each group occurance?
Message-Id: <6i5r8o$lh4$3@comdyn.comdyn.com.au>
In article <Pine.BSI.3.96.980428095453.15004B-100000@pentagon.io.com>,
Chocolate <poohba@io.com> writes:
> I have this flat text file that has information like this
> catagory::title::name::site
> on each line. How do I print out the catagories without duplicating them?
> Example.
> Sports::Basketball::NBA::www.nba.com
> Sports::Basketball::NCAA::www.ncaa.org
> Sprots::Basketball::WNBA::www.wnba.com
> Cars::Pricing::Auto Mall::www.automall.com
> Cars::Shoping::Car Max::www.carmax.com
> Computers::Shoping::Dell::www.dell.com
> Computers::Shoping::Compaq::www.compac.com
>
> How would I print just the first time it is found? When I do a foreach I
Use a hash table.
# perldoc perldata
If you need to store the rest as well, you also might want to read
# perldoc perldsc
# perldoc perllol
[please consider making your signature slightly smalller.]
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | "In a world without fences,
Commercial Dynamics Pty. Ltd. | who needs Gates?"
NSW, Australia |
------------------------------
Date: 28 Apr 1998 22:50:28 GMT
From: ? the platypus {aka David Formosa} <dformosa@st.nepean.uws.edu.au>
Subject: Re: How do you make delay program?
Message-Id: <893803828.55492@cabal>
In <3545336F.5A50@cse.bridgeport.edu> "Seong Y. Kim" <seong@cse.bridgeport.edu> writes:
>Does anyone know how to make delay without running loops?
Well you could tell the perl script to sleep.
--
I'm a perl programer if you need perl programing hire me.
Please excuse my spelling as I suffer from agraphia see the url. Support NoCeM
http://www.cit.nepean.uws.edu.au/~dformosa/Spelling.html http://www.cm.org/
I'm sorry but I just don't consider 'because its yucky' a convincing argument
------------------------------
Date: 28 Apr 1998 23:17:53 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: How to read command line literally?
Message-Id: <6i5o31$l6s$3@comdyn.comdyn.com.au>
In article <3545d125.0@news.ic.net>,
"Michael Kairys" <kairys@mi.sl.com> writes:
>
>
>>>:ARGV expands into all the .txt files. I want $ARGV[0] =
>>>:"*.txt". How can I do that ?
>
>
> Note that, as has been discussed in several recent threads in this group,
> the ActiveState Win32 Perl performs automatic filename globbing on the
> command line but the standard distributution does not. So one answer to the
> above question is "use the standard distribution".
This is a win32 centric solution, and there was no mention of win32 in
the original post, or was there? The 'original' distribution does
indeed attempt no expansion, but leaves it up to the shell, which is
how it should be. Problem here is that DOSish systems come with a
braindead shell.
(Also: note that the GS port of perl is not the 'standard
distribution'. It behaves very much like it, but it's patched here and
there. And that port also can be configured to do globbing
automatically)
Anyway, the command line that the original poster gave us:
perlprog *.txt
leads me to believe that he's not on a DOS box, so Tom Christiansen's
answer was probably sufficient. :)
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | "In a world without fences,
Commercial Dynamics Pty. Ltd. | who needs Gates?"
NSW, Australia |
------------------------------
Date: 29 Apr 1998 00:34:38 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: How to read command line literally?
Message-Id: <6i5siu$2lm$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Martien Verbruggen
<mgjv@comdyn.com.au>],
who wrote in article <6i5o31$l6s$3@comdyn.comdyn.com.au>:
> how it should be. Problem here is that DOSish systems come with a
> braindead shell.
In some respect DOSish shells are braindead indeed. But not in this
one: the fact that DOSish shells do not mangle the command line is the
great advantage - comparing the braindead *nixish behaviour.
If a program wants globbing of the command line, it may just do
main(int argc, char *argv[], char *env[])
{
glob_wildcards(&argc,&argv);
...
}
But if it wants, it may examine the command line and find what user
wanted, so there is no braindead backslashitis and quotitis for
something like
find . -name *.blah
or
unzip foo *.c
Command line is the most important element of IPC, and the fact that
it is unreachable is one of the few stupidities of the *nixish
paradigm.
Ilya
------------------------------
Date: Wed, 29 Apr 1998 00:05:08 GMT
From: sherman@unx.sas.com (Chris Sherman)
Subject: Initializing hash with null array: which is best?
Message-Id: <Es5EwK.7y5@unx.sas.com>
I want to initialize a complex data structure element with a
null array.
Are the following two lines the same? If not, what's different? Do they
get the job done as I expect? And which is best in terms of good
programming practice?
$fred->{"thing"} = [()];
@{$fred->{"thing"}} = ();
(I want element "thing" of the anonymous hash pointed to by $fred to contain
a ref to a null array which I'm about to fill).
My guess: They are the same, nothing's different. They do get the job
done, and I sort of like the first line. [ok... Flame suit on...] :-)
Also, before I really thought about it, I put down:
$fred->{thing} = ();
Of course this didn't work as I expected. In fact, if you do a "if
defined..." on it, it returns false. Perl, however, liked it (with
warnings on), so what did it really try to do?
My guess: Nothing. :-) I mean, you can't assign an array itself to
a hash element, right? (...only the ref to one).
Thanx for any help... (And pointers to perlfaq's welcome. I tore up on
perlfaq4 and didn't find anything relavent. Could be wrong, though.)
--
____/ / / __ / _ _/ ____/
/ / / / / / / Chris Sherman
/ ___ / _/ / /
_____/ __/ __/ __/ _\ _____/ _____/ sherman@unx.sas.com
------------------------------
Date: Tue, 28 Apr 1998 19:20:35 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Matts Script Archive-WWWBoard-FrontPage-Suddenly Not Working
Message-Id: <comdog-ya02408000R2804981920350001@news.panix.com>
Keywords: from just another new york perl hacker
In article <6i5mvc$drs$1@news1.i1.net>, "Bob Confer" <bobc@jmross.com> posted:
>You can view what I'm talking about by going to
>www.jmross.com/wwwboard/wwwboard.html and you'll see my test postings. If
>you hold your mouse over the hyperlink area you'll see that each of the
>postings are referencing the same htm file where they should have been
>assigned their own during the time of posting.
it's sad that i know this, but it sounds like the counter file that
holds the next message id is not incrementing.
that's what you gets when Matt don't check the return value of
his open()s and do something appropriate if they fail. (in this
case, can read but not write).
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers <URL:http://www.pm.org>
------------------------------
Date: 29 Apr 1998 00:08:51 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Mutliple emails
Message-Id: <6i5r2j$lh4$2@comdyn.comdyn.com.au>
In article <3545CB84.8FEBA302@sinfor.it>,
"Guy Einy, EPN" <epnguy@sinfor.it> writes:
> Hi,
>
> I'm trying to write a program that will send email to multiple users.
> I've tried using the following (this is just the relevant code):
>
> foreach $recipient(@recipients) {
> send_email($recipient);
> }
>
> sub send_email {
> $recipient = $_[0];
> open (MAIL, "|$mailprog $recipient");
> print MAIL ("To: $recipient\n");
Why don't you use one of the perl modules that do all this work for
you, and do it correctly?
http://www.perl.com/CPAN/modules/00modlist.long.html
> It woks fine - it does send the message. The problem is that the
> From:... and Subject:... gets printed in the BODY of the email
> rather then in the email headers.
This has nothing at all to do with perl. This has to do with the fact
that you didn't read the documentation for your $mailprog, whatever
that is. Please do so.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | "In a world without fences,
Commercial Dynamics Pty. Ltd. | who needs Gates?"
NSW, Australia |
------------------------------
Date: 28 Apr 1998 22:59:18 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: o-modifier
Message-Id: <6i5n06$l6s$1@comdyn.comdyn.com.au>
[Follow up post to correct a mistake I made, pointed out to me in
private correspondence]
In article <6i37vn$eip$1@comdyn.comdyn.com.au>,
mgjv@comdyn.com.au (Martien Verbruggen) writes:
>> for $w (@words){
>> $failed++ and last unless /$w/i;
>
> I don't think I would write it like this :) Besides, this increments
> $failed even on a match. Is that what you want?
Of course, I am wrong here. This doesn't get incrememented on a match.
Sorry for the confusion.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | "In a world without fences,
Commercial Dynamics Pty. Ltd. | who needs Gates?"
NSW, Australia |
------------------------------
Date: Tue, 28 Apr 1998 18:59:40 -0400
From: Birgitt Funk <birgitt@order.booktraders.com>
Subject: Re: Perl Editor??
Message-Id: <35465F5C.89D0B3E4@order.booktraders.com>
Earl Hood wrote:
>
> In article <6i5e04$jtg$3@csnews.cs.colorado.edu>,
> Tom Christiansen <tchrist@mox.perl.com> wrote:
> > [courtesy cc of this posting sent to cited author via email]
> >
> >In comp.lang.perl.misc,
> > Ala Qumsieh <aqumsieh@matrox.com> writes:
> >:Does anybody know of any good Perl editors on unix platform?
> >
> >vi; specifically, nvi.
>
> Vim is good. It can be built to contain a Perl interface
> (along with the regular support for Perl source syntax highlighting).
> I have not used vim that much since I have been content with
> plain 'ol vi for years.
>
> --ewh
As I want to learn Perl (and as I am new to vi - and as I remember
that not only Abigail said a couple of days/weeks ago that all you
need to know is your vi - and as I know at least one other Perl expert
who swears on vim for everything - and as I am using vi, but for
now just the basics), can someone tell me if I can find out about how
to set vi up to use for Perl code specifically by just reading the
vi documentation or is there some other place which would have more
details and tips specifically for what I am looking for.
(Now I didn't search yet for myself, but had in mind doing so
anyhow, and was just intrigued to ask now, as the subject came up).
I am prepared to get a lesson of doing my homework, just couldn't
resist to ask...
Birgitt Funk
------------------------------
Date: 28 Apr 1998 20:57:40 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Permutations in hashes make Perl hurt
Message-Id: <6i5tu4$1nu$1@monet.op.net>
In article <6i5jat$ee2$1@mathserv.mps.ohio-state.edu>,
Ilya Zakharevich <ilya@math.ohio-state.edu> wrote:
>I do not have my Knuth at hand, is there *any* reason why 33 was taken?
I can speculate: Multiplying by 33 is fast. Multiplying by 37 is
probably not as fast. Tests confirm this; see below.
Rest of the explanation is for people other than Ilya, because Ilya
knows this already.
33 is fast because it has two set bits. Any number with two set bits
has bad behavior for permutations like that Tom showed.
37 would still show poor behavior for permutations, but the behavior
would be better than 33. Every 4th bucket would get populated instead
of every 8th bucket. For good behavior on permutations, the number
you want to pick has the form 4N+3. Such numbers appear below in the
`best' column:
Best Less good Worse Worse Worse
3 5 9 17 33
7 13 25
11 21 41
15 29
19 37
23 45
37
31
35
39
43
But the other tradeoff is tmie to compute the value. Mutliplying by
33 is fast, as is multiplication by any number of the form 2**N+1 or
2**N-1.
Time to multiply by:
3, 5, 7, 9, 15, 17, 31, 33: 2 instructions
11, 13, 19, 21, 23, 25, 27: 4 instructions
29, 35, 37, 39, 41, 45: 4 instructions
43: 6 instructions
This is based on looking at the output of gcc -O6 -S on a mumble
mumble processor; it is likely that these results would hold for any
processor, because the optimizations are just what you expect:
X*3 becomes (X<<1)+X, and X*39 becomes (((X<<2)+X)<<3)-X
Numbers that are good in both ways: 3, 7, 15, 31. Unfortunately,
these all show a different bad behavior: They take strings like "AB",
"BC", "xy", etc., to the same bucket; only the difference between the
characters is significant.
The whole thing is very complicated, and I wish I knew what DEK had to
say about it.
------------------------------
Date: Tue, 28 Apr 1998 16:18:05 +0100
From: ckasow@reed.edu (Clay Kasow)
Subject: Portable Perl HTTP web server w/fast Perl CGI now available
Message-Id: <ckasow-ya02408000R2804981618050001@news.reed.edu>
Hello!
I have written an HTTP web server entirely in Perl with the following features:
* Fast. Stable. Secure. Powerful. I hope :-)
* GPL'd source code.
* Non-threaded so it is very easy to port from platform to platform. Same
code runs on both UNIX and Macintosh.
* Very fast non-threaded Perl CGI support.
* Server side file caching.
* HTTP/1.1 persistant connections.
* Access controls.
* Activity logging.
* Very easy to install and configure.
* Lots of neat configuration options to tweak (every major global variable
you might want to play with is listed and documented in a "config" file).
* Super small - tar.Z download is under 50k. Source code is documented
and optimized for maintainability. It shouldn't be too hard to figure out
and modify the source to suit your particular needs - or just to convince
yourself nothing fishy is going on...
The server is called the MacPerl WebServer, as I wrote the original version
specifically to run under the Macintosh implementation of Perl, namely
MacPerl.
The server can be downloaded at http://www.reed.edu/~ckasow/. Up-to-date
online documentation is also available at this site.
I have finally gotten the server to the point where enough bugs are worked
out so I'm not embarresed to advertise it on this list. However, I am in
need of more feedback and bug reports. I have not had much time to test
the server and am dependent on feedback from the outside world. If I get
enough positive feedback, I will promote the current version from beta
1.0b2.7 to just 1.0.
Please send detailed bug reports, feedback, questions, and general rants
and raves to me at ckasow@reed.edu. I am hoping I have created something
which someone out there can actually put to good use.
Even if you don't trust it to handle a large web-site with secure
credit-card-processing forms and lots of traffic (I probably wouldn't
myself at this stage of it's development!), it definately works great for
testing out Perl CGI intensive sites offline and is a handy tool for any
web developer to have around.
Good luck and let me know what you think!
Clay Kasow
ckasow@reed.edu
http://www.reed.edu/~ckasow/
------------------------------
Date: 28 Apr 1998 23:52:02 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: QRe: == vs. eq
Message-Id: <6i5q32$lfg$1@info.uah.edu>
In article <35457C30.4089EAE8@negia.net>,
Dan Boorstein <danboo@negia.net> writes:
: let's pretend for a moment that quarrels should be settled based on
: gut feeling, and that proof is determined by concensus of opinion.
Who said anything about proof? Why must you put words in my mouth?
Why do you think I chose `heuristic' as opposed to `rule'? A heuristic
has a certain associated failure rate, but it works in most cases.
Until machines can parse and understand natural language, our best
efforts in avoiding material we don't care to read are machines guided
by heuristics or other humans filtering on our behalf (e.g., moderators).
: a counterpoint was made, attempting to invalidate the first assertion,
: based on the belief that most posters use NNTP clients in the suspect
: class.
Of course, the other side of that coin is that since clueful users use
decent tools, most posters are without clue. :-( Perhaps I want too
badly to believe in humanity to accept this.
: so, as i see it, it's your turn to make an assertion to counter this.
: simply reiterating the original assertion gets us nowhere since it
: can always be countered. it's like a draw in chess when the same
: position is repeated again and again.
That's just it; the situation is not a draw since people whose clients
belong to the suspect class lose because the very help they seek with
the aid of their clients turns away from their client in disgust.
: now, let's step back into a realm where we attempt to prove our
: assertions with data.
A haughty tone does not change the fact that many (and probably most)
of clpmisc's regular answerers have seen sufficient evidence to accept
``users of bad clients are devoid of clue'' as a heuristic. Find other
places where Perl hackers congregate electronically, and you'll see
similar prejudices. It seems like 99% of people who ask a FAQ, ask a
web-related question (which is specifically banned), or look for a
free homework service on EFnet #perl use mIRC. Without failure, after
one of the aforementioned clueless queries results in someone pasting
*** CTCP VERSION reply from ClueLess: mIRC32 v5.31 K.Mardam-Bey
to the channel and the rest of us sighing in frustration. I invite
anyone who thinks I might be stretching the truth by even one lepton
to sit on #perl for twenty minutes or so. You'll see.
The prejudice has serious momentum that will require overwhelming
evidence to the contrary from the non-believers to overcome.
I think this points to a much deeper issue: certain platforms breed
cluelessness and others clueful enlightenment. At a former job, our
Unix support group was all of three people while an entire helpdesk
(of some twenty people) was dedicated to supporting Win{95,NT}.
The typical support call from the two strata were all but incomparable.
See if you can pick out what platform the following supplicants were
using:
- Why can't I print?
- We need a MLPPP driver for this new hardware we're designing.
- How can I open the image that someone mailed as an attachment?
- Please install Perl.
I find it comical that MS pushers only stress low cost of ownership
instead of quality, dependability, and sensibility. Many of us here
could put together a very excellent Linux system for an infinitely
cheaper cost for infinitely better performance. Hand holding must
be quite valuable. :-)
Greg
--
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF
------------------------------
Date: Tue, 28 Apr 1998 19:16:48 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Question about Pattern Matching
Message-Id: <comdog-ya02408000R2804981916480001@news.panix.com>
Keywords: from just another new york perl hacker
In article <Pine.SOL.3.96.980428171652.25448H-100000@mimolette.tamu.edu>, Sanjay Joshi <joshi@ee.tamu.edu> posted:
>usr47-dialup50.mix2.boston.mci.net - - [24/Apr/1998:14:18:28 -0500] "GET
>/~joshi/view.gif HTTP/1.0" 304 -
>
>What I want to do is extract the date, in this case, 24. I want to know
>about 2 methods:
>
>1. Extract the date from the '[' to the '/'
>2. Any other.
well, here's another that i had lying around:
m| \[ #opening bracket for date portion
(\d\d) #the day, into $1
/
(
[A-Z] #first letter of month abbreviation into $2
[a-z][a-z] #last two letters of ...
)
/
(\d\d\d\d) #year into $3
:
(\d\d) #hour into $4
:
(\d\d) #minute into $5
:
(\d\d) #second into $6
\ + #a literal space (maybe two? see next query...)
(
[+-]? #direction from Greenwich (what happens at Greenwich?)
\d\d\d\d #hour offset into $7
)
\] #closing bracket
|x; #eXtended format
my $date = $1;
my $month = $2;
my $year = $3;
my $hour = $4;
my $minute = $5;
my $second = $6;
my $time_zone = $7;
print "The date is $date\n";
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers <URL:http://www.pm.org>
------------------------------
Date: 28 Apr 1998 23:38:39 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Splitting a variable ???
Message-Id: <6i5p9v$lck$2@comdyn.comdyn.com.au>
In article <wxxd8e1r432.fsf@refil.ifi.uio.no>,
Terje Kvernes <terjekv@ifi.uio.no> writes:
> "Igor Krivokon" <igor.k@usa.net> writes:
>
>> $string = "042498a";
>> ($a, $b, $c, $d ) = $string =~ /(\d\d)(\d\d)(\d\d)(\w)/;
>
> why not \d{2} instead of \d\d? Hm...
Because \d\d is 4 characters, and \d{2} 5? :)
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | "In a world without fences,
Commercial Dynamics Pty. Ltd. | who needs Gates?"
NSW, Australia |
------------------------------
Date: 28 Apr 1998 23:01:20 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Statistics for comp.lang.perl.misc
Message-Id: <6i5n40$l6s$2@comdyn.comdyn.com.au>
In article <35459017.72CC@linguistik.uni-erlangen.de>,
Christian Wetzel <cnwetzel@linguistik.uni-erlangen.de> writes:
> Greg Bacon:
>
>> Top 10 Posters by OCR (minimum of five posts)
>
> I always wonder what "OCR" means in this context?
It's earlier in the post:
++ - Original Content Rating (OCR) is the ratio of the original content
volume to the total body volume.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | "In a world without fences,
Commercial Dynamics Pty. Ltd. | who needs Gates?"
NSW, Australia |
------------------------------
Date: 28 Apr 1998 23:49:50 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Strange Behavior Of "gethostbyaddr"
Message-Id: <6i5puu$lfg$1@comdyn.comdyn.com.au>
In article <35420F14.34349DBF@ahqps.alcatel.fr>,
Rodney Wines <Rodney.Wines@ahqps.alcatel.fr> writes:
> Can anyone tell me what (if anything) is wrong with the following?
>
> #!/usr/local/bin/perl
>
> use Socket;
>
> $ip = '192.41.33.62';
>
> ($name, $aliases, $addrtype, $length, @addrs) =
> gethostbyaddr(pack('C4', split /\./, $ip), AF_INET);
Not saying this is your problem, but why do you use Socket, but not the
inet_aton() function?
$dotted_ip = '192.41.33.62';
$iaddr = inet_aton($dotted_ip);
@stuff = gethostbyaddr( $iaddr, AF_INET );
This works fine for me for almost all ip addresses, but NOT for the
above. This leads me to believe that there might be a problem with
their DNS setup or so. Since the above code works, there isn't
anything wrong with perl. It must be something IP or DNS related. You
might try asking on one of the groups that talks about that.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | "In a world without fences,
Commercial Dynamics Pty. Ltd. | who needs Gates?"
NSW, Australia |
------------------------------
Date: 28 Apr 1998 23:33:34 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: System call in Perl not working
Message-Id: <6i5p0e$lck$1@comdyn.comdyn.com.au>
In article <6hsqqv$5lo@bgtnsc02.worldnet.att.net>,
"Arun Gurjale" <gurjale.arun@worldnet.att.net> writes:
(BTW. You're not talking about a system call. You're running some
program with the perl system builtin. A system call is something
different entirely)
> Here is a the problem:
> We are trying to remove zero length files that is created by Groupwise 4.1a
> running on a Solaris 2.5.1 platform. From the command line the following
> command works like a charm:
> find /po/gwmail -size 0c -exec rm {} \;
Instead of using this, you might be interested in the perl module
File::Find, and the -X file tests, specifically -z.
Also look at the find2perl utility, as referred to in the File::Find
docs.
# perldoc File::Find
# perldoc find2perl
use File::Find;
find( sub { -z $_ and unlink($_) }, '/po/gwmail');
> We had to put this in a cron job that runs every half hour and we did this
> in Perl. The Perl script has many other things in it and we added the
> following line to the script:
> $err_msg = system("find /po/gwmail -size 0c -exec rm {}\;");
When things are runniing from cron, they are running with a totally
different path than you normally have. Use the full path to find.
ALWAYS use full paths in scripts that run this way.
But I'd advise you to use the File::Find solution. Much cleaner.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | "In a world without fences,
Commercial Dynamics Pty. Ltd. | who needs Gates?"
NSW, Australia |
------------------------------
Date: Tue, 28 Apr 1998 02:01:13 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: what is wrong with this code ?
Message-Id: <35453522.20198009@news.btinternet.com>
On Tue, 28 Apr 1998 16:49:33 -0600, indhiraa@hotmail.com wrote :
<snip>
>
> use FileHandle;
> $fh = new FileHandle "/tmp/foo", "r";
>
<snip>
>But sysread fails always complaining ..
>
>"Use of uninitialized value at that line.."
>
>I mean the filehandle $fh remains uninitialized.
>
>Any suggestions please..
I would check the value of $fh in case the open of your file failed
for some reason.
/J\
Jonathan Stowe
Some of your questions answered http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm
------------------------------
Date: 29 Apr 1998 00:46:22 GMT
From: Zenin <zenin@archive.rhps.org>
Subject: Re: what is wrong with this code ?
Message-Id: <893811213.518201@thrush.omix.com>
indhiraa@hotmail.com wrote:
: Here is a function which is called when a button is clicked.
: $fh = new FileHandle "/tmp/foo", "r";
FileHandle throws no exceptions, so you must test the return value
from the constructor:
$fh = new FileHandle "/tmp/foo", "r"
or die "Can not open '/tmp/foo' for reading: $!, stopped";
--
-Zenin
zenin@archive.rhps.org
------------------------------
Date: 29 Apr 1998 00:05:37 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: While Loop Gets Skipped
Message-Id: <6i5qsh$lh4$1@comdyn.comdyn.com.au>
In article <35460CB8.9A0044BE@uswest.com>,
Ryan Rucker <rxruck2@uswest.com> writes:
> This is a multi-part message in MIME format.
> --------------BE0279729F20C730766C85AB
Please don't do this. Usenet is a plain text medium.
[You really should format your code a bit more legibly. It will make
your programming life a lot easier.]
while ( $ord_set == $ord_sot &&
$splr_set eq $splr_sot &&
$typ_set eq $typ_sot &&
$line_sot ne "" &&
$line_set ne "")
{
[SNIP]
Well. I'd say that either one of these evaluates to a false value.
While you're in the debugger, test all of these. I can't do that for
you, since I don't have your values.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | "In a world without fences,
Commercial Dynamics Pty. Ltd. | who needs Gates?"
NSW, Australia |
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 2448
**************************************