[10874] in Perl-Users-Digest
Perl-Users Digest, Issue: 4475 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Dec 21 21:07:21 1998
Date: Mon, 21 Dec 98 18:00:22 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 21 Dec 1998 Volume: 8 Number: 4475
Today's topics:
Re: arccos, arcsin,... <jhi@alpha.hut.fi>
Re: C functions in Perl <webmaster@gigagames.de>
Re: Can this be done (Henry Lifton)
Re: Color Editor (Clay Irving)
Re: explain an hash assignment: $hash{'key'}++ <r28629@email.sps.mot.com>
Re: explain an hash assignment: $hash{'key'}++ (Mark-Jason Dominus)
Re: explain an hash assignment: $hash{'key'}++ (Martien Verbruggen)
Re: explain an hash assignment: $hash{'key'}++ (Tim Gim Yee)
FTP with progress indication <kin@symmetrycomm.com>
Re: FTP with progress indication <Monty.Scroggins@mci.com>
Re: How do I catch this eval exception? <rick.delaney@home.com>
Re: Is it possible with perl? <zenin@bawdycaste.org>
It's about time (Nelson E. Ingersoll)
Re: Nested sorting (Larry Rosler)
Re: non-blocking socket connect question <aqumsieh@matrox.com>
perl CGI File Upload <esundby@divcomp.com>
Re: Perl Training - Worth it? (Chris Benson)
Please help me reading .csv textfiles <cva@abim.net>
Re: Please help me reading .csv textfiles (Martien Verbruggen)
Re: rename a large file problem (Ilya Zakharevich)
Re: replacement question (Clay Irving)
Text::Parser (Joonas Timo Taavetti Kekoni)
Tom Christiansen Fanclub <webmaster@gigagames.de>
Re: Turning Variables into CAPS? <r28629@email.sps.mot.com>
Re: Turning Variables into CAPS? (Larry Rosler)
Re: what's wrong with this bit of code? :) <uri@sysarch.com>
Re: what's wrong with this bit of code? :) (Andrew M. Langmead)
Re: what's wrong with this bit of code? :) (Larry Rosler)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 22 Dec 1998 00:11:31 +0200
From: Jarkko Hietaniemi <jhi@alpha.hut.fi>
Subject: Re: arccos, arcsin,...
Message-Id: <oeesoe9gn70.fsf@alpha.hut.fi>
In Perl 5.005_02 there's Math::Trig.
--
$jhi++; # http://www.iki.fi/~jhi/
# There is this special biologist word we use for 'stable'.
# It is 'dead'. -- Jack Cohen
------------------------------
Date: Mon, 21 Dec 1998 23:44:27 +0100
From: "Patrick Schnorbus" <webmaster@gigagames.de>
Subject: Re: C functions in Perl
Message-Id: <7dAf2.1831$t85.14645@news1.cityweb.de>
Hi Joachim,
i hope i4m allowed to answer in german :-)
es ist mvglich. lies dir das buch "Fortgeschrittene Perl-Programmierung"
erschienen bei O4Reilly durch, da sind weitere Infos.
greetings...
Patrick
------------------------------
Date: Tue, 22 Dec 1998 00:12:40 GMT
From: henlif@elsfl.com (Henry Lifton)
Subject: Re: Can this be done
Message-Id: <75mo5f$g59$1@remarQ.com>
Dear James:
Thank you very much. I think it works well, but I adapted it a little so it
seems more understandable to a thick headed one like myself. I could not use
the "my" because after this prints I open another file and use the $agentid
field to find the corresponding record.
What I finally came up with is this:
open(LAND,'/data/land.txt') || die "can't open file land";
@land=<LAND>;
$key=$ENV{'PATH_INFO'};
$key =~ s|/||;
foreach $line (@land) {
chomp($line);
($id,$agentid,$status,$proptype,$propname,
$price,$dateentered,$address,$city,$county,$state,
$zip,$country,$region,$occrate,$gsf,$rent,$cam,$annexp,
$caprate,$ceiling,$yb,$landarea,$gl,$gsi,$noi,$gradedoors,
$dockdoors,$pking,$desc,$terms,$imp,$comments,$url,$x) =split('\t',$line);
if ($id eq $key){
print "$address<BR>
$city, $state</font></b><BR>
\$$price</font><BR>;
print "</font></b>";
print "</td></tr>
In article <367D118B.69B7F237@idt.net>, jamesht <jamesht@idt.net> wrote:
>Hello,
>
>Here's a script which works fine:
>
>-----
>#
># for this example, test.txt holds (\t delimited):
>#
># id one two three four five six seven
># two two three four five six seven eight
>#
>use strict;
>my $key;
>my %land;
>#
># open the file, load the arays into the hash...
>#
>open(FILE, "test.txt") || die "sorry:$!";
>while(<FILE>) {
> chomp $_;
> my($id, @rest) = split("\t", $_);
> $land{$id} = \@rest;
>}
>close(FILE);
>#
># %land holds the file, keyed by the first field of the file:
>#
>
>foreach $key (sort(keys(%land))) {
> print $key . ": " . join(' ', @{$land{$key}}) . "\n";
>}
>
>#
># or to get the values:
>#
>my($one, $two, $three, $four, $five, $six, $seven, $eight) = @{$land{'two'}};
>print "\ntwo:\n";
>print $one . "\n";
>print $two . "\n";
>print $three . "\n";
>print $four . "\n";
>print $five . "\n";
>print $six . "\n";
>print $seven . "\n";
>print $eight . "\n";
>-----
>
>Any other questions, feel free to ask,
>
>James
>
>
------------------------------
Date: 21 Dec 1998 20:21:33 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: Color Editor
Message-Id: <75ms6t$foe@panix.com>
In <367D2DE4.49E001F0@email.sps.mot.com> Tk Soh <r28629@email.sps.mot.com> writes:
>you really should automate these replies ;-)
Yeah, how about:
Perl Editors
http://reference.perl.com/query.cgi?editors
--
Clay Irving
clay@panix.com
------------------------------
Date: Mon, 21 Dec 1998 16:32:58 -0600
From: Tk Soh <r28629@email.sps.mot.com>
Subject: Re: explain an hash assignment: $hash{'key'}++
Message-Id: <367ECC99.3D57BC94@email.sps.mot.com>
Tad McClellan wrote:
>
> Xah Lee (xah@web-central.net) wrote:
>
> : Can anyone explain how constructs like $hh{'ss'}++ works? Here's an example:
>
> That works just like (assuming $hh{'ss'} contains a number):
^^^^^^^^ ^^^^^^
I think someone will ask:
what if it's not a number? ;-)
-TK
------------------------------
Date: 21 Dec 1998 18:29:09 -0500
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: explain an hash assignment: $hash{'key'}++
Message-Id: <75mlk5$f4o$1@monet.op.net>
In article <367ECC99.3D57BC94@email.sps.mot.com>,
Tk Soh <r28629@email.sps.mot.com> wrote:
>> That works just like (assuming $hh{'ss'} contains a number):
> ^^^^^^^^ ^^^^^^
>I think someone will ask:
>
> what if it's not a number? ;-)
If it's not a number, it's converted to a number in the usual way.
For example:
$h{name} = '3Jane Tessier-Ashpool';
$h{name}++;
print $h{name}, "\n";
prints: 4
------------------------------
Date: Tue, 22 Dec 1998 00:09:18 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: explain an hash assignment: $hash{'key'}++
Message-Id: <OqBf2.27$%V5.270@nsw.nnrp.telstra.net>
In article <75mlk5$f4o$1@monet.op.net>,
mjd@op.net (Mark-Jason Dominus) writes:
> In article <367ECC99.3D57BC94@email.sps.mot.com>,
> Tk Soh <r28629@email.sps.mot.com> wrote:
>>> That works just like (assuming $hh{'ss'} contains a number):
>> ^^^^^^^^ ^^^^^^
>>I think someone will ask:
>>
>> what if it's not a number? ;-)
>
> If it's not a number, it's converted to a number in the usual way.
>
> For example:
>
> $h{name} = '3Jane Tessier-Ashpool';
> $h{name}++;
> print $h{name}, "\n";
>
> prints: 4
Of course, if it's not a number, and it doesn't start with a digit,
then $var++ is not equivalent to $var = $var + 1 or $var += 1;
# perl -w
$var = 'aa';
$var++;
print "$var\n";
$var = 'aa';
$var = $var + 1;
print "$var\n";
__END__
ab
Argument "aa" isn't numeric in add at - line 5.
1
#
This is documented in perlop:
# perldoc perlop
[snip]
The auto-increment operator has a little extra builtin magic
to it. If you increment a variable that is numeric, or that
has ever been used in a numeric context, you get a normal
increment. If, however, the variable has been used in only
string contexts since it was set, and has a value that is
not the empty string and matches the pattern /^[a-zA-Z]*[0-
9]*$/, the increment is done as a string, preserving each
character within its range, with carry:
[snip]
Although I believe that pattern up there should be
/^[a-zA-Z]+[0-9]*$/, because of:
# perl -w
$var = '3aa';
$var++;
print "$var\n";
$var = 'aa3aa';
$var++;
print "$var\n";
$var = 'aa3';
$var++;
print "$var\n";
__END__
4
1
aa4
#
When the value starts with a digit, a silent conversion is done, which
means that the magic is only triggered on a pattern like:
/^[a-zA-Z]+[0-9]*$/
perldoc bug?
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | I'm just very selective about what I
Commercial Dynamics Pty. Ltd. | accept as reality - Calvin
NSW, Australia |
------------------------------
Date: Tue, 22 Dec 1998 01:00:43 GMT
From: tgy@chocobo.org (Tim Gim Yee)
Subject: Re: explain an hash assignment: $hash{'key'}++
Message-Id: <367eebfe.319521055@news.oz.net>
On 21 Dec 1998 18:29:09 -0500, mjd@op.net (Mark-Jason Dominus) wrote:
>In article <367ECC99.3D57BC94@email.sps.mot.com>,
>Tk Soh <r28629@email.sps.mot.com> wrote:
>>> That works just like (assuming $hh{'ss'} contains a number):
>> ^^^^^^^^ ^^^^^^
>>I think someone will ask:
>>
>> what if it's not a number? ;-)
>
>If it's not a number, it's converted to a number in the usual way.
>
>For example:
>
> $h{name} = '3Jane Tessier-Ashpool';
> $h{name}++;
> print $h{name}, "\n";
>
>prints: 4
Not always. Magic auto-increment:
$h{name} = 'perk';
$h{name}++; # becomes 'perl'
--
Tim Gim Yee
http://www.dragonfire.net/~tgy/moogle/
"Kupo! Round and round you go! Moogle!"
------------------------------
Date: 21 Dec 1998 13:18:50 +0000
From: Kin Cho <kin@symmetrycomm.com>
Subject: FTP with progress indication
Message-Id: <uu2yp1vlx.fsf@server3.symmetrycomm.com>
I wanted to show, graphically or otherwise, indication of data transfer
progress of Net::FTP.
Any pointers? I'm reasonably familiar with Tk, a solution in that
direction will be great.
Thanks.
-kin
------------------------------
Date: Mon, 21 Dec 1998 23:04:37 GMT
From: "Monty Scroggins" <Monty.Scroggins@mci.com>
Subject: Re: FTP with progress indication
Message-Id: <9uAf2.942$dN4.4635@news.cwix.com>
There is a nifty module "Progressbar" written by Graham Barr
you can use for this.. You can find it on CPAN under GBARR
Monty
Kin Cho wrote in message ...
>I wanted to show, graphically or otherwise, indication of data transfer
>progress of Net::FTP.
>
>Any pointers? I'm reasonably familiar with Tk, a solution in that
>direction will be great.
>
>Thanks.
>
>-kin
>
------------------------------
Date: Mon, 21 Dec 1998 23:11:12 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: How do I catch this eval exception?
Message-Id: <367ED749.BF9BCA5@home.com>
[posted & mailed]
Uri Guttman wrote:
>
> >>>>> "RD" == Rick Delaney <rick.delaney@home.com> writes:
> RD> Can someone explain how the pragmatic modules, in particular
> RD> strict.pm, are implemented?
>
[good explanation snipped]
>
> hth,
Thanks, that helps a lot.
--
Rick Delaney
rick.delaney@shaw.wave.ca
------------------------------
Date: 21 Dec 1998 23:52:02 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: Is it possible with perl?
Message-Id: <914284446.604145@thrush.omix.com>
[posted & mailed]
Ys_Kim <khw101@chollian.net> wrote:
: Is it possible to submit a form to multiful cgi scripts at the same time
: and each script located in different places?
: I'm making an web site which automatically cross-post messages
: from the site to 5 different sites's message boards at the same time.
: I saw the similar scripts which help registering my homepage to
: serveral search engine.
: But They have many submit buttons in a page for the search engines
: and I had to click on all submit buttons.
: Is it possible to post messages to several places at the same time
: automatically by just one clicking?
: Any good advice will be highly appreciated.
Yes, it's quite possible, though indirectly.
I'd recommend creating one CGI form handler that collects the data,
and then using the LWP modules ("lib-www" found at your local CPAN),
resubmit the information to each of the other sites.
Since each sight may likely have a different interface, you'd be
well advised to abstract out the handlers into there own modules and
dynamically load them and/or use a dispatch table.
HTML Form
\
->Your CGI
\ /
|
|-> Some site
|-> Another site
\-> Still another site
<---HTML Back from your CGI to the user.
--
-Zenin (zenin@archive.rhps.org) From The Blue Camel we learn:
BSD: A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts. Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.) The full chemical name is "Berkeley Standard Distribution".
------------------------------
Date: Mon, 21 Dec 1998 18:04:35 GMT
From: ningersoll@codenet.doh.net (Nelson E. Ingersoll)
Subject: It's about time
Message-Id: <367e8c0a.566322252@news.codenet.net>
Greetings,
Yet another newbie, who is falling in love with, Perl question.
I can list() an ASCII date/time string and pull the appropriate
year/month/day/hour/min/sec sub-strings from an ASCII time string.
And using various Perl functions I can get the local/gm time in
seconds since Jan 1, 1970 which is cool. However, how can I convert
an ASCII time string, such as 21-Dec-1998 to seconds since 1-Jan-1970
so that it can be used with localtime() for example?
I have looked through a couple of online resources as well as my
Camel and Llama books and don't find anything. It's probably trivial,
but I am missing something I'm sure.
- Nelson Ingersoll
============================================================
I accept email. Just remove the '.DOH' from the the return
address. And, please forgive the subterfuge. I hate spam;
but love newsgroups.
============================================================
------------------------------
Date: Mon, 21 Dec 1998 15:44:44 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Nested sorting
Message-Id: <MPG.10e87d4715ee4a889898e0@nntp.hpl.hp.com>
[Posted to comp.lang.perl.misc and a copy mailed.]
In article <wsmbtkxirqa.fsf@hzsac328.nl.lucent.com> on 21 Dec 1998
13:50:37 +0100, Micha3 Rutka <rutka@lucent.com> says...
> ... Here is how you
> can sort floats (non-negative):
>
> @sorted_array_by_floats = map { substr($_,4) }
> sort
> map { pack("f",extract_float_from($_)).$_ }
> @unsorted_array_containing_floats;
>
> Simple, isn't it?
Simple, but not portable. This works on machines where the byte order
of a floating-point number is the same as the byte order of a string
(big-endian), but doesn't work on machines where numbers are little-
endian (such as Intel). One then has to reverse the bytes in the packed
representation.
Also, as Perl's internal representation of floating-point numbers is as
doubles, one would unnecessarily lose range and precision with this
code, possibly leading to mis-sorts. I would use 'd' conversion into an
eight-byte sort key.
> Some people misunderstood this technique and instead of using pack()
> they start to use sprintf, however, from the birth of this technique
> pack() was used. Even I caught myself in using sprintf, before I
> returned my mind to the "roots", which are in my head anyway ;-).
Pack works fine for non-negative integers, using 'N' (network order),
which is always big-endian, but it does not work portably for floating-
point numbers.
> The same technique can be, of course, used to sort negative numbers as
> well, but requires one extra step in initial maping, which would slow
> down the whole thing (just a little, as the extra step requires one
> if-then-else and xor). Therefore I do not recomend this as
> the generic solution.
Why not? Sorting all-negative integers requires negating the integers
and then reversing the sort result. Sorting signed integers requires
adding 1 << 31, as has been presented previously. It copes with all
signed integers (-(1 << 31) to (1 << 31) - 1) by remapping them to (0 to
(1 << 32) - 1) and sorting the four-byte string alphabetically.
> I leave this special case as an excercise (if
> somebody *really* need it, then e-mail me).
That hardly seems necessary. I can't imagine what your 'if-then-else
and xor' would do, in any case. But how about a portable solution for
floating-point numbers, unsigned or signed?
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Mon, 21 Dec 1998 14:34:36 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: non-blocking socket connect question
Message-Id: <x3yogoxuw4z.fsf@tigre.matrox.com>
adrade@wwa.com (Adam Levy) writes:
> I was looking for info on connect(). I want to be able to connect, send
> some data, and then receive data as it comes in. But I dont want this
> connection to block another like connection going on with another server.
Then you should read about select().
It actually checks whether a filehandle has anything useful to read
from. You can specify a timeout, usually 0, for the operation. If
there is something readable in the filehandle, it returns a true
value. Else it returns a false value.
Example:
socket(SOCKET, PF_INET, SOCK_STREAM, (getprotobyname('tcp'))[2]);
bind (SOCKET, pack('Sna4x8', AF_INET, $port, "\0\0\0\0"))
|| die "Can't bind to port $port\n";
listen(SOCKET,5);
SOCKET->autoflush();
my $rbits='';
vec($rbits, fileno(SOCKET), 1) = 1;
if (select($rbits, undef, undef, 0)) {
# you can read from <SOCKET>
} else {
# nothing to read
}
Hope this helps,
Ala
------------------------------
Date: Mon, 21 Dec 1998 18:55:15 -0500
From: Eric Sundby <esundby@divcomp.com>
Subject: perl CGI File Upload
Message-Id: <367EDFE3.EFC5E0EF@divcomp.com>
I'm attempting to use perl to upload a file via a web browser. Things
seem to work fine when I upload text. However, when I attempt to upload
a binary file, I get the following error:
SHORT READ Expecting 8192 Got 124
Any ideas? Any alternatives?
Please email me directly as well as posting on the net.
Thanks,
Eric Sundby
esundby@divcomp.com
------------------------------
Date: 21 Dec 1998 21:41:52 -0000
From: chrisb@jesmond.demon.co.uk (Chris Benson)
Subject: Re: Perl Training - Worth it?
Message-Id: <75mfb0$b3i@jesmond.demon.co.uk>
In article <F4BnAw.Joo@news.boeing.com>,
Sam Patton <samuel.patton@wichita.boeing.com> wrote:
>My only problem with the training that I have seen available is that its all
>geared to
>UNIX. I and some of my associates would very much like to find a good class
>on
>on using PERL in the WIN32 environment.
>
>Any suggestions.
Well, I offer you choice of Unix(tm) *or* NT(c) but only near Reading,
Berkshire (UK) :-(for you).
Surely someone in the US has a course that can use Win32; ???
--
Chris Benson
------------------------------
Date: Tue, 22 Dec 1998 02:28:19 +0100
From: Christian von Appen <cva@abim.net>
Subject: Please help me reading .csv textfiles
Message-Id: <367EF5B3.1E0ED1CC@abim.net>
Hi all,
I am trying to read .csv (comma-seperated) files, which have been
exported from MS Excel or Access, for example.
Due to the problems with fields that contain one or more commas or
double-quotes, I am looking for an reliable solution instead of my own
script, which does not work in some cases.
Unfortunately, I cannot use any new modules, because my program will be
copied to people which do not know how to compile/install modules on
their own system.
I cannot backslash the " or ; in fields, bacause the files come from the
customers, which export them from their databases.
I have been looking around, but could not find an answer. But it seems
that every database or spreadsheet application can import these files,
so why is there no algorithm available on the net?
So what I am looking for is sort of an algorithm or subroutine that does
the job. Please help me !!! :-)
Regards,
Christian von Appen
------------------------------
Date: Tue, 22 Dec 1998 01:39:20 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Please help me reading .csv textfiles
Message-Id: <cLCf2.35$%V5.246@nsw.nnrp.telstra.net>
In article <367EF5B3.1E0ED1CC@abim.net>,
Christian von Appen <cva@abim.net> writes:
> Hi all,
>
> I am trying to read .csv (comma-seperated) files, which have been
> exported from MS Excel or Access, for example.
use Text::CSV or Text::ParseWords
> Unfortunately, I cannot use any new modules, because my program will be
> copied to people which do not know how to compile/install modules on
> their own system.
Ah.. Well, you can either bundle the modules with your script, or
extract the relevant code from the modules, and put it in your script.
Normally ., the current directory, is part of the @INC, which means
that if Text/ParseWords.pm can be found from your current directory,
there shouldn't be a problem. If the script isn't run from your
current directory, you can use the FindBin module, and install it in
the same place as your script.
Of course, the simplest way is to just cut and paste all of the
Text::ParseWords code into your script, after which you should just be
able to use it there, maybe after some tweaking of the code.
Both Text::CSV and Text::ParseWords are pure perl modules, I believe.
> I have been looking around, but could not find an answer. But it seems
> that every database or spreadsheet application can import these files,
> so why is there no algorithm available on the net?
Uhm... There is.. And many implementations of it, the above two being
perl modules. And you can just either copy the code verbatim, or just
see how they do it.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au |
Commercial Dynamics Pty. Ltd. | Curiouser and curiouser, said Alice.
NSW, Australia |
------------------------------
Date: 21 Dec 1998 23:34:13 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: rename a large file problem
Message-Id: <75mltl$3ra$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Mark-Jason Dominus
<mjd@op.net>],
who wrote in article <75ma3c$5st$1@monet.op.net>:
> In article <75m218$lcu$1@agate.berkeley.edu>,
> Dong Wang <dwang@nature.Berkeley.EDU> wrote:
> ># before unzip, delete the .bak file first
> >unlink("oldfile.bak")
> >|| die("Can't delete the oldfile.bak file.\n");
> ># rename the oldfile file to oldfile.bak
> >rename("oldfile", "oldfile.bak") || die("Can't rename oldfile.\n");
>
> Oh, don't do that. Get rid of the `unlink'. The whole point of
> `rename' is that if it fails, you still have the original files.
Only on *nixish systems.
Ilya
------------------------------
Date: 21 Dec 1998 20:28:45 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: replacement question
Message-Id: <75mskd$gc9@panix.com>
In <367D45F0.525068B7@mailexcite.com> me <groans@mailexcite.com> writes:
>Thanks for responding. I have not had too much success with LWP and the
>modules(each time my script references one, it says that the module needs
>other modules. When I put them where they are supposed to be, it tells
>me I need even more. SOme I have not been able to find, so I just gave up).
>Perhaps I will take this time to revisit them . . . Thanks again!
Next time you revisit them, use the CPAN module (included in the Perl
distribution) to install other modules -- You'll be happier for it. :)
--
Clay Irving
clay@panix.com
------------------------------
Date: 21 Dec 1998 23:35:26 GMT
From: jkekoni@cc.hut.fi (Joonas Timo Taavetti Kekoni)
Subject: Text::Parser
Message-Id: <75mlvu$nv5$1@news.cs.hut.fi>
The CPAN metions the Text::Parser, but i cant find it. Has it changed name
or something?
--
_- Joonas Kekoni OH2MTF I -_
_-internet: jkekoni@cc.hut.fi I DO NOT EAT. -_
_-slowmail: j{mer{ntaival 7a176 I -_
_- 02150Espoo I It is a monitor -_
_- Finland/Europe I -_
------------------------------
Date: Tue, 22 Dec 1998 01:47:02 +0100
From: "Patrick Schnorbus" <webmaster@gigagames.de>
Subject: Tom Christiansen Fanclub
Message-Id: <10Cf2.1478$xN2.13239@news2.cityweb.de>
All Tom Christiansen-Fans; Mail me!
wanna make a Tom Christiansen-Fanclub Website!
webmaster@gigagames.de
greetings from germany!
Patrick
------------------------------
Date: Mon, 21 Dec 1998 16:26:59 -0600
From: Tk Soh <r28629@email.sps.mot.com>
Subject: Re: Turning Variables into CAPS?
Message-Id: <367ECB33.6872C088@email.sps.mot.com>
Larry Rosler wrote:
>
> [Posted to comp.lang.perl.misc and a copy mailed.]
>
> In article <75m1v2$qps$1@camel18.mindspring.com> on Mon, 21 Dec 1998
> 12:58:58 -0500, Allan M. Due <Allan@due.net> says...
> > Artoo wrote in message <75lvhe$89g$1@plug.news.pipex.net>...
> > >I seem to remember a while back on this newsgroup someone was asking about
> > >tuning variables into Caps. Can someone remind me about how you turn the
> > >first letter of a variable into caps and the entire variable into Caps?
> >
> > One way:
> >
> > #!/usr/local/bin/perl -w
> > use strict;
> > my $variable = 'abcdefghijklmnopqrstuvwxyz';
> > my $caps;
> >
> > ($caps = $variable) =~ s/(^[a-z])/uc($1)/e;
> > print $caps,"\n";
>
> Well, yeah, Allan, but you forgot about the function to do that:
>
> my $caps = ucfirst $variable;
> print $caps;
>
> which has the advantages of handling locale-sensitive letters correctly,
> and is much faster:
ucfirst() only converts the first letter of the string. any function
that converts first letter of each word to uppercase, etc?
I always find the case conversion function in the word processor
something useful.
-TK
------------------------------
Date: Mon, 21 Dec 1998 16:07:17 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Turning Variables into CAPS?
Message-Id: <MPG.10e88294a3c7a4b29898e1@nntp.hpl.hp.com>
[Posted to comp.lang.perl.misc and a copy mailed.]
In article <367ECB33.6872C088@email.sps.mot.com> on Mon, 21 Dec 1998
16:26:59 -0600, Tk Soh <r28629@email.sps.mot.com> says...
...
> ucfirst() only converts the first letter of the string. any function
> that converts first letter of each word to uppercase, etc?
>
> I always find the case conversion function in the word processor
> something useful.
How smart is it, though? The conversion of the first character of every
word to uppercase is rather trivial. The more interesting issue is
which words *not* to convert. See the following thread:
http://x9.dejanews.com/getdoc.xp?AN=386689410
Re: Converting to Uppercase to some Lower Case.
Author: Craig Berry
Email: cberry@cinenet.net
Date: 1998/08/29
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 21 Dec 1998 17:23:46 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: what's wrong with this bit of code? :)
Message-Id: <x7n24hjfrh.fsf@sysarch.com>
>>>>> "bdf" == brian d foy <comdog@computerdog.com> writes:
bdf> In article <wnyf2.1$i04.186794@news0.optus.net.au>, "Gavin Cato"
bdf> <gavin@optus.net.au.dontspam.myass> posted:
>> This don't work! It compiles ok in perl but doesnt send a message,
>> I can't see anything in the log by sendmail sayinf it has sent it /
>> tried to. In short it's a mystery.
bdf> hmmm... no error checking and it doesn't look like a proper mail
bdf> message. where does the header end and the body begin?
other than the usual comments seen already i think his headers would end here:
>> open MAIL, "|$sendmail -t -i";
>> print MAIL "To: $destination\n";
>> print MAIL "From: $replyto\n";
>> print MAIL "Route update as follows, from $replyto - $companyname \n\n";
>> print MAIL "Origin AS:\t$as\n";
>> print MAIL "Transit AS:\t7474\n";
>> print MAIL "Action:\tADD\n";
>> print MAIL "Route registered in:\tRADB\n";
>> print MAIL "Neighbour Address:\t$peer\n";
>> print MAIL "\n";
^^ ^^
2 \n in a row
>> print MAIL "Routes:\n";
looks like a header but would be in body.
>> print MAIL "\n";
>> print MAIL "$network $mask\n";
>> close MAIL;
otherwise a total newbie broken open | problem.
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
Perl Hacker for Hire ---------------------- Perl, Internet, UNIX Consulting
uri@sysarch.com ------------------------------------ http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
------------------------------
Date: Mon, 21 Dec 1998 22:28:38 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: what's wrong with this bit of code? :)
Message-Id: <F4C6Fq.H0v@world.std.com>
"Gavin Cato" <gavin@optus.net.au.dontspam.myass> writes:
>This don't work! It compiles ok in perl but doesnt send a message, I can't
>see anything in the log by sendmail sayinf it has sent it / tried to. In
>short it's a mystery.
Lets start with the simple one, is the variable "$sendmail" set
previously in the script? Otherwise, you will be trying to run the
program "-t" which I doubt exists. Does the contents of $sendmail
contain the path the the sendmail executable on your system? Various
systems have the path to sendmail in different places (/usr/lib,
/usr/sbin, /etc, and probably a dozen others.)
If it isn't that simple, then the next things to look at are whether
the open() and close() functions succeed or fail. Both functions
return an error code, but you are not checking it.
open MAIL, "|$sendmail -t -i" or die "Can't run $sendmail: $!\n";
and
close MAIL or die "Error while running $sendmail: $!\n";
Lastly, the line "Route update..." doesn't look look like a header,
should the line above it have two consecutive newlines?
Finally, have you thought about formatting your code as a single long
heredoc? Personally, I think this looks so much easier to read.
print MAIL <<END_OF_MESSAGE;
To: $destination
From: $replyto
Route update as follows, from $replyto - $companyname
Origin AS:\t$as
Transit AS:\t7474
Action:\tADD
Route registered in:\tRADB
Neighbour Address:\t$peer
Routes:
$network $mask
END_OF_MESSAGE
--
Andrew Langmead
------------------------------
Date: Mon, 21 Dec 1998 15:11:04 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: what's wrong with this bit of code? :)
Message-Id: <MPG.10e87565b910b0169898df@nntp.hpl.hp.com>
In article <x7n24hjfrh.fsf@sysarch.com> on 21 Dec 1998 17:23:46 -0500,
Uri Guttman <uri@sysarch.com> says...
...
+ other than the usual comments seen already i think his headers would
end here:
+
+ >> open MAIL, "|$sendmail -t -i";
+ >> print MAIL "To: $destination\n";
+ >> print MAIL "From: $replyto\n";
+ >> print MAIL "Route update as follows, from $replyto - $companyname
\n\n";
There are 2 \n in a row here! All the rest would be in the body.
+ >> print MAIL "Origin AS:\t$as\n";
+ >> print MAIL "Transit AS:\t7474\n";
+ >> print MAIL "Action:\tADD\n";
+ >> print MAIL "Route registered in:\tRADB\n";
+ >> print MAIL "Neighbour Address:\t$peer\n";
+ >> print MAIL "\n";
+ ^^ ^^
+ 2 \n in a row
+
+ >> print MAIL "Routes:\n";
+
+ looks like a header but would be in body.
+
+ >> print MAIL "\n";
+ >> print MAIL "$network $mask\n";
+ >> close MAIL;
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 4475
**************************************