[7215] in Perl-Users-Digest
Perl-Users Digest, Issue: 840 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Aug 10 14:07:15 1997
Date: Sun, 10 Aug 97 11:00:23 -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 Sun, 10 Aug 1997 Volume: 8 Number: 840
Today's topics:
?? Mail filter using STDIN <alex@darkfire.com>
[newbie] Will gd do this? <mannon@edge.net>
Re: [newbie] Will gd do this? (Mike Stok)
Re: [Q] Converter between ELM filter-rules file to proc (Bryan Miller)
Re: Broken Pipe?? <rootbeer@teleport.com>
Browser interaction in DOS (Hedin Meitil)
Re: Buy any Perl book in print <nelsona@whtbs1.agw.bt.co.uk>
Re: Buy any Perl book in print <tom@mitra.phys.uit.no>
Re: can regexp do balanced match? (Tad McClellan)
Converting cgi submission to variable names? (Ariel Y Fishman)
HELP WITH INSTALLING PERL5 ON WINDOWS 95 <hbact647@csun1.csun.edu>
Re: How do I get started with win95? <rootbeer@teleport.com>
Re: Newbie - Perl for Win (Matthias Wolff)
Perl 5 FileCache module broken? (Michael Borowiec)
Re: PID <dq@leland.Stanford.EDU>
Question regarding alarm() (Chris Ochs)
Re: Question regarding alarm() (Jim Trocki)
Re: Question regarding alarm() <rootbeer@teleport.com>
Re: Strange shebang behavior in linux <alexlane@ghg.net>
Re: Unclear documentation for map() (Jot Powers)
Re: uppercase($mystring) ? <merlyn@stonehenge.com>
Re: Will Pay: Write this script for me! <admin@no_spamchathub.com>
Re: Will Pay: Write this script for me! <tetnys@ibm.net>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 10 Aug 1997 17:20:33 GMT
From: "Alex Matthews" <alex@darkfire.com>
Subject: ?? Mail filter using STDIN
Message-Id: <01bca5b2$2e671300$0701de89@null.bris.ac.uk>
I am trying to write a mail filter in perl that is called from the .forward
file. When mail comes in it can be processed and put in the mailbox
directly.
the .forward file lokks like this:
|/path/to/prog/mailfilter.pl
The problem is that only the mail headers (everything up to the first
double CR) seem to be passed to the program in STDIN. Why is this, and how
can I get the rest of the message.
Please reply by mail as well as to the NG.
Thanks for any help in advance,
Alex.
--
Alex Matthews
alex@darkfire.com
http://darkfire.com/alex
------------------------------
Date: Sun, 10 Aug 1997 04:15:21 -0500
From: "Michael T." <mannon@edge.net>
Subject: [newbie] Will gd do this?
Message-Id: <33ED86A8.96AD76FC@edge.net>
Total Newbie Asks: I need to stamp a couple of transparent .gifs onto
another, and send the new .gif out to a browser. My server has
Perl5.003, but none of the modules; they are pretty good at letting me
put whatever I want on, tho. I <i>think</i> the gd library is what I
need. How much trouble is installing & using it going to be for a total
newbie?- Thanks.
(I ain't askin' for help doin' it- I just wanns know how much trouble
it's gonna be.)
------------------------------
Date: 10 Aug 1997 12:31:47 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: [newbie] Will gd do this?
Message-Id: <5skcbj$p1k@news-central.tiac.net>
In article <33ED86A8.96AD76FC@edge.net>, Michael T. <mannon@edge.net> wrote:
>Total Newbie Asks: I need to stamp a couple of transparent .gifs onto
>another, and send the new .gif out to a browser. My server has
>Perl5.003, but none of the modules; they are pretty good at letting me
>put whatever I want on, tho. I <i>think</i> the gd library is what I
>need. How much trouble is installing & using it going to be for a total
>newbie?- Thanks.
The GD library can do this for you as you can initialise a couple of
GD::Image objects from GIF or XBM files, and then there are functions
which let you determine which colourmap entry is transparent for an image
and get and set the pixel colour table entries in the images. If you can
arrange to have your source images saved using the same colour table then
you will save yourself some work...
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com | Pencom Systems Administration (work)
------------------------------
Date: 6 Aug 1997 18:47:35 GMT
From: millerb@PROBLEM_WITH_INEWS_GATEWAY_FILE (Bryan Miller)
Subject: Re: [Q] Converter between ELM filter-rules file to procmailrc file?
Message-Id: <5sags7$krp@fcnews.fc.hp.com>
Dick Adams (rdadams@access5.digex.net) wrote:
: Ricardo Marek <ricky@ornet.co.il> wrote:
: > Does such animal exist? (to convert the ELM filter-rules file
: > into a procmailrc file
: >
: > Please answer via e-mail
: I was really hoping to see an answer to this question posted!!
Perhaps a more logical place to see that happen would be
news.software.readers
Bryan
------------------------------
Date: Sun, 10 Aug 1997 08:52:39 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Philip Gonzales <gonzales@musictech.com>
Subject: Re: Broken Pipe??
Message-Id: <Pine.GSO.3.96.970810085219.25156J-100000@julie.teleport.com>
On Sat, 9 Aug 1997, Philip Gonzales wrote:
> I'm using the "Formmail" (Matt's Scripts, Inc.) Perl script, modified
> for my purposes, and I keep getting the message that Netscape has
> encountered a "Broken Pipe". I have tried the script on Unix and on NT
> (the NT version, or course), but keep getting the same message.
>
> I also checked that all the fields in the form, even the hidden fields,
> are set to send data to the script. I was led to believe that this
> could cause a "Broken Pipe" message.
>
> Any suggestions?
When you're having trouble with a CGI program in Perl, you should first
look at the please-don't-be-offended-by-the-name Idiot's Guide to
solving such problems. It's available on the perl.com web pages. Hope
this helps!
http://www.perl.com/perl/
http://www.perl.com/perl/faq/
http://www.perl.com/perl/faq/idiots-guide.html
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Sun, 10 Aug 1997 15:08:01 GMT
From: hm@royal.net (Hedin Meitil)
Subject: Browser interaction in DOS
Message-Id: <33ea45dd.5241353@news.uni-stuttgart.de>
Hi!
I am running PERL on a DOS machine. So far it seems to work OK.
Now, though, I would like to make a simulated trip into CGI-scripting.
I thought, I could just create a HTML-page with a form, where the
attribute ACTION points to my script, for instance ACTION="myscript"
(the script is in the same directory as the HTML-page).
I have included the following in the beginning of the script to make
work like a .bat script:
# @REM=(qq!
# @perl -s %0.bat %1 %2 %3 %4 %5 %6 %7 %8 %9
# @goto end !) if 0 ;
and this in the end:
# @REM=(qq!
# :end !) if 0 ;
(I just added the hashes, as the last line seems to do strange things
to my news-reader. They are not in the script.)
To make things simple, I've just put a single print statement as the
body of the script. But nothing happens when I submit the form.
I've tried to add the .bat suffix like in ACTION="myscript.bat". I
have also tried to include the entire path to the script. No luck.
What am I doing wrong?
Or am I attemptin to do something that cannot be done in a DOS
environment?
------------------------------
Date: Sun, 10 Aug 1997 02:57:08 +0100
From: Andy Nelson <nelsona@whtbs1.agw.bt.co.uk>
Subject: Re: Buy any Perl book in print
Message-Id: <33ED1FF4.1DC1@whtbs1.agw.bt.co.uk>
Terje Bless wrote:
>
> In article <10v4s5.f97.ln@localhost>,
> Tad McClellan <tadmc@flash.net> wrote:
>
> >In article <5s4qou$g9l@fridge-nf0.shore.net>,
> > Ira Krakow <ikrakow@shore.net> wrote:
> >
> >>Which Perl books are the best?
> >
> >best for what?
> >
> >Learning Perl? ("Learning Perl")
> >A reference for Perl? ("Programming Perl")
> >
> >Learning how to program? (some would say a a book about some language
> > other than Perl...)
>
> Gawd, how I would love a book that teaches you to program and does so using
> Perl as the example language. Algorithms and datastructures demonstrated in
> Perl rather than Pascal.
>
> Well, I can can dream, can't I? :-)
>
> --
> Party? Party, lord? Yes, lord. Right away, lord.
> - Beopunk Cyberwulf
Or you could do worse than trying 'Learn Perl 5 in 21 Days'
which I think is from 'SAMS Net' but I could be wrong.
There is also a Win 32 version of the book, which I can't comment on.
(I was using perl on NT)
Andy
------------------------------
Date: 10 Aug 1997 11:25:41 +0000
From: Tom Grydeland <tom@mitra.phys.uit.no>
Subject: Re: Buy any Perl book in print
Message-Id: <nqo7mduqnyi.fsf@mitra.phys.uit.no>
Andy Nelson <nelsona@whtbs1.agw.bt.co.uk> writes:
> Or you could do worse than trying 'Learn Perl 5 in 21 Days'
> which I think is from 'SAMS Net' but I could be wrong.
If you're talking about _Teach yourself Perl 5 in 21 days_, then you
could certainly do better as well. See
http://xenu.phys.uit.no/~tom/TYP21D.html
for why.
I have invited the author, David Till to comment on my review, but
he hasn't had time to respond yet.
> Andy
--
//Tom Grydeland <Tom.Grydeland@phys.uit.no>
------------------------------
Date: Sat, 9 Aug 1997 06:59:07 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: can regexp do balanced match?
Message-Id: <b2mhs5.hj.ln@localhost>
doritozilla (ouij@triples.math.mcgill.ca) wrote:
: I'm trying to tokenize a postscript language
: file: so far regexp's have been able to do
: it all but I'm worried about the following
: case where I must gather everything inside ( )'s.
: postscript allows the ( ) to be quoted to represent
: the actualy character and not be string delimiter.
: for example:
: (this is a string \(sub string inside\) with quoted string)
: I'm getting very good results with
: /\(.*\)/
: due to the greediness, it will go all the way out
: to the rightmost closing )...
: but how do I handle the erroneous cases.
: I'd sleep easier knowing that the paranthesis
: were balanced.]
I assume you want to check for balanced parens in the content
(ie. the escaped ones), not check that the ones significant to
postscript are balanced?
: is there some regexp magic to be able to
: count the quoted parentheses. or must I
Simply counting them won't do. That would pass something like:
(this is a string \)sub string inside\( with quoted string)
: resort to my C coding mentality of examing
: the string character by character and doing
: the housekeeping myself?
If by "housekeeping" you mean maintain a stack, then yes, that's
what you need to do.
Regular expressions cannot match balanced things to an arbitrary
depth of nesting (can the parens be nested?).
If you can establish a maximum nesting depth, then you can write
a regex to match it.
Since you don't really need to save the characters, you can implement
the stack by simply adding one for each open paren and subtracting one
for each closing paren.
You have unbalanced parens if either:
1) the number goes negative anywhere along the way
or
2) the number is not zero when you have finished scanning all the text.
See also "Can I use Perl regular expressions to match balanced text?"
in the Perl FAQ, part 6 ;-)
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: 10 Aug 1997 16:40:57 GMT
From: ayfishma@mail2.sas.upenn.edu (Ariel Y Fishman)
Subject: Converting cgi submission to variable names?
Message-Id: <5skqup$mc$1@netnews.upenn.edu>
Hi,
My apologies if this has been asked before; my newsreader is a bit slow
and frustrating in terms of finding the right recent posts.
I am currently working on some scripts which use data that I process from
cgi form submissions. I want to assign a variable with the same name as
the "name" function in the cgi form to the "value" submitted in the form.
What I currently have is a script to parse the submission, which I copied
from a book (the CGI Book, by W. Weinman) but do not totally understand
it. Once I parse the submission, I end up writing lines that look like
this, for example:
if ($name eq 'email') {$email = $value};
My problem is that if my CGI form has thirty different variables, I end
up rewriting the above line thirty times--is there an easier and lazier
way via loops or subroutines? Do I use braces/brackets in the variable
name? In principle, is there a way to assign a variable without actually
typing out the variable name? (Can I assign $variable to be something
without actually typing the command line '$variable = '?)
For example, a piece of my script currently and tediously reads (within
[read (<STDIN>)]):
if ($tname eq 'seemail') {$seemail = $tvalue}
elsif ($tname eq 'sephone') {$sephone = $tvalue}
elsif ($tname eq 'sufirst') {$sufirst = $tvalue}
elsif ($tname eq 'sulast') {$sulast = $tvalue}
elsif ($tname eq 'suemail') {$suemail = $tvalue}
elsif ($tname eq 'suphone') {$suphone = $tvalue}
elsif ($tname eq 'p1first') {$p1first = $tvalue}
elsif ($tname eq 'p1last') {$p1last = $tvalue}
elsif ($tname eq 'p1email') {$p1email = $tvalue}
elsif ($tname eq 'p1phone') {$p1phone = $tvalue}
elsif ($tname eq 'p2first') {$p2first = $tvalue}
elsif ($tname eq 'p2last') {$p2last = $tvalue}
elsif ($tname eq 'p2email') {$p2email = $tvalue}
elsif ($tname eq 'p2phone') {$p2phone = $tvalue}
elsif ($tname eq 'p3first') {$p3first = $tvalue}
elsif ($tname eq 'p3last') {$p3last = $tvalue}
elsif ($tname eq 'p3email') {$p3email = $tvalue}
elsif ($tname eq 'p3phone') {$p3phone = $tvalue}
elsif ($tname eq 'p4first') {$p4first = $tvalue}
elsif ($tname eq 'p4last') {$p4last = $tvalue}
elsif ($tname eq 'p4email') {$p4email = $tvalue}
elsif ($tname eq 'p4phone') {$p4phone = $tvalue}
elsif ($tname eq 'p5first') {$p5first = $tvalue}
elsif ($tname eq 'p5last') {$p5last = $tvalue}
elsif ($tname eq 'p5email') {$p5email = $tvalue}
elsif ($tname eq 'p5phone') {$p5phone = $tvalue}
(and it goes on for another page or two!)
Thanks in advance,
Ariel
--
-----------------------------
Ariel Fishman fishman@pobox.com
------------------------------
Date: Sun, 10 Aug 1997 09:49:06 -0700
From: Ed Wilson <hbact647@csun1.csun.edu>
Subject: HELP WITH INSTALLING PERL5 ON WINDOWS 95
Message-Id: <33EDF101.E0862A59@csun1.csun.edu>
I downloaded the perl5 interpreter from the perl web site, but can't
seem to get in working. Can anyone help with the basic install
procedures? What to watch out for, tricks... anything would help.
------------------------------
Date: Sat, 9 Aug 1997 06:43:59 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Richard Butcher <mailus@web-uk.com>
Subject: Re: How do I get started with win95?
Message-Id: <Pine.GSO.3.96.970809064004.28710A-100000@julie.teleport.com>
On 9 Aug 1997, Richard Butcher wrote:
> Is it possible to get into Perl without a degree in programming other
> languages? !
Yes.
> I've downloaded perl5 and read every faq I can find and monitored this
> newsgroup for a fortnight.
>
> The message I get is that unless you've got enough knowledge and
> software to compile in C or whatever, there's no way forward.
Who said that?
> I've written a few scripts and got them working
That's good.
> and I'm learning more every day but the only way I can test them is to
> go on-line, upload the script and waste my Service Provider's processing
> time.
You should be able to test scripts on your own machine, depending upon how
you've written them. If you don't yet have Perl installed on your machine,
it comes with installation instructions. If part of the instructions
doesn't make sense to you, you can ask about that part here or in a
newsgroup which specializes in your system.
Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Sun, 10 Aug 97 10:32:58 GMT
From: **matti@berlin.snafu.de (Matthias Wolff)
Subject: Re: Newbie - Perl for Win
Message-Id: <5sk5ca$kvs$1@unlisys.unlisys.net>
In article <0al9xBAY0G7zEwK7@connected.demon.co.uk>, Spam Filter <its.spelt.out.in.the.sig@file.OK> wrote:
>I have installed perl for win and I am trying to work my way thru
>examples in the llama book.
>
>Whilst I can see that unix side will fail (as I have no unix directory
>structure etc) I can get simple scripts to run ,in a dos window, but the
>problem I have is that the window closes as soon as the script has
>executed. this gives me no time to evaluate my experiments.
>
>Where am I going wrong - FAQs to read - Tutorials??
>
>Thanks for your time...
Hi,
I'm new to Perl myself. I think Perl is very much a command-line thing. So,
open your DOS-Shell-Window, run your scripts and watch what it does.
I have read about a Tk-Port to Win32s, though I can't find it...
Greetings to all
Matthias
------------------------------
Date: 10 Aug 1997 12:54:15 -0500
From: mikebo@MCS.COM (Michael Borowiec)
Subject: Perl 5 FileCache module broken?
Message-Id: <5skv87$dpt$1@Mars.mcs.net>
Greetings -
I'm trying to use the Perl 5 FileCache module to keep a couple hundred
files open under Perl 5.004_01 and SunOS 4.1.4. However, even in the
following simple test script, I'm not able to open more than 63 files
(including STDIN, STDOUT and STDERR). I even tried to lower the
FileCache "maxopen" variable, but it fails in the same spot. Is the
FileCache module broken, or am I doing something wrong?
prompt> cat maxfile
#!/usr/local/bin/perl5
use FileCache;
$FileCache::maxopen = 20;
for $i (0 .. 1024) {
$filename = "/tmp/crud$i";
cacheout($filename);
}
prompt > maxfile
Can't create /tmp/crud61: Too many open files at ./maxfile line 6
> ulimit -n
64
Any help would be appreciated.
Regards,
- Mike
------------------------------
Date: Thu, 7 Aug 1997 00:55:21 -0700
From: Qiang Dai <dq@leland.Stanford.EDU>
To: Charles DeRykus <ced@bcstec.ca.boeing.com>
Subject: Re: PID
Message-Id: <Pine.GSO.3.96.970807005008.5785A-100000@epic12.Stanford.EDU>
On Wed, 6 Aug 1997, Charles DeRykus wrote:
> my $pid = open(...);
Thanks.
> Do you have other communication in mind?
Yes, I do. I was wondering how I could kill the process
created by open(), by first sending a signal to the main
script, which, upon receiving this signal, kills
the child process before it kills itself.
(I don't know if it's necessary, but I may have
seen some instances where my main job (the child process)
is not killed and become a runaway job after I killed the
main script, which serves as a wrapper to capture and process
output from the child process.).
------------------------------
Date: 10 Aug 1997 08:09:19 GMT
From: root@web1.valley-internet.com (Chris Ochs)
Subject: Question regarding alarm()
Message-Id: <5sjsvf$i08$1@falcon.ns.net>
I'm using alarm() and a signal handler to catch timeouts on sockets calls.
The question I have is if an alarm is caught and the signal handler catches
it and runs a subroutine, if the subroutine returns instead of exits, will
it return to the same line that the program was it when the alarm was caught, or the does it start at the next line.
Example:
1. alarm 30;
2. print $_ while <FH>;
3. alarm 0;
If the alarm is caught at 2, and the alarm handler does it thing and then
returns, will perl try to finish 2 or skip 2 and go to 3?
Chris
------------------------------
Date: 10 Aug 1997 14:40:57 GMT
From: trockij@transmeta.com (Jim Trocki)
Subject: Re: Question regarding alarm()
Message-Id: <5skjtp$f8m$1@palladium.transmeta.com>
In article <5sjsvf$i08$1@falcon.ns.net>,
Chris Ochs <root@web1.valley-internet.com> wrote:
>I'm using alarm() and a signal handler to catch timeouts on sockets calls.
>The question I have is if an alarm is caught and the signal handler catches
>it and runs a subroutine, if the subroutine returns instead of exits, will
>it return to the same line that the program was it when the alarm was caught, or the does it start at the next line.
>
>Example:
>
>1. alarm 30;
>2. print $_ while <FH>;
>3. alarm 0;
>
>
>If the alarm is caught at 2, and the alarm handler does it thing and then
>returns, will perl try to finish 2 or skip 2 and go to 3?
System calls that can block (read, write, etc.) can have two behaviors
when a signal is caught. One is to restart the system call when the
signal handler returns, the other is to return an error condition and
set errno to "EINTR". You probably want the latter behavior, which can
be set using the sigaction routine from the POSIX module. See
"perldoc POSIX" and sigaction(2).
An alternate way to handle a timeout on a read is to use select(2).
select(2) will block until a condition is met on a set of file
descriptors, or until a timeout. See "perldoc -f select" for a further
explanation, and an example.
Also, Stevens addresses these topics in "Advanced Programming in the
UNIX Environment" (Addison Wesley), and chapter 4.7 of "The Design and
Implementation of the 4.4BSD Operating System" (Addison Wesley) also
covers the topic of restartable system calls
--
Jim Trocki
Computer System and Network Engineer
Transmeta Corporation
Santa Clara, CA trockij@transmeta.com
------------------------------
Date: Sun, 10 Aug 1997 08:32:35 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Chris Ochs <root@web1.valley-internet.com>
Subject: Re: Question regarding alarm()
Message-Id: <Pine.GSO.3.96.970810082450.25156E-100000@julie.teleport.com>
On 10 Aug 1997, Chris Ochs wrote:
> if an alarm is caught and the signal handler
> catches it and runs a subroutine,
...then you're probably going to have troubles somewhere down the line.
Unfortunately, for technical reasons, signal handlers in Perl aren't yet
able to safely do much without the risk of crashing. :-( In a future
version of Perl, we will have safe signals. It's high on the developers'
wish list, but it's not there today. Sorry!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 10 Aug 97 17:17:51 GMT
From: "Alex Lane" <alexlane@ghg.net>
Subject: Re: Strange shebang behavior in linux
Message-Id: <01bca5b9$bd66e060$a86e42ce@zaika>
Answering my own question, with thanks to the folks who responded.
The script that did not work was taken from a DOS box, which meant that all
lines ended in \r\n. As everyone (including me, now) knows, UNIX ends its
lines with \n.
Stripping out the \r makes everything hunky dory.
Cheers...
alexlane@ghg.net ...speaking only for myself
Seabrook, Texas http://www.ghg.net/alexlane
PGP fingerprint: 7FDB06E2478479B4 323CA94865AA5BC2
"No plan survives initial contact with the enemy." -- Von Moltke
"...but without a plan, *you* will not survive." -- Lane
Alex Lane <alexlane@ghg.net> wrote in article
<01bca4fa$3a8e12e0$a26e42ce@zaika>...
> I recently brought a Linux box into existence and am having a problem
with
> perl scripts that use #!/usr/bin/perl to call the perl interpreter.
> 1. I've made sure the path to the perl interpreter is indeed
/usr/bin/perl
> 2. The scripts have been made executable.
> 3. One script, which prints "Howdy, world!" works perfectly.
> 4. A second script, which does something more complex, elicits an error
> message from the Bourne Again Shell, to the effect that "No such file or
> directory"
>
> Does anyone have any idea what I am doing wrong? Thanks in advance.
> Cheers...
> alexlane@ghg.net ...speaking only for myself
> Seabrook, Texas http://www.ghg.net/alexlane
> PGP fingerprint: 7FDB06E2478479B4 323CA94865AA5BC2
> "No plan survives initial contact with the enemy." -- Von Moltke
> "...but without a plan, *you* will not survive." -- Lane
>
>
------------------------------
Date: 7 Aug 1997 17:46:50 GMT
From: news@bofh.com (Jot Powers)
Subject: Re: Unclear documentation for map()
Message-Id: <5sd1ma$kga$1@gazette.corp.medtronic.com>
In article <nqowwlyfa81.fsf@mitra.phys.uit.no>, Tom Grydeland wrote:
>jot.news@bofh.com (Jot Powers) writes:
>
>> About then I realized that both getkey() and genkey() were probably
>> there to let people know that they needed to use a function to tell
>> perl what the mappings were. ^^^^^^^^^
>
>Not *needed to*, but *could*. If the key generation function is
>complicated, it would help clarify things too.
That is a good distinction. However, I think including it
without an explanation of some sort, even a single line, would
be very confusing to a newbie. Hell, I'm relatively experienced,
and obviously looked for answers that 90% of the people seem
to ignore, and I was confused for a few minutes. :)
>
>> Now, in my case I wanted the hash
>> for doing a poor man's 'sort -u', so I resorted to:
>
>Wait a second. You *are* of course aware of the FAQ entry (in perlfaq4)
>
> How can I extract just the unique elements of an array?
> =======================================================
>
>Perhaps this is what you want? (Sometimes, you can't use the FAQ
>without knowing, given your problem, which question to ask. :-)
>
>Chaining the answer to this faq with a vanilla sort gives you your
>"poor man's sort -u":
>
>@new_bob = sort grep {!$seen{$_}++} @bob;
>
>(Assuming, of course, that you can spare %seen for a minute.)
>Now wasn't that better?
*sigh* Now of course I'm embarrassed. This may work with
some modification. What I need is to extract the unique elements,
case-insensitive.
(I have a bunch of domain names, and since DNS is case-insensitive
I want to elminate duplicates that aren't exactly the same.)
So, it looks like:
@new_bob = sort grep {!$seen{uc($_)}++} @bob
Works fine.
My only defense is that I think my pager is broken for searching. Doing
a man perlfaq4 and a /unique returns one success:
...skipping
Use a hash. Here's code to do both and more. It assumes
that each element is unique in a given array:
...
Even though grep unique perfaq4.1 yields
node127% grep unique perlfaq4.1
.Sh "How can I extract just the unique elements of an array?"
.IX Subsection "How can I extract just the unique elements of an array?"
each element is unique in a given array:
.Sh "How can I get the unique keys from two hashes?"
.IX Subsection "How can I get the unique keys from two hashes?"
Thanks for the help, although my solution worked, this is more elegant.
--
Jot Powers news@bofh.com
Unix System Administrator
"Sometimes you just have to grab the bull by the tail and face the situation."
------------------------------
Date: 09 Aug 1997 19:59:38 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: simon_lee@super.zippo.com (Simon Lee)
Subject: Re: uppercase($mystring) ?
Message-Id: <8cg1sibv51.fsf@gadget.cscaper.com>
>>>>> "Simon" == Simon Lee <simon_lee@super.zippo.com> writes:
>> $string = "\U$string";
>>
Simon> Don't forget the \E !!!
Uh, no. \E is needed only when you have more characters in the same
string that you don't want the sticky-uppercase \U or sticky-lowercase
\L to apply to. As there was nothing here, it's perfectly safe.
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,495.69 collected, $182,159.85 spent; just 387 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: Sat, 09 Aug 1997 22:54:21 -0700
From: Chat Central <admin@no_spamchathub.com>
Subject: Re: Will Pay: Write this script for me!
Message-Id: <33ED578C.7CF3@no_spamchathub.com>
Tom Phoenix wrote:
>
> On 10 Aug 1997, Ilesa SW wrote:
>
> > I need someone to write a perl script for me, that takes an email
> > address in the query string, and then returns either the IP address of
> > that email address, or "no" if the user isn't online.
>
> This can be done for an email address exactly as successfully as for a
> postal address. That is to say, not at all. :-) You can't (in general)
> tell whether an email address is valid without sending mail to it and
> seeing if the mail gets there. And the same for a postal address.
>
> If somebody comes up with a script which claims to be able to tell whether
> a user is online or not, I'll be glad to give you an address for which it
> produces an incorrect result. If you're going to pay for a script, be sure
> to ask for a money-back guarantee! :-)
>
> > I think this can be accomplished with the finger protocol, but I don't
> > know.
>
> You can do some things with finger, but many systems don't support it at
> all.
>
> Now, having said all that, I'd like to ask a question: What are you trying
> to accomplish? If it can be done, maybe one of the helpful folks here will
> show you how to write the script to do it. Hope this helps!
>
> --
> Tom Phoenix http://www.teleport.com/~rootbeer/
> rootbeer@teleport.com PGP Skribu al mi per Esperanto!
> Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Actually, in a way, it *is* possible, but the only way I can think of,
is by doing an email verify. *but*, this would only work on systems that
allow it. If you have this implemented on your server, and thgis is all
you're trying to do it on, then it can work, but if you mean *any*
server.. then forget it.. a lot of servers don't even support finger
anymore anyway. I'd have to say that Tom is exactly right. But, if at
all, the verify is the only way I can think of to pull such a thing like
that off. (but only on your server, or another server that supports the
verify. Yet, that won't tell you if they are online, if that's what you
want, then I don't see how it's possible at all, unless you were to make
something that reads who's logged in (via unix perhaps).. ?.. That just
sounds like too much to bother with..you'd have to rewrite how th server
works. This is all assuming I understand you correctly.. as well as only
wanting this on your server. My point is, that you could somehow do this
on your own machine/server..but anywhere else you don't have access and
or permissions to actually change the server in that aspect, then forget
it.. And yet still..I can't say that would be entirely possible. Perhaps
I misunderstood this?..
(((Remove "no_spam" from address if you reply via email...)))
--
Chat Central
In the top 5 most accessed sites on WebCrawler
since the first week up, and holding strong!!!
Receiving up to and over 10,000 visitors a day worldwide
Administrator - Chat Hub / Chat Central:
http://www.chathub.com - OR - http://chat.nstate.net
E-Mail Contact:
chatmaster@chathub.com, webmaster@chathub.com, sales@chathub.com,
info@chathub.com, admin@chathub.com, chatmaster@nstate.net
Webmaster Northstate Net:
http://www.nstate.net
E-Mail Contact:
webmaster@nstate.net
------------------------------
Date: Sun, 10 Aug 1997 20:07:16 -0300
From: "Ekim E. YARDIMLI" <tetnys@ibm.net>
Subject: Re: Will Pay: Write this script for me!
Message-Id: <33EE49A4.4D93@ibm.net>
Ilesa SW wrote:
>
> I need someone to write a perl script for me, that takes an email address
> in the query string, and then returns either the IP address of that email
> address, or "no" if the user isn't online. I think this can be
> accomplished with the finger protocol, but I don't know. If you can do
> this for me, I'd pay...I know its a short script, if you know what you're
> doing. Unfortunately, I don't know a bit of Perl. If you can help me, send
> email to ilesasw@ilesa.com.
>
> Thanks,
> Mal
> ---
> ilesa software
> premium internet utility software
> www.ilesa.com
There is a way to find out if someone else is on the net though it's up
to the user, actually what you can do is to make or have made a program
that runs under windows using winsock. and will start runing on
connection to the isp and sends the users ip, to your server. (like
finger)
On your server i think a perl script (or any other independent program)
can fetch the call and store it in a database on the server. Later if
your end-user program also can recive data from your server (which is
not a difficult task really :) you can send a ping and get a pong, but
it all depends on your user (since it must have been installed on their
machine).
But then you would be forced to create a program for each os
(unix,mac,amiga!?!...) Though after seting up a system like that, the
sevices that can be provided are endless, or limited by the programer
(like chess games, answering machines, chat, news, advertisment on the
desktop :( ugh etc.) :)
Actually there is powwow out there i think they use a system like this.
And not to mention irc :)
Best wishes
____________________________________________________________________
Ekim E. YARDIMI - tetnys@ibm.net
------------------------------
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 840
*************************************