[21704] in Perl-Users-Digest
Perl-Users Digest, Issue: 3908 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 3 09:07:38 2002
Date: Thu, 3 Oct 2002 06:05:13 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 3 Oct 2002 Volume: 10 Number: 3908
Today's topics:
Delete, then die - buy why? <spikey-wan@bigfoot.com>
Re: Delete, then die - buy why? <bernard.el-hagin@DODGE_THISlido-tech.net>
Re: Fuzzy text string match code needed <bart.lateur@pandora.be>
Re: Help w map & its iterator plse (Jasper)
Re: newbie fine-tune first program mod_perl <flavell@mail.cern.ch>
Re: Perl Tutor Wanted - Mtn View, CA <flavell@mail.cern.ch>
Re: Perl Tutor Wanted - Mtn View, CA <flavell@mail.cern.ch>
Re: Printing text to a file (Tad McClellan)
Problem with Class::Date Module <apobull@yahoo.com>
Re: Script stops working when DBI added. Why? <flavell@mail.cern.ch>
Re: script.pl?parameter - can anyone help me figure thi <flavell@mail.cern.ch>
Re: script.pl?parameter - can anyone help me figure thi <nuba@dcc.ufmg.br>
Re: script.pl?parameter - can anyone help me figure thi (Helgi Briem)
Re: script.pl?parameter - can anyone help me figure thi <nuba@dcc.ufmg.br>
Re: Source-filename from diamond-operator (Tad McClellan)
Re: Splice function with arrays (tî'pô)
Re: Splice function with arrays <bart.lateur@pandora.be>
Re: String substitution of 3+ digit numbers only? (Tad McClellan)
Trouble getting a status back from SMTP <ee@ee.ee>
Re: Two email things in Perl <adam@connectpoint.co.uk>
Re: using Net::SMTP, server reports, "Software caused c <abaugher@esc.pike.il.us>
What is the best way for file/stream IO in Perl? <paul@pco.iis.nsk.su>
What is the best way for file/stream IO in Perl? <paul@pco.iis.nsk.su>
What is the best way for file/stream IO in Perl? <paul@pco.iis.nsk.su>
What is the best way for file/stream IO in Perl? <paul@pco.iis.nsk.su>
What is the best way for file/stream IO in Perl? <paul@pco.iis.nsk.su>
What is the best way for file/stream IO in Perl? <paul@pco.iis.nsk.su>
What is the best way for file/stream IO in Perl? <paul@pco.iis.nsk.su>
Re: What is the best way for file/stream IO in Perl? <bernard.el-hagin@DODGE_THISlido-tech.net>
Re: || versus OR (tî'pô)
Re: || versus OR <bart.lateur@pandora.be>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 3 Oct 2002 12:56:13 +0100
From: "Richard S Beckett" <spikey-wan@bigfoot.com>
Subject: Delete, then die - buy why?
Message-Id: <anhba5$s55$1@newshost.mot.com>
I have the following one line script:
system ("del results.xls") or die "Can't delete old spreadsheet! $!\n";
The file exists, and is deleted, but I then get the message:
Can't delete old spreadsheet! No such file or directory
I _really_ don't understand why!
Can anyone see what I did wrong?
Thanks.
R.
------------------------------
Date: Thu, 3 Oct 2002 12:08:51 +0000 (UTC)
From: Bernard El-Hagin <bernard.el-hagin@DODGE_THISlido-tech.net>
Subject: Re: Delete, then die - buy why?
Message-Id: <slrnapocnk.142.bernard.el-hagin@gdndev25.lido-tech>
In article <anhba5$s55$1@newshost.mot.com>, Richard S Beckett wrote:
> I have the following one line script:
>
> system ("del results.xls") or die "Can't delete old spreadsheet! $!\n";
>
> The file exists, and is deleted, but I then get the message:
>
> Can't delete old spreadsheet! No such file or directory
>
> I _really_ don't understand why!
>
> Can anyone see what I did wrong?
system() returns 0 when it doesn't fail.
perldoc -f system
Cheers,
Bernard
--
echo 42|perl -pe '$#="Just another Perl hacker,"'
------------------------------
Date: Thu, 03 Oct 2002 10:56:11 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: Fuzzy text string match code needed
Message-Id: <5u7opukalkl4h8mi7oq7fg9gvsi8vmd3h3@4ax.com>
Aaron D. Fuegi wrote:
> I am wondering if anyone can direct me to code for doing fuzzy string
>matches of text strings. Basically, I have a list of strings (game names
>in actuality) and, given another string, I want to know if it matches any
>of the existing strings, preferrably with some confidence percentage.
A search on CPAN reveals the modules String::Approx and
String::Similarity. I think that these can do what you want, or at
least, offer a starting point.
Furthermore, I know of a Soundex module, Text::Soundex, but that will
likely work better for English words. There may be more similar modules
out there.
--
Bart.
------------------------------
Date: 3 Oct 2002 05:47:14 -0700
From: jasper@mccrea.demon.co.uk (Jasper)
Subject: Re: Help w map & its iterator plse
Message-Id: <b6891527.0210030447.33cad71e@posting.google.com>
"Dick Penny" <penny1482@attbi.com> wrote in message news:<KnNm9.17310$dp1.47208@rwcrnsc52.ops.asp.att.net>...
> Here I go again, 3rd time in one day, you guys put up with a lot. Thanks.
>
> I've successfully transformed an array of strings (actually from a file but
> not illustrated here) into an array of arrays containing strings(numbers)
> which I can access as a 2D matrix. Now I am trying to insert decimal points
> into all numbers whose string reprensation is 6 digits. My hang up (I think)
> is that I don't know how to use the 1st iterator $_ which is a ref to an
> annon array as input to a map.
>
> Code follows, I desire @numbrs2 to be same size, shape, type, as @numbrs BUT
> with decimal points inserted into 6 digit strings, effectively scaling the
> data.
>
> Can this all be done with a chain of maps?
>
> _______ trial code, runs, but bad results
> use strict;
> use warnings;
> use Data::Dumper;
> my @lines = (
> 'SPH 083000 111200 111300 111100 111280 503 959',
> 'SPH 084000 111250 111380 111200 111370 354 115',
> 'SPH 084500 111350 111390 111050 111100 353 747' );
> my @numbrs = map{[/\d+/g]} @lines;
> my @numbrs2 =();
> print "numbrs are\n", Dumper @numbrs;
> foreach (@numbrs)
> { @numbrs2 = map{[$_ =~ s/(\d{4})(\d{2})/$1\.$2/g]} @$_ }
> print "numbrs2 are\n", Dumper @numbrs2;
>
foreach (@numbrs) {
foreach (@$_) {
s/^(\d{4})(\d{2})$/$1\.$2/
}
}
This loop changes the values in the array (and the arrays therein).
There is no need to create a second array with map..
Jasper
------------------------------
Date: Thu, 3 Oct 2002 12:04:25 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: newbie fine-tune first program mod_perl
Message-Id: <Pine.LNX.4.40.0210031153500.27575-100000@lxplus072.cern.ch>
On Oct 2, Newbie inscribed on the eternal scroll:
> If you port it to mod_perl, you might want to drop the bloated CGI module
> all together.
I don't see the logic.
> You will have better memory usage
Well, smaller code uses less memory, can't disagree with that. But
memory is cheap, whereas development effort and bug-hunting is
expensive. Don't forget the potential security issues involved in any
server-side scripting situation.
If every different script uses its own hand-knitted CGI routines, how
does the total memory footprint compare with the situation where every
script is using the same CGI.pm module?
> and much much greater performance boost with mod_perl.
Compared with what?
> One of the misconceptions mod_perl is
> people would think that writing modperl handlers is more complicated than
> CGI scripts. It is not.
It sounds as if you're saying that, development-wise, there's a
similar amount of motivation for using CGI.pm in mod_perl contexts as
there is in CGI contexts. You seem to think that motivation is small;
some of us disagree. Consult previous threads on the topic to
understand the point. Beware of the troll.
--
"Go not to Usenet for advice, for they will say both 'No' and
'Yes' and 'Try Another Newsgroup' " - Tim Illingworth
------------------------------
Date: Thu, 3 Oct 2002 12:12:55 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Perl Tutor Wanted - Mtn View, CA
Message-Id: <Pine.LNX.4.40.0210031206210.27575-100000@lxplus072.cern.ch>
On Oct 3, M Browning inscribed on the eternal scroll:
> (query the FAQs) invaluable. Users who find the CLI objectionable may
> find Perldoc online helpful:
>
> http://www.perldoc.com/
But keep in mind that the documentation installed with your own
version of Perl is the one that relates to that version.
Sometimes that is beneficial (if the issue relates to
version-dependent details)
Sometimes that is detrimental (e.g if the installed documentation
contains factual errors which have been corrected in a later version).
BTW, http://www.perl.com/pub/q/documentation still relates to Perl
5.6. Comments?
cheers
------------------------------
Date: Thu, 3 Oct 2002 12:31:43 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Perl Tutor Wanted - Mtn View, CA
Message-Id: <Pine.LNX.4.40.0210031217320.27575-100000@lxplus072.cern.ch>
On Oct 2, Newbie inscribed on the eternal scroll:
> If you can
> endure the egoistic and arrogant attitude, you'll learn a bunch on clpm.
For as long as I have known the usenet big-N technical groups (for the
various historical values on N), a direct posting style - perceived by
some to be abrasive - has been the norm. Especially towards those who
don't seem to be bringing the appropriate level of effort to helping
themselves.
c.l.p.misc doesn't seem to me to be unusual in that regard. We're
getting (if we can recognise it amongst the general noise) some top
quality technical advice from serious practitioners, some of whom are
charging hundreds of dollars an hour for their professional expertise
in a different context. It maddens me to see the way that some
ignorant slobs - apparently determined to drag everyone else down to
their inadequate technical level in the interests of getting a free
handout and not needing to do any thinking for themselves - have
driven some really helpful contributors away in the past. I for one
(as a dabbler in all too many different fields and a master of none
of them) am thankful that some stalwarts have stuck it out.
[f'ups set]
------------------------------
Date: Thu, 03 Oct 2002 12:58:34 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Printing text to a file
Message-Id: <slrnapofg2.6ft.tadmc@magna.augustmail.com>
Newbie <mike_constant@yahoo.com> wrote:
> "Crackpot" <Crackhead@mensa.org> wrote in message
>
>> How do I print a block of
>> text with special characters in Perl?
>
> print q(what's up, dude?);
For more info, see "Quote and Quote-like Operators" in perlop.pod.
> my $text =<<'EOT';
> what's up, dude?
> EOT
>
> print $text;
For more info, see "Scalar value constructors" in perldata.pod.
A line-oriented form of quoting is based on the shell
"here-document" syntax...
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 3 Oct 2002 08:58:28 -0400
From: "Bill Smith" <apobull@yahoo.com>
Subject: Problem with Class::Date Module
Message-Id: <anhetm$dvhe3$1@ID-135411.news.dfncis.de>
Hi,
I just installed the latest version of the class::date module and ran into a
problem with a script which is referencing it. At 12:01 AM each day I had a
script kick off which computed the date at that time and created a file
based on the date in dd-mm-yyyy format. I computed the current date using
the now call. Since installing the new version use of the now call returns
the previous day as the current date. i.e. if the script runs at 12:01 AM on
10-03-2002 it returns 10-02-2002 as the current date. If the script runs
about 5 hours later the expected date is returned. I see my problem is that
the date is returned in GMT. I need to return it in EST. What code do I need
to add to my script in order to have the time in EST returned when the
scripts runs at 12:01 AM and not in GMT. I took a look at the docs for the
module but still not certain of what I should add. I'll include my script
below for reference. It is pretty short
use Class::Date qw(:errors date localdate gmdate now);
local $Class::Date::DATE_FORMAT="%m-%d-%Y";
$LOGDIR="/flow/logs";
$BINDIR="/flow/bin";
chdir $LOGDIR or die "Could not chdir to $LOGDIR $!";
system("pkill fdget");
#print ("Pkill value is $a\n");
$curdate = now';
$prevday = $curdate - '1D';
system("$BINDIR/fdget 2001 >> $LOGDIR/$curdate &");
system("sleep 3600");
system("gzip -9 $prevday");
Thanks,
Bill
------------------------------
Date: Thu, 3 Oct 2002 11:50:44 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Script stops working when DBI added. Why?
Message-Id: <Pine.LNX.4.40.0210031145270.27575-100000@lxplus072.cern.ch>
On Oct 2, Helgi Briem inscribed on the eternal scroll:
> You probably had Windows linebreaks (\r\n)
I'm reminded once again of those apocryphal Nile dwellers, who used
the same word for "north" as for "downstream".
Windows newlines are \015\012. On a proportion of platforms, that
happens to be the physical representation of \r\n, but it would be no
more accurate to explain Windows newlines as \r\n than it is to
explain the Euphrates as "the river that goes downstream by going
upstream".
SCNR.
------------------------------
Date: Thu, 3 Oct 2002 11:44:56 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: script.pl?parameter - can anyone help me figure this out?
Message-Id: <Pine.LNX.4.40.0210031143240.27575-100000@lxplus072.cern.ch>
On Oct 2, Nuba inscribed on the eternal scroll:
> use CGI qw"param debug";
>
> print("Content-type: text/html\n\r\n\r");
^^^^^^^^
What???
Talk about buying a dog - and then barking yourself (badly).
------------------------------
Date: Thu, 3 Oct 2002 08:26:17 -0300
From: Nuba <nuba@dcc.ufmg.br>
Subject: Re: script.pl?parameter - can anyone help me figure this out?
Message-Id: <Pine.GSO.4.21.0210030823070.14439-100000@turmalina.dcc.ufmg.br>
[excerpt]
On Thu, 3 Oct 2002, Alan J. Flavell wrote:
> > use CGI qw"param debug";
> >
> > print("Content-type: text/html\n\r\n\r");
>
> What???
[/excerpt]
Hello Allan
Err... well, google says:
64 hits searching for "Content-type: text/html\n\r\n\r"
1,700 hits searching for "Content-type: text/html\r\n\r\n"
It looks it is a rather common mistake. Anyway, it's working !
Check it out at http://foco.fae.ufmg.br/zerokid/input.pl?hello+world
Nuba
>
------------------------------
Date: Thu, 03 Oct 2002 11:53:02 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: script.pl?parameter - can anyone help me figure this out?
Message-Id: <3d9c2ee7.2085891653@news.cis.dfn.de>
On Thu, 3 Oct 2002 08:26:17 -0300, Nuba <nuba@dcc.ufmg.br>
wrote:
>[excerpt]
>On Thu, 3 Oct 2002, Alan J. Flavell wrote:
>> > use CGI qw"param debug";
>> > print("Content-type: text/html\n\r\n\r");
>> What???
>[/excerpt]
>Err... well, google says:
>64 hits searching for "Content-type: text/html\n\r\n\r"
>1,700 hits searching for "Content-type: text/html\r\n\r\n"
>
>It looks it is a rather common mistake. Anyway, it's working !
>Check it out at http://foco.fae.ufmg.br/zerokid/input.pl?hello+world
Mistakes being common does not make them better.
Anyway, what Alan was mainly commenting on
was using CGI.pm, but not using it's header
printing routine, but instead substituting
your own hand-rolled, bad one.
This is *exactly* why people are urged to use
the standard modules whenever possible and
*not* hand-rolling their own code. People make
mistakes.
--
Regards, Helgi Briem
helgi AT decode DOT is
A: Top posting
Q: What is the most irritating thing on Usenet?
- "Gordon" on apihna
------------------------------
Date: Thu, 3 Oct 2002 09:31:37 -0300
From: Nuba <nuba@dcc.ufmg.br>
Subject: Re: script.pl?parameter - can anyone help me figure this out?
Message-Id: <Pine.GSO.4.21.0210030912010.15938-100000@turmalina.dcc.ufmg.br>
On Thu, 3 Oct 2002, Helgi Briem wrote:
> Mistakes being common does not make them better.
>
> Anyway, what Alan was mainly commenting on
> was using CGI.pm, but not using it's header
> printing routine, but instead substituting
> your own hand-rolled, bad one.
>
> This is *exactly* why people are urged to use
> the standard modules whenever possible and
> *not* hand-rolling their own code. People make
> mistakes.
Hello Helgi
You people should consider then pointing these mistakes in a more
newbie-friendly way, like you did. Alan's post have no hint about
this 'send header' routine of the CGI module, wich you had wrote about now.
I also noticed that, because of some cut-n-paste edition, my reply
to Alan is giving the idea that I didn't care if it is malformed but it
works. That's completely wrong. I DO CARE, but I were surprised to find
the script was working when called thru a webbrowser. That's the reason
I've posted it's URL here.
I'll dig more on this CGI stuff and be more carefull to check my posts
with a greater accuracy from now on. But I get somewhat surprised of how
noone found the way I solved the script.pl?parameter interesting or worth
a comment. After all, that's the main point of the thread - or am I
missing something ?
All good things,
Nuba
------------------------------
Date: Thu, 03 Oct 2002 12:58:33 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Source-filename from diamond-operator
Message-Id: <slrnapoe7c.6ft.tadmc@magna.augustmail.com>
joe mc cool <joe@benburb.demon.co.uk> wrote:
> "Newbie" <mike_constant@yahoo.com> writes:
>
>> >Question: How can I get the name of the sourcefile into a variable
>> > $source ?
>> my $source = $ARGV[0];
> Surely that is not really what he wants.
>
> Rather:
> print "source filename = $0";
I'm pretty sure that that is also not what he wants :-)
my $source = $ARGV; # $ARGV contains the name of the file that
# the diamond operator is currently processing
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 03 Oct 2002 13:48:54 +0300
From: "Teh (tî'pô)" <teh@mindless.com>
Subject: Re: Splice function with arrays
Message-Id: <2v7opukokktvpdku88t59m8lsultjhno8v@4ax.com>
John W. Krahn bravely attempted to attach 48 electrodes of knowledge
to the nipples of comp.lang.perl.misc by saying:
>patric wrote:
>>
>> Say I wanted to flag a particular value in array ( like "5" in my
>> example). I find it and remove it via the splice function. Why does
>> the for loop not catch the value again when the loop repeats? Any
>> comments would be appreciated.
>>
>> @array = (1,2,3,4,5,5,6,7,8,9,10);
>>
>> for ($i = 0;$i <= $#array; $i++){
>> if ($array[$i] == 5){
>> splice(@array,$i,1);
>> }
>> }
>>
>> print "\n@array\n";
>>
>> results in:
>> BEFORE SPLICE 1 2 3 4 5 5 6 7 8 9 10
>> AFTER SPLICE 1 2 3 4 5 6 7 8 9 10
>
>
>As well as Jeff's fine explanation and example there are two other ways
>to do it
>
># use redo
>for ( my $i = 0; $i <= $#array; $i++ ) {
> if ( $array[$i] == 5 ) {
> splice @array, $i, 1;
> redo;
> }
>}
>
># start at the other end of the array
>for ( my $i = $#array; $i >= 0; $i-- ) {
> if ( $array[$i] == 5 ) {
> splice @array, $i, 1;
> }
>}
Or decrement $i (has the added bonus of being less readable) ;o)
for ($i = 0;$i < @array; ++$i){
if ($array[$i] == 5){
splice(@array,$i--,1);
} # ^
}
------------------------------
Date: Thu, 03 Oct 2002 11:02:55 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: Splice function with arrays
Message-Id: <un8opu0ohvkmvd85bmchfuppusrffh3fcj@4ax.com>
patric wrote:
>@array = (1,2,3,4,5,5,6,7,8,9,10);
>
>for ($i = 0;$i <= $#array; $i++){
> if ($array[$i] == 5){
> splice(@array,$i,1);
> }
>}
In case you do a splice, everything after that shifts down.
Either go backwards through the array, or increment the index only if no
splice() was done.
for (my $i = $#array; $i>= 0; $i--){
if ($array[$i] == 5){
splice(@array,$i,1);
}
}
or
for (my $i = 0;$i <= $#array;){
if ($array[$i] == 5){
splice(@array,$i,1);
} else {
$i++;
}
}
Or, simply use grep(), that way avoiding this whole mess:
@array = grep { $_ != 5 } @array;
--
Bart.
------------------------------
Date: Thu, 03 Oct 2002 12:58:33 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: String substitution of 3+ digit numbers only?
Message-Id: <slrnapof8g.6ft.tadmc@magna.augustmail.com>
Bernard El-Hagin <bernard.el-hagin@DODGE_THISlido-tech.net> wrote:
> In article <3d9b38f4$0$11471$afc38c87@auth.de.news.easynet.net>, Janek
> Schleicher wrote:
>> Stan Ng wrote at Wed, 02 Oct 2002 14:49:41 +0200:
>>
>>> I need to do a string replacement for numbers with 3 or more digits:
>>>
>>> "Message 345245: Please give 27 dollars to Alice345 at 12:20"
>>>
>>> to become
>>>
>>> "Message 3 4 5 2 4 5: Please give 27 dollars to Alice 3 4 5 at 12:20"
^^^ ^^^
No space added before the 1st sequence, space added before 2nd sequence.
Is that a mistake in the example?
If not, then how do you determine when to put in the extra space?
>> Here's yet another solution that has the advantage of being
>> shorter than the other two ones :-)
>>
>> s/(\d{3,})/$_=$1;s#(?=.)# #g;$_/ge;
>>
>> It also has the disadvantage of being very cryptic and
>> to overwrite the global variable $_.
>
>
> That second disadvantage is easily fixed:
>
>
> s/(\d{3,})/local $_=$1;s#(?=.)# #g;$_/ge;
>
>
> It's still cryptic, though. And ugly, I might add. ;)
The first disadvantage can be worked on too:
s{ (\d{3,}) }
{ local $_ = $1;
s/(?=.)/ /g;
$_;
}gxe;
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 3 Oct 2002 11:40:17 +0000 (UTC)
From: "ee ee" <ee@ee.ee>
Subject: Trouble getting a status back from SMTP
Message-Id: <anhaav$sgi$1@paris.btinternet.com>
I have a small program which sends mail via SMTP. It works fine most of the
time, but when it doesn't I can't trap the error message from the host. I
do the usual check to ensure that the SMTP connection has been opened ok,
but other than setting debug on and watching it interactively I can't see if
it has worked. How do I trap the "250 ok" reply when a mail has been
successfully sent or the "550" code when it fails. For example (only a the
relevant bit of code):
foreach (@DATA) {
$smtp->datasend("$_");
}
$smtp->datasend("\n");
$smtp->dataend();
print "$smtp\n";
$smtp->quit;
Gives the result
Net::SMTP=GLOB(0x1d72760)
Now i'm probably being a little daft and completly missing the plot, but I
would appreciate any help on this matter.
------------------------------
Date: Thu, 3 Oct 2002 11:37:26 +0000 (UTC)
From: "Adam Knowles" <adam@connectpoint.co.uk>
Subject: Re: Two email things in Perl
Message-Id: <anha5m$brl$1@knossos.btinternet.com>
Malte,
That's fine for some uses, but not this one. One of the uses of this will be
verifying the email address for the purposes of sending a one-off email i.e.
something like formmail.pl (usin perl mongers one not matt wright's!). So I
may as well send the message itself as send a 'is this email valid, please
respond' message first.
Speaking of which, why does the improved formmail.pl and every other
emaily-sendy perl thing I've seen never bother with this kind of email
verfication?
If anyone's interested, while researching this I found a commercial Java
bean that describes well what I'm trying to achieve in Perl:
http://www.jscape.com/emailinspector/index.html
There's even a pretty flow-chart diagram.
Thanks.
Adam Knowles
"Malte Ubl" <ubl@schaffhausen.de> wrote in message
news:anepdb$ahl$1@news.dtag.de...
> Adam Knowles wrote:
> > Hi,
> >
> > I need to achieve two different things in Perl. I'm not a great
> > Perlmonger but I've dabbled enough to know what's possible with the
> > help of somebody that knows a bit more :)
> >
> > First thing is this. Most email-valid functions go only as far as
> > checking the syntax. Is there a snippet out there that could use some
> > basic POP functions, to verify that the mailbox exists? i.e. Go so
> > far as asking the POP server: "Would you accept mail addressed to
> > this?", without actually sending an email.
>
> The only satisfactory way is to actually send an email containing some
> kind of session id and require the user to either click a link or reply
> to the email.
>
> bye,
> ->malte
>
------------------------------
Date: 03 Oct 2002 07:25:05 -0500
From: Aaron Baugher <abaugher@esc.pike.il.us>
Subject: Re: using Net::SMTP, server reports, "Software caused connection abort"
Message-Id: <861y77yaji.fsf@haruchai.esc.pike.il.us>
coder_1024@hotmail.com (coder_1024) writes:
> > > if ($smtp == null)
> Good point. I should change that. It does work though, but you're
> right, its probably not the best style in the Perl world.
In this case, it ends up doing what you want, but it doesn't 'work.'
When you do a numeric comparison with things that aren't numeric, perl
turns them all into zeroes first. So if $smtp is a valid reference,
it gets turned into zero, and null, which perl decides you meant was a
string, is also zero. So the == says 'yes.' The only way your if()
would fail would be if $smtp had a numeric non-zero value. See:
$ perl
for ( 'stuff', undef, 0, 1 ){
if( $_ == null ){
print "true\n";
} else {
print "false\n";
}
}
^D
true
true
true
false
$
So if your Net::SMTP constructor fails, and $smtp ends up undefined,
your clause above will still be true.
> I prefer printf because it doesn't go adding a \n to my string.
Neither does print.
> Actually, I have gotten it working both with and without the headers.
> The headers actually aren't necessary. I did find that if I wanted to
> provide a non-empty subject, that I did have to provide the headers.
Right. The headers are only necessary if you want them to show up in
the message itself. They aren't necessary to get it to deliver.
--
Aaron
abaugher@esc.pike.il.us
------------------------------
Date: Thu, 3 Oct 2002 17:47:16 +0400
From: "Paul Dortman" <paul@pco.iis.nsk.su>
Subject: What is the best way for file/stream IO in Perl?
Message-Id: <anh79e$gai$1@news.itfs.nsk.su>
Dear friends,
I have a questions for Perl's guru.
What is the difference amoung IO::File, IO::Handle, FileHandle modules and
standard operators and filehandles to access a file?
What is the best way to access file and to deal with file?
Where can I find more information on IO in Perl?
With kind regards,
Paul Dortman
------------------------------
Date: Thu, 3 Oct 2002 17:50:48 +0400
From: "Paul Dortman" <paul@pco.iis.nsk.su>
Subject: What is the best way for file/stream IO in Perl?
Message-Id: <anh7g2$gqi$1@news.itfs.nsk.su>
Dear friends,
I have a questions for Perl's guru.
What is the difference amoung IO::File, IO::Handle, FileHandle modules and
standard operators and filehandles to access a file?
What is the best way to access file and to deal with file?
Where can I find more information on IO in Perl?
With kind regards,
Paul Dortman
------------------------------
Date: Thu, 3 Oct 2002 17:57:21 +0400
From: "Paul Dortman" <paul@pco.iis.nsk.su>
Subject: What is the best way for file/stream IO in Perl?
Message-Id: <anh7sb$hmc$1@news.itfs.nsk.su>
Dear friends,
I have a questions for Perl's guru.
What is the difference amoung IO::File, IO::Handle, FileHandle modules and
standard operators and filehandles to access a file?
What is the best way to access file and to deal with file?
Where can I find more information on IO in Perl?
With kind regards,
Paul Dortman
------------------------------
Date: Thu, 3 Oct 2002 17:58:14 +0400
From: "Paul Dortman" <paul@pco.iis.nsk.su>
Subject: What is the best way for file/stream IO in Perl?
Message-Id: <anh7tv$hqa$1@news.itfs.nsk.su>
Dear friends,
I have a questions for Perl's guru.
What is the difference amoung IO::File, IO::Handle, FileHandle modules and
standard operators and filehandles to access a file?
What is the best way to access file and to deal with file?
Where can I find more information on IO in Perl?
With kind regards,
Paul Dortman
------------------------------
Date: Thu, 3 Oct 2002 17:58:26 +0400
From: "Paul Dortman" <paul@pco.iis.nsk.su>
Subject: What is the best way for file/stream IO in Perl?
Message-Id: <anh7ub$hr6$1@news.itfs.nsk.su>
Dear friends,
I have a questions for Perl's guru.
What is the difference amoung IO::File, IO::Handle, FileHandle modules and
standard operators and filehandles to access a file?
What is the best way to access file and to deal with file?
Where can I find more information on IO in Perl?
With kind regards,
Paul Dortman
------------------------------
Date: Thu, 3 Oct 2002 17:59:01 +0400
From: "Paul Dortman" <paul@pco.iis.nsk.su>
Subject: What is the best way for file/stream IO in Perl?
Message-Id: <anh7vf$hts$1@news.itfs.nsk.su>
Dear friends,
I have a questions for Perl's guru.
What is the difference amoung IO::File, IO::Handle, FileHandle modules and
standard operators and filehandles to access a file?
What is the best way to access file and to deal with file?
Where can I find more information on IO in Perl?
With kind regards,
Paul Dortman
------------------------------
Date: Thu, 3 Oct 2002 18:00:29 +0400
From: "Paul Dortman" <paul@pco.iis.nsk.su>
Subject: What is the best way for file/stream IO in Perl?
Message-Id: <anh827$i4e$1@news.itfs.nsk.su>
Dear friends,
I have a questions for Perl's guru.
What is the difference amoung IO::File, IO::Handle, FileHandle modules and
standard operators and filehandles to access a file?
What is the best way to access file and to deal with file?
Where can I find more information on IO in Perl?
With kind regards,
Paul Dortman
------------------------------
Date: Thu, 3 Oct 2002 11:02:44 +0000 (UTC)
From: Bernard El-Hagin <bernard.el-hagin@DODGE_THISlido-tech.net>
Subject: Re: What is the best way for file/stream IO in Perl?
Message-Id: <slrnapo8rm.142.bernard.el-hagin@gdndev25.lido-tech>
In article <anh7vf$hts$1@news.itfs.nsk.su>, Paul Dortman wrote:
> Dear friends,
>
> I have a questions for Perl's guru.
[...]
Dude, you need to chill with the posting. That's six copies of the
same post I've seen posted by you already. You're probably not doing
it on purpose so find the problem and fix it.
Cheers,
Bernard
--
echo 42|perl -pe '$#="Just another Perl hacker,"'
------------------------------
Date: Thu, 03 Oct 2002 13:44:09 +0300
From: "Teh (tî'pô)" <teh@mindless.com>
Subject: Re: || versus OR
Message-Id: <cm7opus2a5h2svvl87efbugnc0e8efns77@4ax.com>
Jürgen Exner bravely attempted to attach 18 electrodes of knowledge to
the nipples of comp.lang.perl.misc by saying:
>Bob X wrote:
>> Is there any real difference between the two operators? The only
>> thing I usually see is a statement such as "...the lower precedence
>> OR". Is there a case where it would matter or is it purely a style
>> choice?
>
>Oh, it does matter quite a bit. Typical example (square brackets added to
>illustrate precedences):
>
> [open F, 'foo.bar'] or [die "Can't open foo.bar because $!\n"];
>versus
> open F, ['foo.bar' || die "Can't open foo.bar because $!\n"];
>
>Which one do you want?
I have an example that is probably less common but I managed to get
bitten by it.
print (( ! 1 || 1 )? "true" : "false"),"\n"; # true
print (( ! 1 or 1 )? "true" : "false"),"\n"; # true
print (( not 1 || 1 )? "true" : "false"),"\n"; # false (ouch)
print (( not 1 or 1 )? "true" : "false"),"\n"; # true
------------------------------
Date: Thu, 03 Oct 2002 11:07:26 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: || versus OR
Message-Id: <t49opu8lbssgje9q5impmmqc7j5k0ggtou@4ax.com>
Bob X wrote:
>Is there any real difference between the two operators? The only thing I
>usually see is a statement such as "...the lower precedence OR". Is there a
>case where it would matter or is it purely a style choice?
Precedence, which means that one of the two lileky will save you from
typing a bunch of parens to make it behave as you wish. For the rest,
it's jut a choice of style.
--
Bart.
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 3908
***************************************