[19205] in Perl-Users-Digest
Perl-Users Digest, Issue: 1400 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jul 29 14:05:32 2001
Date: Sun, 29 Jul 2001 11:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <996429909-v10-i1400@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sun, 29 Jul 2001 Volume: 10 Number: 1400
Today's topics:
Accessing items in a 'HList' <Pcmann1@btinternet.com>
Re: Accessing items in a 'HList' <bkennedy99@Home.com>
CGI-BIN doesnt execute scripts <springb2k@yahoo.com>
Re: compare two time blocks for scheduling <andras@mortgagestats.com>
Re: compare two time blocks for scheduling <mbudash@sonic.net>
Re: Correction to Re: I'm doing a script to append text <godzilla@stomp.stomp.tokyo>
counting <jtjohnston@courrier.usherb.ca>
Re: counting <mbudash@sonic.net>
Re: counting <jeff@vpservices.com>
Re: counting <AHALL5@nc.rr.com>
Re: counting <AHALL5@nc.rr.com>
Re: counting <jeff@vpservices.com>
Re: FAQ: How do I capitalize all the words on one line? <andras@mortgagestats.com>
Re: How to sort old mailboxes <Tassilo.Parseval@post.rwth-aachen.de>
Re: I'm doing a script to append text to a file but do <godzilla@stomp.stomp.tokyo>
Re: I'm doing a script to append text to a file but do <jeff@vpservices.com>
Re: Mail::Internet not the right choice for me ? <ilya@martynov.org>
Re: Mail::Internet not the right choice for me ? <tinamue@zedat.fu-berlin.de>
Re: Stripping extention from a filename in a string (Mario Rizzuti)
Re: Stripping extention from a filename in a string <godzilla@stomp.stomp.tokyo>
Re: Wanted: Efficient Idea <iltzu@sci.invalid>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 29 Jul 2001 16:31:39 +0100
From: "Peter Mann" <Pcmann1@btinternet.com>
Subject: Accessing items in a 'HList'
Message-Id: <9k1a82$6hj$1@neptunium.btinternet.com>
Please could anyone tell me how to return a selected element from a HList
box. I have spent days trying to find tutorials but with no success! The
code i currently have is:-
my $uri = $hlist->selectionGet;
but this returns the index number of the position of the selected item. I
need to access the actual string located at this position.
Any help would be much appreciated. Thanks in advance! - Pete
------------------------------
Date: Sun, 29 Jul 2001 17:11:35 GMT
From: "Ben Kennedy" <bkennedy99@Home.com>
Subject: Re: Accessing items in a 'HList'
Message-Id: <btX87.48659$EP6.10688886@news1.rdc2.pa.home.com>
"Peter Mann" <Pcmann1@btinternet.com> wrote in message
news:9k1a82$6hj$1@neptunium.btinternet.com...
> Please could anyone tell me how to return a selected element from a HList
> box. I have spent days trying to find tutorials but with no success! The
> code i currently have is:-
>
> my $uri = $hlist->selectionGet;
>
> but this returns the index number of the position of the selected item. I
> need to access the actual string located at this position.
>
> Any help would be much appreciated. Thanks in advance! - Pete
First grab the anchor, which should be the node that the person last clicked
my $anchor = $hlist->info('anchor');
Then use the anchor (eg A.B.C) to get the text:
my $text = $hlist->entrycget($anchor, "-text");
I think this second list is right, often I just maintain my own hash with
nodes as keys and a hash of node data (including the node text) as values,
Hope this helps --
--Ben Kennedy
------------------------------
Date: Sun, 29 Jul 2001 09:53:08 -0700
From: "Mr. Ed" <springb2k@yahoo.com>
Subject: CGI-BIN doesnt execute scripts
Message-Id: <tm8fkurnbter12@corp.supernews.com>
I have an issue with a project manager that centers around if his Unix
server is configured right. I have scripts in the cgi-bin that have all the
correct chmod permissions. That scripts do not execute. I cannot even get an
html webpage to show up (the error sez Page Not Found) is it sits in that
cgi-bin. I made another directory underneath a directory outside the
cgi-bin, and in that new directory that I named cgi-bin ( after giving the
directory and files the right permissions) i tried to get scripts to
execute, but in MSExplorer, the browser prompted me to download the file,
whle in netscape, it displayed the actual script (yikes!) but no execution.
Is this an issue that the server admin doesnot have perl installed the
correct way, or set up the scripts directory correctly?
Thanks
------------------------------
Date: Sun, 29 Jul 2001 12:55:40 -0400
From: Andras Malatinszky <andras@mortgagestats.com>
Subject: Re: compare two time blocks for scheduling
Message-Id: <3B64400B.8C9CF9C@mortgagestats.com>
Jag Man wrote:
> How can I compare two time blocks for any conflicts.
>
> Example:
> First meeting: Sat, July 28 2001 9:00 AM to Sat, July 28 2001 11:00
> Second meeting: Sat, July 28 2001 13:00 AM to Sat, July 28 2001 15:00
>
> Now if some one trys to snick in a meeting between 10:00 AM to 12:00 AM -
> There needs to be a warning/error message generated.
You mean such as "Get a life, man, spend your weekends with your kids instead of
meetings?"
>
>
> DATE::Manip can compare one timestamp at a time, but how can it be done with
> comparing hours?
>
> TIA!
> Jag Man
Since you know how to compare time stamps, try this:
Start with a schedule that you know to be conflict-free. (You can always do
this: a schedule with only one meeting is conflict-free.) Next, throw all your
start and end times into an array @schedule. Now when you have a new meeting
(represented by a $start_time and $endtime pair) all you have to do is see that
the number $before_start of the times in @schedule that are before $start_time
is the same as the number $before_end of the times in @schedule that are
before $end_time (that is, no scheduled meeting ends or starts while the
proposed meeting is in progress) and that $before_start is even (which ensures
that your proposed meeting is not nested inside the time block already allotted
for another meeting).
------------------------------
Date: Sun, 29 Jul 2001 17:45:02 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: Re: compare two time blocks for scheduling
Message-Id: <mbudash-DCC3D3.10385729072001@news.sonic.net>
In article <GcV87.25252$oh1.8055567@news2.rdc2.tx.home.com>, "Jag Man"
<jagman98@home.com> wrote:
> How can I compare two time blocks for any conflicts.
>
> Example:
> First meeting: Sat, July 28 2001 9:00 AM to Sat, July 28 2001 11:00
> Second meeting: Sat, July 28 2001 13:00 AM to Sat, July 28 2001 15:00
>
> Now if some one trys to snick in a meeting between 10:00 AM to 12:00 AM -
> There needs to be a warning/error message generated.
>
> DATE::Manip can compare one timestamp at a time, but how can it be done
> with
> comparing hours?
>
i had to do this exact thing when writing a payroll system for the city
of napa, california.
assuming:
- start and end time are stored in yyyymmddhhmm format where hh is
military (24-hour)
- any existing blocks are already valid (i.e., end time is greater than
start time)
here's the idea to validate block2 against block1:
if (start2 < start1) {
if (end2 > start1) {
# overlap!
}
}
elsif (start2 < end1) {
# overlap!
}
hth-
--
Michael Budash ~~~~~~~~~~ mbudash@sonic.net
------------------------------
Date: Sun, 29 Jul 2001 09:49:00 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Correction to Re: I'm doing a script to append text to a file but do not know how to deal with duplicate text
Message-Id: <3B643E7C.E0B64456@stomp.stomp.tokyo>
Lawrence AKA The CLPM Troll wrote:
> Godzilla! wrote:
> <snipped message>
(snipped)
> Apologies and a correction to my last hasty reply.
> I had a couple of stray characters in the newlist.txt file and after
> removing these the contents of the files after testing the script now
> read
You experiencing difficulties figuring out how to correctly
break my script?
How ingenious of you. Change your original parameters to be
sure my script malfunctions. Bet that gets your colorful
beanie propeller spinning like crazy!
You are grasping at straws to recover from your embarrassment.
However, you have consistently made a fool of yourself in the
past, are doing so now and, will continue to do so into the future.
*laughs*
Godzilla!
------------------------------
Date: Sun, 29 Jul 2001 16:45:14 GMT
From: jtjohnston <jtjohnston@courrier.usherb.ca>
Subject: counting
Message-Id: <3B643E42.600245B9@courrier.usherb.ca>
I have a database text file:
1¶field1¶field2¶field3¶field4¶field5¶field6¶field7¶field8¶field9¶field10¶
2¶field1¶field2¶field3¶field4¶field5¶field6¶john¶field8¶field9¶field10¶
3¶field1¶field2¶field3¶field4¶field5¶field6¶mary¶field8¶field9¶field10¶
4¶field1¶field2¶field3¶field4¶field5¶field6¶dave¶field8¶field9¶field10¶
I want to parse field7, separate and count occurences of all its
elements and then output to a text file.
I have about 2600 records. I could parse and count the number of times
"john" occurs. But in this case, I have no idea what is contained in
field 7.
john¶37¶
dave¶25¶
susan¶34¶
mary¶7¶
Thanks,
john
(An email post & reply would be helpful. :)
------------------------------
Date: Sun, 29 Jul 2001 17:08:32 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: Re: counting
Message-Id: <mbudash-56B6D6.10022729072001@news.sonic.net>
In article <3B643E42.600245B9@courrier.usherb.ca>, jtjohnston
<jtjohnston@courrier.usherb.ca> wrote:
> I have a database text file:
>
> 1?field1?field2?field3?field4?field5?field6?field7?field8?field9?field10?
> 2?field1?field2?field3?field4?field5?field6?john?field8?field9?field10?
> 3?field1?field2?field3?field4?field5?field6?mary?field8?field9?field10?
> 4?field1?field2?field3?field4?field5?field6?dave?field8?field9?field10?
>
> I want to parse field7, separate and count occurences of all its
> elements and then output to a text file.
> I have about 2600 records. I could parse and count the number of times
> "john" occurs. But in this case, I have no idea what is contained in
> field 7.
>
> john?37?
> dave?25?
> susan?34?
> mary?7?
>
here's the essential part (tested):
open (THEFILE, $file) or die ("Can't open $file: $!");
while (<THEFILE>) {
$count{(split(/\?/))[7]}++;
}
foreach (sort keys %count) {
print "$_?$count{$_}?\n";
}
tested using this data:
1?field1?field2?field3?field4?field5?field6?field7?field8?field9?field10?
2?field1?field2?field3?field4?field5?field6?john?field8?field9?field10?
3?field1?field2?field3?field4?field5?field6?mary?field8?field9?field10?
4?field1?field2?field3?field4?field5?field6?dave?field8?field9?field10?
5?field1?field2?field3?field4?field5?field6?john?field8?field9?field10?
6?field1?field2?field3?field4?field5?field6?john?field8?field9?field10?
7?field1?field2?field3?field4?field5?field6?dave?field8?field9?field10?
results:
dave?2?
field7?1?
john?3?
mary?1?
hth-
--
Michael Budash ~~~~~~~~~~ mbudash@sonic.net
------------------------------
Date: Sun, 29 Jul 2001 10:18:06 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: counting
Message-Id: <3B64454E.6BCE3873@vpservices.com>
jtjohnston wrote:
>
> I have a database text file:
>
> 1¶field1¶field2¶field3¶field4¶field5¶field6¶field7¶field8¶field9¶field10¶
>
> 2¶field1¶field2¶field3¶field4¶field5¶field6¶john¶field8¶field9¶field10¶
> 3¶field1¶field2¶field3¶field4¶field5¶field6¶mary¶field8¶field9¶field10¶
> 4¶field1¶field2¶field3¶field4¶field5¶field6¶dave¶field8¶field9¶field10¶
>
> I want to parse field7, separate and count occurences of all its
> elements and then output to a text file.
> I have about 2600 records. I could parse and count the number of times
> "john" occurs. But in this case, I have no idea what is contained in
> field 7.
use AnyData;
my $old_flags = {
col_names=>'c0,c1,c2,c3,c4,c5,c6,c7,c8,c9,c10',
sep_char => '¶',
};
my $new_flags = {col_names=>'c7', sep_char=>'¶'};
my $t1 = adTie('CSV',$myFile,'r',$old_flags);
my $t2 = adTie('CSV',$myFile_new,'o',$new_flags);
while (my $row = each %$t1) {
my $val = $row->{c7} or next;
$t2->{ $val } = {c7=>$val};
}
__END__
The file $myFile_new now contains a single column with all the values
from column 7 in the original file. If you want to find out how many
there are: my $count = adRows($t2);
--
Jeff
>
> john¶37¶
> dave¶25¶
> susan¶34¶
> mary¶7¶
>
> Thanks,
>
> john
>
> (An email post & reply would be helpful. :)
------------------------------
Date: Sun, 29 Jul 2001 17:25:13 GMT
From: "Antoine Hall" <AHALL5@nc.rr.com>
Subject: Re: counting
Message-Id: <ZFX87.27298$J37.6481496@typhoon.southeast.rr.com>
Just curious, why don't you change those paragraph marks to '::' or tab
delimited...just a suggestion, but anyway....A quick and dirty way is to do
a split on the line at paragraph marks or whatever you use to separate the
fields.
Do something in a while or for loop like:
my @record = split(/¶/, $line); //$line being the current record being
read.
then referr to field seven by $record[6] and do comparisons as you see
fit.....
"jtjohnston" <jtjohnston@courrier.usherb.ca> wrote in message
news:3B643E42.600245B9@courrier.usherb.ca...
> I have a database text file:
>
> 1¶field1¶field2¶field3¶field4¶field5¶field6¶field7¶field8¶field9¶field10¶
>
> 2¶field1¶field2¶field3¶field4¶field5¶field6¶john¶field8¶field9¶field10¶
> 3¶field1¶field2¶field3¶field4¶field5¶field6¶mary¶field8¶field9¶field10¶
> 4¶field1¶field2¶field3¶field4¶field5¶field6¶dave¶field8¶field9¶field10¶
>
> I want to parse field7, separate and count occurences of all its
> elements and then output to a text file.
> I have about 2600 records. I could parse and count the number of times
> "john" occurs. But in this case, I have no idea what is contained in
> field 7.
>
> john¶37¶
> dave¶25¶
> susan¶34¶
> mary¶7¶
>
> Thanks,
>
> john
>
> (An email post & reply would be helpful. :)
>
------------------------------
Date: Sun, 29 Jul 2001 17:25:13 GMT
From: "Antoine Hall" <AHALL5@nc.rr.com>
Subject: Re: counting
Message-Id: <ZFX87.27299$J37.6480664@typhoon.southeast.rr.com>
Just curious, why don't you change those paragraph marks to '::' or tab
delimited...just a suggestion, but anyway....A quick and dirty way is to do
a split on the line at paragraph marks or whatever you use to separate the
fields.
Do something in a while or for loop like:
my @record = split(/¶/, $line); //$line being the current record being
read.
then referr to field seven by $record[7] and do comparisons as you see
fit.....
"jtjohnston" <jtjohnston@courrier.usherb.ca> wrote in message
news:3B643E42.600245B9@courrier.usherb.ca...
> I have a database text file:
>
> 1¶field1¶field2¶field3¶field4¶field5¶field6¶field7¶field8¶field9¶field10¶
>
> 2¶field1¶field2¶field3¶field4¶field5¶field6¶john¶field8¶field9¶field10¶
> 3¶field1¶field2¶field3¶field4¶field5¶field6¶mary¶field8¶field9¶field10¶
> 4¶field1¶field2¶field3¶field4¶field5¶field6¶dave¶field8¶field9¶field10¶
>
> I want to parse field7, separate and count occurences of all its
> elements and then output to a text file.
> I have about 2600 records. I could parse and count the number of times
> "john" occurs. But in this case, I have no idea what is contained in
> field 7.
>
> john¶37¶
> dave¶25¶
> susan¶34¶
> mary¶7¶
>
> Thanks,
>
> john
>
> (An email post & reply would be helpful. :)
>
------------------------------
Date: Sun, 29 Jul 2001 10:26:37 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: counting
Message-Id: <3B64474D.63EC9B20@vpservices.com>
Jeff Zucker wrote:
>
And if you want to only get *unique* occurrences of field7, add this
line inside the while loop, after the my line:
next if $t2->{$val};
--
Jeff
------------------------------
Date: Sun, 29 Jul 2001 12:12:54 -0400
From: Andras Malatinszky <andras@mortgagestats.com>
Subject: Re: FAQ: How do I capitalize all the words on one line?
Message-Id: <3B643606.9E1D9C4A@mortgagestats.com>
PerlFAQ Server wrote:
[snip]
> How do I capitalize all the words on one line?
>
[snip]
>
> $string =~ /([\w']+)/\u\L$1/g;
Don't we need an 's' after the binding operator here? Like this:
$string =~ s/([\w']+)/\u\L$1/g;
> This space intentionally left blank
------------------------------
Date: Sun, 29 Jul 2001 19:44:32 +0200
From: Tassilo von Parseval <Tassilo.Parseval@post.rwth-aachen.de>
Subject: Re: How to sort old mailboxes
Message-Id: <3B644B80.3090705@post.rwth-aachen.de>
Marco F wrote:
>Hello everybody.
>
>I have already looked around in CPAN and newsgroup archives without
>success, as almost all scripts and documentation available are there
>to send email or manage incoming message, not to put order in an
>existing (completely messed up) collection of mailboxes.
>
[...]
>
>
>Is there any script that, with or without using the standard Mail modules
>from CPAN:
>
[list of all tasks snipped]
As Tony Curtis said, go for Mail::Box. It automatically filters out
duplicates, so there is no work left for you. As for grepping mails from
a mailbox, you'll find a little script by me called takemail inside the
package. If you wait a few more days, Mark Overmeer (the author of the
module) will have returned from the O'Reilly conference in San Diego and
will (hopefully) have added my new version of takemail.
Greetings,
Tassilo
--
Don't look back, the lemmings are gaining on you.
------------------------------
Date: Sun, 29 Jul 2001 10:23:30 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: I'm doing a script to append text to a file but do not know how to deal with duplicate text
Message-Id: <3B644692.A53AFA54@stomp.stomp.tokyo>
Michael Budash AKA The CLPM Troll wrote:
> Godzilla! wrote:
> > Michael Budash AKA The CLPM Troll wrote:
> > > lawrence AKA The CLPM Troll wrote:
> > (snippage)
(snipped)
> > It is prudent to test code before posting. Performing tests
> > of your code will assist you in avoiding this embarrassment
> > of posting code which does not work.
> believe it or not, i'm not embarrassed.
Is this a Ripley's Believe It Or Else? Not a chance
I believe you. Your own posts under a fake name
are clear evidence you are humilated to a point
of being egotistically desperate, foolishly so.
You will do anything, literally anything, to
prove me wrong, including telling lies, which
you consistently do.
Your fragile masculine ego is both your albatross
and, Fool's Bane.
> anything i post here is an example to the o.p., and that's all.
Bad code makes for excellent examples.
> if it doesn't work i'm under no
> obligation at all, except to at least be around for any follow-ups.
How lame!
> my script did indeed have a bug - a single bug. the following line:
Yours is not a bug. Yours is bad code which your smug egotistical
arrogance prompted you to post without testing, much to your
red faced embarrassment. Bet that slowed down your beanie propeller!
Even fixed, your code is a monster, a slow, ponderous, inefficient
monster which could not catch a snail on ice.
> your test data (spec., yeslist.txt and nolist.txt) does not reflect
> the o.p.'s requirements, therefore your code will not work. his code
> shows this as the format of both:
> name,email,
I was quite confident you would respond in this fashion!
You make for such a piss poor troll. However, you make
for a great mark! Never try to con, a con.
Your original troll parameters do not state this.
It is exceptionally ignorant to extrapolate parameters from
posted code. Why this is stupid is simple. Code posted under
circumstances of an author asking for help, indicates there
are problems. This posted code may or may not be correct,
may or may not actually be what an author wants or contains
problems unnoticed by an author. Extrapolating parameters
from code is to introduce the author's original problems.
Very unscientific! However, you are no Rocket Scientist.
Hey! You simply screwed up as usual. You are not capable of
posting well worded coherent articles, albeit troll articles.
I kept this sub-routine on my Perl back burner waiting for
you to post this article, as well anticipated by me.
sub Write
{
open (YESLIST, ">>yeslist.txt");
open (NOLIST, ">>nolist.txt");
for (@Newlist)
{
if (substr ($_, 0, 1) eq "y")
{
if (index ($yeslist, substr ($_, index ($_, ",") +1)) == -1)
{
$_ = substr ($_, index ($_, ",") +1);
print YESLIST $_;
}
}
else
{
if (index ($nolist, substr ($_, index ($_, ",") +1)) == -1)
{
$_ = substr ($_, index ($_, ",") +1);
print NOLIST $_;
}
}
}
close (YESLIST);
close (NOLIST);
}
So, you gonna spin your beanie propeller and go to work on
changing your original parameters again to be sure my code
breaks to satiate your unhealthy ego?
> i think the o.p. already did and yours didn't work either... oh, how
> embarrassing! good thing neither of us are being paid, eh?
Stomped Ego Mule Manure!
Perhaps you will think twice before again threatening me
with harassment email.
You just keep on trolling. When I take a fancy, I will highlight
what a fragile foolish egotistical boy you are, Frank.
Godzilla!
------------------------------
Date: Sun, 29 Jul 2001 09:58:12 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: I'm doing a script to append text to a file but do not know how to deal with duplicate text
Message-Id: <3B6440A4.47C80598@vpservices.com>
Michael Budash wrote:
>
> In article <3b6327c7.22658935@news.freeserve.net>,
> lawrence@f-deans.freeserve.co.uk (Lawrence) wrote:
>
> > I have a simple script I put together to solve a problem I had with my
> > mailing list addresses.
[Michael Budash's totally satisfactory code snipped]
Another option is to use the AnyData module which provides a
multi-dimensional tied hash interface to CSV, Fixed Length, XML, and
many other file formats. In this particular case, it does everything
Michael's code does and has these advantages over Michael's code: a) it
accomplishes the same thing in less than a third of the lines of code
(at least code that you would write) and with the additional benefits of
b) file locking (if your system supports flock) and of c) not ever
slurping any of the files en masse into arrays, rather looping through
the lines of the files via the tie mechanism and of d) working on other
CSV regardless of separators or eols or with XML or other formats and of
e) providing an easy upgrade path from tied hash to a DBI interface if
your app ever becomes more complex. It has the disadvantage of
requiring a module and of having a slight learning curve to figure out
the specialized tied hash.
This worked using the exact data you supplied for newlist.txt (including
the spaces around the commas and the empty fields and the duplicates)
and produced the appropriate yeslist.txt and nolist.txt files no matter
how many times it ran (i.e. it didn't add more to those files after the
first run):
use AnyData;
my $newflags = {col_names=>'status,name,email', trim=>1};
my $ynflags = {col_names=>'name,email', trim=>1};
my $newlist = adTie('CSV','newlist.txt','r',$newflags);
my $yeslist = adTie('CSV','yeslist.txt','u',$ynflags);
my $nolist = adTie('CSV','nolist.txt','u',$ynflags);
while (my $row = each %$newlist) {
my($status,$name,$email) = ( $row->{status},
$row->{name},
$row->{email},
);
my $search_flags = {name=>$name,email=>$email};
if ( defined $status and $status eq 'y' ) {
$yeslist->{$name} = {email=>$email}
if !scalar @{ $yeslist->{$search_flags} };
}
else {
$nolist->{$name} = {email=>$email}
if !scalar @{ $nolist->{$search_flags} };
}
}
__END__
You can then query or update any of the files with similar mechanisms,
or you could use the companion DBD::AnyData module (formerly called
DBD::RAM) and do all of the above with a DBI/SQL interface.
AnyData is available at http://search.cpan.org/search?dist=AnyData.
P.S. Take what I say with a grain of salt since I wrote the sucker and
am not unbiased :-)
--
Jeff
------------------------------
Date: 29 Jul 2001 19:10:10 +0400
From: Ilya Martynov <ilya@martynov.org>
Subject: Re: Mail::Internet not the right choice for me ?
Message-Id: <87ofq3g4a5.fsf@abra.ru>
TD> Hey,
TD> I've just spent several hours wondering about how i could possibly
TD> dissect an email with Mail::Internet so that it gives me just the
TD> MESSAGE w/o the headers. I do not find a function that gives me just
TD> the CONTENT of the email. It's no problem to retrieve Header fields...
TD> for e.g.:
TD> use Mail::Internet;
TD> my $message_obj = new Mail::Internet \*STDIN;
TD> my $m_from = $message_obj->get("From");
TD> ...but I do not have a clue how to get JUST the content of the email.
TD> Can anybody help me out ?
$message_obj->body
--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
| Ilya Martynov (http://martynov.org/) |
| GnuPG 1024D/323BDEE6 D7F7 561E 4C1D 8A15 8E80 E4AE BE1A 53EB 323B DEE6 |
| AGAVA Software Company (http://www.agava.com/) |
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
------------------------------
Date: 29 Jul 2001 15:15:10 GMT
From: Tina Mueller <tinamue@zedat.fu-berlin.de>
Subject: Re: Mail::Internet not the right choice for me ?
Message-Id: <9k199u$1v5v9$3@fu-berlin.de>
Toni Duago <tag@gmx.de> wrote:
> use Mail::Internet;
> my $message_obj = new Mail::Internet \*STDIN;
> my $m_from = $message_obj->get("From");
> ...but I do not have a clue how to get JUST the content of the email.
> Can anybody help me out ?
please do not post in different newsgroups, or if you think
you have to, crosspost and set a followup. you just got an
answer in the german newshroup. besides, what's wrong with the
method body()?
regards,
tina
--
http://www.tinita.de \ enter__| |__the___ _ _ ___
tina's moviedatabase \ / _` / _ \/ _ \ '_(_-< of
search & add comments \ \ _,_\ __/\ __/_| /__/ perception
please don't email unless offtopic or followup is set. thanks
------------------------------
Date: 29 Jul 2001 08:35:48 -0700
From: mariorizzuti@yahoo.com (Mario Rizzuti)
Subject: Re: Stripping extention from a filename in a string
Message-Id: <42f3ee2.0107290735.2687eb19@posting.google.com>
"Godzilla!" <godzilla@stomp.stomp.tokyo> wrote in message news:<3B61A9C4.CB1042C5@stomp.stomp.tokyo>...
> Yves Orton AKA The CLPM Troll wrote:
>
> > Jason LaPenta wrote:
>
> (snipped)
>
> > Response 3:
> > Godzilla! (godzilla@stomp.stomp.tokyo) wrote:
>
> > >substr ($filename, rindex ($filename, "."), 4, "");
>
> > This one is a terrible solution. If you insert the filename
> > "filename.text" into the filename list provided by godzilla you will
> > see the output (for this filename) is:'filenamet' which is definitely
> > wrong. DONT use this one.
>
>
> Yours is a very lame and very poorly veiled troll article.
>
Other than the extension length, which is actually nothing so
important (just change the number?) I see 2 behaviours that maybe
could be considered as wrong.
- if the string has not dots, it will not be returned "as is" (rindex
returns -1 on failure, so the last char will be cutted).
- if there are 2 or more dots, just the one more at right will be
cutted (rindex will match the first occurence starting from the
end).
Mario Rizzuti
------------------------------
Date: Sun, 29 Jul 2001 10:30:03 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Stripping extention from a filename in a string
Message-Id: <3B64481B.14EB5CDB@stomp.stomp.tokyo>
Mario Rizzuti AKA The CLPM Troll wrote:
> Godzilla! wrote:
> > Yves Orton AKA The CLPM Troll wrote:
> > > Jason LaPenta wrote:
> > (snipped)
(snipped)
> > Yours is a very lame and very poorly veiled troll article.
> Other than the extension length, which is actually nothing so
> important (just change the number?) I see 2 behaviours that maybe
> could be considered as wrong.
> - if the string has not dots, it will not be returned "as is" (rindex
> returns -1 on failure, so the last char will be cutted).
Spin your beanie propeller and cite an example of a valid
file extension which is not preceeded by a period.
> - if there are 2 or more dots, just the one more at right will be
> cutted (rindex will match the first occurence starting from the
> end).
Spin your beanie propeller again and cite an example of a
valid file extension preceeded by two periods.
Wait! Don't tell me. You have a perl program named:
..pl
* bemused *
Godzilla!
------------------------------
Date: 29 Jul 2001 15:45:27 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Wanted: Efficient Idea
Message-Id: <996419519.12455@itz.pp.sci.fi>
In article <elwood.996407424@news.agouros.de>, Konstantinos Agouros wrote:
>
>So I save outgoing http-requests in a hash that contains the remoteaddress
>and my sourceport so I can easyly look them up when I find such dropped packets
>in order to discard this logentry as 'not interesting'. If someone would start
>a portprobe from sourceport 80 I would still get them \:).
>My problem is, the hash is something like
>$a{'80 123.123.123.123 1234'}
>I need an efficient way to 'forget' these events after a reasonable time. So
You could just push the hash keys onto an array, and shift keys to
delete from the other end. That will let you keep N last keys.
Alternatively, attach a timestamp to each key in the array, so that you
can delete keys that are too old.
This looks a lot like the Tie::Cache module, except that you want to
refresh entries only when they're stored, not when fetched.
--
Ilmari Karonen -- http://www.sci.fi/~iltzu/
"Get real! This is a discussion group, not a helpdesk. You post something,
we discuss its implications. If the discussion happens to answer a question
you've asked, that's incidental." -- nobull in comp.lang.perl.misc
------------------------------
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 1400
***************************************