[19100] in Perl-Users-Digest
Perl-Users Digest, Issue: 1295 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 12 21:05:38 2001
Date: Thu, 12 Jul 2001 18: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: <994986308-v10-i1295@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 12 Jul 2001 Volume: 10 Number: 1295
Today's topics:
Re: Example needed for Win32::OLE and Excel <djberg96@hotmail.com>
FAQ: Perl on the Net: FTP and WWW Access <faq@denver.pm.org>
Re: ftp script (Charles DeRykus)
hash table <citykid@nospam.com>
Re: hash table <krahnj@acm.org>
Re: hash table (E.Chang)
Re: hash table (Tad McClellan)
Re: How to resolve multi process issue??? (Gururaj Upadhye)
LOOKING FOR PERL JOBS <cometlinear@yahoo.com>
Re: newbeeeeeee question (Logan Shaw)
Re: newbeeeeeee question <krahnj@acm.org>
one billion seconds for the "time" function :) and a qu <Orbitguy@concentric.net>
Re: one billion seconds for the "time" function :) and <tony_curtis32@yahoo.com>
Perl and javascript question <bcoon@sequenom.com>
Re: Printing Everything After A Certain Point <krahnj@acm.org>
Q about fork and kill (gene)
Re: Recommendations for a 2nd book on Perl <djberg96@hotmail.com>
sendmail limitations? <mragsdal@utk.edu>
Re: sendmail limitations? <tony_curtis32@yahoo.com>
Re: sendmail limitations? <mragsdal@utk.edu>
Re: sortlen -- filter to sort text by line length (Randal L. Schwartz)
Re: Text variable containing '$' (E.Chang)
Timingout a socket <haim.lichaa@intel.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 12 Jul 2001 23:36:14 GMT
From: "Daniel Berger" <djberg96@hotmail.com>
Subject: Re: Example needed for Win32::OLE and Excel
Message-Id: <Ovq37.7332$GI4.379766@typhoon.mn.mediaone.net>
"Ross" <swan@peakpeak.com> wrote in message
news:7288d820.0107121254.1b2d2537@posting.google.com...
> Hi,
>
> I've been spending the morning reading FAQ's
> but haven't found a example where a existing
> excel file is openned and the row column contents
> of the spread sheet are read by the Perl program.
>
> Thanks,
> Ross
You're much better off using the Spreadsheet::ParseExcel module (on CPAN)
instead of Win32::OLE. At least, it's much easier IMO. You could always
use a system command to open the file (couldn't you?).
Regards,
Dan
------------------------------
Date: Fri, 13 Jul 2001 00:17:02 GMT
From: PerlFAQ Server <faq@denver.pm.org>
Subject: FAQ: Perl on the Net: FTP and WWW Access
Message-Id: <26r37.76$T3.193037312@news.frii.net>
This message is one of several periodic postings to comp.lang.perl.misc
intended to make it easier for perl programmers to find answers to
common questions. The core of this message represents an excerpt
from the documentation provided with every Standard Distribution of
Perl.
+
Perl on the Net: FTP and WWW Access
To get the best performance, pick a site from the list below and use it
to grab the complete list of mirror sites which is at /CPAN/MIRRORED.BY
or at http://mirror.cpan.org/. From there you can find the quickest site
for you. Remember, the following list is *not* the complete list of CPAN
mirrors (the complete list contains 165 sites as of January 2001):
http://www.cpan.org/
http://www.perl.com/CPAN/
http://download.sourceforge.net/mirrors/CPAN/
ftp://ftp.digital.com/pub/plan/perl/CPAN/
ftp://ftp.flirble.org/pub/languages/perl/CPAN/
ftp://ftp.uvsq.fr/pub/perl/CPAN/
ftp://ftp.funet.fi/pub/languages/perl/CPAN/
ftp://ftp.dti.ad.jp/pub/lang/CPAN/
ftp://mirror.aarnet.edu.au/pub/perl/CPAN/
ftp://cpan.if.usp.br/pub/mirror/CPAN/
One may also use xx.cpan.org where "xx" is the 2-letter country code for
your domain; e.g. Australia would use au.cpan.org.
-
Documents such as this have been called "Answers to Frequently
Asked Questions" or FAQ for short. They represent an important
part of the Usenet tradition. They serve to reduce the volume of
redundant traffic on a news group by providing quality answers to
questions that keep coming up.
If you are some how irritated by seeing these postings you are free
to ignore them or add the sender to your killfile. If you find
errors or other problems with these postings please send corrections
or comments to the posting email address or to the maintainers as
directed in the perlfaq manual page.
Answers to questions about LOTS of stuff, mostly not related to
Perl, can be found by pointing your news client to
news:news.answers
or to the many thousands of other useful Usenet news groups.
Note that the FAQ text posted by this server may have been modified
from that distributed in the stable Perl release. It may have been
edited to reflect the additions, changes and corrections provided
by respondents, reviewers, and critics to previous postings of
these FAQ. Complete text of these FAQ are available on request.
The perlfaq manual page contains the following copyright notice.
AUTHOR AND COPYRIGHT
Copyright (c) 1997-1999 Tom Christiansen and Nathan
Torkington. All rights reserved.
This posting is provided in the hope that it will be useful but
does not represent a commitment or contract of any kind on the part
of the contributers, authors or their agents.
02.13
--
This space intentionally left blank
------------------------------
Date: Thu, 12 Jul 2001 22:25:17 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: ftp script
Message-Id: <GGDsy6.FG6@news.boeing.com>
In article <3B4CC136.BA312131@earthlink.net>,
Benjamin Goldberg <goldbb2@earthlink.net> wrote:
>Todd Smith wrote:
>>
>> How can I write a script to try to log in to an ftp server for me, and
>> if there are too many users, wait a few minutes and try again? But the
>> thing is, if it gets in, I need to have a normal ftp shell and I need
>> it to keep the connection alive until I check back with the program.
>
>Use the Expect module.
>
>use Expect;
>
>my $remotehost = "hostname";
>my $userid = "anonymous";
>my $passwd = "email@host.com";
>my $ftp;
>{
> open2( \*RD, \*WR, "ftp", $remotehost );
> select( (select WR, $|=1)[0] );
> $ftp = Expect->new( \*RD );
> defined $ftp->expect( undef, -re => qr/^Name .*: /s ) or redo;
> print WR $userid, "\n";
> defined $ftp->expect( undef, -re => qr/^Password: / ) or redo;
> print WR $passwd, "\n";
> defined $ftp->expect( undef, -re => qr/^230 / ) or redo;
>}
>if( my $pid = fork ) {
> $ftp->interact;
>} elsif( defined $pid ) {
> print while <WR>;
>} else {
> die "Couldn't fork: $!\n";
>}
>__END__
Net::FTP might be another possibility if I haven't missed
something:
my $ftp = Net::FTP->new($remotehost) or die $@;
{
unless ( $ftp->login($acct, $password) ) {
sleep 60 and redo if $ftp->message =~ /too many users/;
die "login failed: ", $ftp->message;
}
}
...
--
Charles DeRykus
------------------------------
Date: Thu, 12 Jul 2001 15:38:59 -0700
From: Les Ander <citykid@nospam.com>
Subject: hash table
Message-Id: <Pine.LNX.4.33.0107121533200.7233-100000@schewanella.stanford.edu>
Hi,
Is it possible to have an array (but no reference)
for a given key?
I am trying to read a data file line by line which has
tab delimited fields, the first field is the key and the remaining
7 fields are values (numbers).
i tried doing something like:
while(my $line=<IN>)
{
my @line_arr=split(/\t/,$line);
for my $i(1..7)
{
$my_hash{$line_arr[0]}=$line_arr[$i];
}
}
but this just replaces the last added value.
so i tried creating an array of these 7 values
and then assign itL $my_hash{$line_arr[0}=@arr;
but this does'nt work either.
please help..
------------------------------
Date: Thu, 12 Jul 2001 22:56:53 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: hash table
Message-Id: <3B4E2B2D.473DC5D8@acm.org>
Les Ander wrote:
>
> Hi,
> Is it possible to have an array (but no reference)
> for a given key?
>
> I am trying to read a data file line by line which has
> tab delimited fields, the first field is the key and the remaining
> 7 fields are values (numbers).
>
> i tried doing something like:
>
> while(my $line=<IN>)
> {
> my @line_arr=split(/\t/,$line);
> for my $i(1..7)
> {
> $my_hash{$line_arr[0]}=$line_arr[$i];
> }
> }
>
> but this just replaces the last added value.
> so i tried creating an array of these 7 values
> and then assign itL $my_hash{$line_arr[0}=@arr;
> but this does'nt work either.
while ( my $line = <IN> ) {
my ( $key, @line_arr ) = split /\t/, $line;
$my_hash{ $key } = [ @line_arr ];
}
John
--
use Perl;
program
fulfillment
------------------------------
Date: Thu, 12 Jul 2001 23:14:51 GMT
From: echang@netstorm.net (E.Chang)
Subject: Re: hash table
Message-Id: <Xns90DCC461885D6echangnetstormnet@207.106.92.86>
Les Ander <citykid@nospam.com> wrote in
<Pine.LNX.4.33.0107121533200.7233-100000@schewanella.stanford.edu>:
> Hi,
> Is it possible to have an array (but no reference)
> for a given key?
>
> I am trying to read a data file line by line which has
> tab delimited fields, the first field is the key and the remaining
> 7 fields are values (numbers).
>
> i tried doing something like:
>
> while(my $line=<IN>)
> {
> my @line_arr=split(/\t/,$line);
> for my $i(1..7)
> {
> $my_hash{$line_arr[0]}=$line_arr[$i];
> }
> }
>
> but this just replaces the last added value.
> so i tried creating an array of these 7 values
> and then assign itL $my_hash{$line_arr[0}=@arr;
> but this does'nt work either.
I'm not sure what you mean by "but no reference." Both the keys and
values of a hash must be scalars, so to create a hash whose values "are
arrays", you need to create a hash whose values are references. below
is one possible solution, using your general approach. (I used
Data::Dumper to show what the resulting structure looks like.) The
documentation page perlreftut offers a good introduction to using
references.
use Data::Dumper;
my %line_hash;
while(my $line=<DATA>)
{
my @line_arr=split(/\t/,$line);
my $line_key = shift @line_arr;
$line_hash{$line_key}=\@line_arr;
}
print Dumper \%line_hash;
__DATA__
a b c d e
f g h i j
k l m n o
OUTPUT
$VAR1 = {
'f' => [
'g',
'h',
'i',
'j
'
],
'a' => [
'b',
'c',
'd',
'e
'
],
'k' => [
'l',
'm',
'n',
'o
'
]
};
--
EBC
------------------------------
Date: Thu, 12 Jul 2001 19:22:50 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: hash table
Message-Id: <slrn9kscaa.k42.tadmc@tadmc26.august.net>
John W. Krahn <krahnj@acm.org> wrote:
>Les Ander wrote:
>>
>> Is it possible to have an array (but no reference)
>> for a given key?
No.
>> I am trying to read a data file line by line which has
>> tab delimited fields, the first field is the key and the remaining
>> 7 fields are values (numbers).
>>
>> i tried doing something like:
>>
>> so i tried creating an array of these 7 values
>> and then assign itL $my_hash{$line_arr[0}=@arr;
>> but this does'nt work either.
[snip]
>while ( my $line = <IN> ) {
Probably want a chomp() about here?
> my ( $key, @line_arr ) = split /\t/, $line;
> $my_hash{ $key } = [ @line_arr ];
Since it is already my()d each time through the loop, there's not
much point in copying it to an anon array first:
$my_hash{ $key } = \@line_arr;
> }
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 12 Jul 2001 16:36:09 -0700
From: gururaj@powertec.com (Gururaj Upadhye)
Subject: Re: How to resolve multi process issue???
Message-Id: <23c54ab6.0107121536.536df790@posting.google.com>
nobull@mail.com wrote in message news:<u9g0c284ei.fsf@wcl-l.bham.ac.uk>...
> gururaj@powertec.com (Gururaj Upadhye) writes:
>
> > I have set this on windows NT, with mod perl 1.25. The behaviour is
> > very
> > unusual. The first, 3rd, 5th, (odd) access to the script result in
> > user name and password prompt page to be displayed. At this point if I
> > hit the browser's back button and try again, the operation is
> > successful. This has puzzled me a lot and I donot have any solution
> > for this.
> >
> > My guess is that one of the apache processes is responding properly
> > but other one is not. I am starting Apache as a NT service. How to
> > resolve this issue?
>
> Are you perhaps relying on persistance of global variables in mod_perl
> to carry session state information?
>
> Don't.
>
> There is no guarentee that two successive transactions handled by a
> given server process will constitute part of the same session.
>
> There is no guarentee that two successive transactions that constitute
> part of the same session will be handled by a the same given server
> process.
The script that is producing this result is user_manage.cgi. I
downloaded it from capn site. I am a novice of perl and not an expert
in Apache.
Regards,
-Guru
------------------------------
Date: Thu, 12 Jul 2001 23:45:18 GMT
From: dot-comet <cometlinear@yahoo.com>
Subject: LOOKING FOR PERL JOBS
Message-Id: <120720011641194147%cometlinear@yahoo.com>
I am looking for intermediate-level PERL jobs. I am willing to work
inexpensively in exchange for experience.
Please contact me through the website below, or call me at: 916-996-3334
Thank you,
-joshua
http://dot-comet.com
------------------------------
Date: 12 Jul 2001 17:05:58 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: newbeeeeeee question
Message-Id: <9il706$ndg$1@charity.cs.utexas.edu>
In article <9ikli10srd@drn.newsguy.com>, Dan White <dwhite@icimail.com> wrote:
>what I am trying to achieve is to take a group of file (ie log file from a
>directory and get the head -7 and tail -20 from each log file. and place that
>file into a tmp file in another directory. anot sure how to do this in perl.
>where is what I have so far bit it dosent work hangs on the systemn commands
>#!/usr/local/bin/perl -w
>@filenames = <*.log>;
>foreach $a (@filenames) {
> system('head -7 $a > $a.tmp');
> system('tail -20 $a >> $a.tmp');
> print "$a\n";
> }
And I bet you have a file called ".tmp" located in the directory you're
trying to write into.
You're close. The problem is your quoting.
A single-quoted string, such as the ones you've used in your system()
calls, doesn't cause Perl to interpret variables that occur in the
string.
So, what's happening? You're sending this string:
head -7 $a > $a.tmp
to the shell. Since the shell (presumably) doesn't have a
variable "a" defined, it replaces the occurences of "$a"
with the empty string. This means that the shell turns that
command into this command:
head -7 > .tmp
Now, "head" doesn't get a filename argument, so it reads from standard
input. But you aren't typing anything on its standard input, so it
just patiently waits for the input you told it to read. And that's why
it "hangs".
You should be able to change your single quotes to double quotes and
that should make everything better, assuming your filenames don't
contain funny characters that would confuse the shell.
- Logan
--
my your his her our their _its_
I'm you're he's she's we're they're _it's_
------------------------------
Date: Thu, 12 Jul 2001 22:28:37 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: newbeeeeeee question
Message-Id: <3B4E248D.F7E83E80@acm.org>
Dan White wrote:
>
> Hello all,
>
> what I am trying to achieve is to take a group of file (ie log file from a
> directory and get the head -7 and tail -20 from each log file. and place that
> file into a tmp file in another directory. anot sure how to do this in perl.
> where is what I have so far bit it dosent work hangs on the systemn commands
>
> thanks
> Dan
>
> #!/usr/local/bin/perl -w
> @filenames = <*.log>;
> foreach $a (@filenames) {
> system('head -7 $a > $a.tmp');
> system('tail -20 $a >> $a.tmp');
> print "$a\n";
> }
Using single quotes (') means that perl won't interpolate your variables
so head and tail are trying to open a file named $a.
#!/usr/local/bin/perl -w
use strict;
foreach my $a ( glob '*.log' ) {
system "head -7 $a > $a.tmp";
system "tail -20 $a >> $a.tmp";
print "$a\n";
}
John
--
use Perl;
program
fulfillment
------------------------------
Date: 12 Jul 2001 22:36:58 GMT
From: B <Orbitguy@concentric.net>
Subject: one billion seconds for the "time" function :) and a question about time
Message-Id: <3B4E2688.6DF5@concentric.net>
Playing around with the "time" and "gmtime" functions, I noticed that
the value returned by "time" will hit 1,000,000,000 seconds( a billion
US, a thousand million in UK, I think)
on Sunday. Sept. 9, GMT 01:46:40 2001 ...
sounds like as good an excuse as any for a party :)
On a more programming related note, I am a novice at PERL and was
wondering how to go about getting a website visitor's timezone/time?
None of the %ENV variables returned from a test prog I ran on my site
had anything to do with time-- I was hoping for something easy like
"HTTP_USER_TIME=..." :)
... surely there is a way of ferreting out the time/timezone of a
visitor other than asking them to input it?
Thanks for any help,
Paul Burke
New PERL Junkie
------------------------------
Date: 12 Jul 2001 19:26:25 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: one billion seconds for the "time" function :) and a question about time
Message-Id: <873d817jym.fsf@limey.hpcc.uh.edu>
>> On 12 Jul 2001 22:36:58 GMT,
>> B <Orbitguy@concentric.net> said:
> On a more programming related note, I am a novice at
> PERL and was wondering how to go about getting a website
> visitor's timezone/time? None of the %ENV variables
> returned from a test prog I ran on my site had anything
> to do with time-- I was hoping for something easy like
> "HTTP_USER_TIME=..." :) ... surely there is a way of
> ferreting out the time/timezone of a visitor other than
> asking them to input it?
This is more a comp.infosystems.www.authoring.cgi type
question, but as you mentioned %ENV we'll give you the
benefit of the doubt :-)
The answer is: they'll have to input it. They might be
going through a proxy in a different timezone. Their
system might be using the wrong timezone. Browsers can
lie. There's no way of determining the timezone
automatically.
f'ups to comp.infosystems.www.authoring.cgi set.
hth
t
--
Beep beep! Out of my way, I'm a motorist!
------------------------------
Date: Thu, 12 Jul 2001 15:39:25 -0700
From: BCC <bcoon@sequenom.com>
Subject: Perl and javascript question
Message-Id: <3B4E271D.393708C5@sequenom.com>
Hi, I have a question on integrating perl and javascript...
What I have is a hash like this:
%hash = ( a => [1, 10],
b => [11,20],
c => [21,30]);
etc, etc.
In my web page, a, b, and c are in a popup_menu. What I need to have
happen is if 'b' is selected, some other form element is set to 11.
Logically, I think I need to do this:
1. Get the value of the popup_menu selection
2. Return this value to the hash as the key
3. Have hash spit out values with:
($val1, $val2) = @{$hash{$value_returned_from_jscript}};
4. Pass $val1 or $val2 to another jscript to set element value
What I am not sure on is how to return the value of the jscript to my
perl hash.
Maybe I am thinking about this from the wrong direction....
Anyone have any suggestions?
Thanks!
Bryan
------------------------------
Date: Thu, 12 Jul 2001 22:45:49 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Printing Everything After A Certain Point
Message-Id: <3B4E2896.90B9079C@acm.org>
Josh Geller wrote:
>
> What I am trying to do is print out everything in a filehandle after a
> certain point.
>
> What I am getting is:
>
> Use of uninitialized value at ./Build/cdiffer.pl line 141, <INPIPE>
> chunk 41.
>
> Here's a code fragment:
>
> ___
>
> open(INPIPE, "$firstpipe|") || die "Cannot open pipe $firstpipe: $! \n";
> chdir($workdir);
> foreach (<INPIPE>) {
> if(m/^description:.*$/) {
^^^
These three characters aren't needed and cause your regex to work
harder.
> undef $/;
> $log = <INPIPE>;
> print $log;
> } else {
> next;
> }
> }
> $/ = $dollarslash;
> close(INPIPE);
Always check the return value on a closed pipe.
close INPIPE or die "Cannot close pipe $firstpipe: $!";
A more perlish way to do this is:
open INPIPE, "$firstpipe|" or die "Cannot open pipe $firstpipe: $!";
chdir $workdir or die "Cannot chdir to $workdir: $!";
while ( <INPIPE> ) {
print if /^description:/ .. eof();
}
close INPIPE or die "Cannot close pipe $firstpipe: $!";
John
--
use Perl;
program
fulfillment
------------------------------
Date: 12 Jul 2001 17:34:59 -0700
From: usenet@smalltime.com (gene)
Subject: Q about fork and kill
Message-Id: <9a95c0dd.0107121634.1e2b376b@posting.google.com>
I'm playing around with fork, following the code in the cookbook:
1: #!/usr/bin/perl
2:
3: print "start: $pid\n";
4:
5: FORK: {
6: if ($pid = fork) {
7: print "forking\n";
8: while (kill 0 => $pid) {
9: print "still going\n";
10: sleep(1);
11: }
12: } elsif (defined $pid) {
13: print "inside child\n";
14: }
15: }
16: print "ending: $pid\n";
This works on one machine (Mac OS X), but on another machine (SunOS)
the kill statement on line 8 never registers that the child is dead.
Since this is perl, I'm sure there are many ways to do this. What do
people recommend?
Also, I have a general fork question. I'm having some trouble
following the program flow through the code above. Using print
statements, the first place that I can see the child running is at
line 13. I had thought that the child would start over at the top,
but it never hits the print statement at line 3. How exactly does
this work?
------------------------------
Date: Thu, 12 Jul 2001 23:42:36 GMT
From: "Daniel Berger" <djberg96@hotmail.com>
Subject: Re: Recommendations for a 2nd book on Perl
Message-Id: <MBq37.7333$GI4.380207@typhoon.mn.mediaone.net>
> I'm going to have to create a large database (I haven't created it
> yet). So, what I've read about DBI is incorrect apparently. DBI can
> be used in a production environment. I suppose I've read incorrect
> information, which is one reason I asked the question--it didn't seem
> correct to me either that DBI was created without production in mind.
> Thanks for letting me know that it is nonsense.
The only thing you *might* have to watch out for is the particular DBD
driver you happen to be using. Definitely check the readme and any changes
that have been made (and the "To Do" list if there is one). The major DBMS
out there have solid drivers AFAIK.
I can tell you now that the Oracle driver installation can often be a pain
(witness the number of users who have problems installing it in the dbi
mailing list), but this newsgroup or the archive of the dbi-users group
should help.
Regards,
Dan
------------------------------
Date: Thu, 12 Jul 2001 20:55:47 -0400
From: Mike Ragsdale <mragsdal@utk.edu>
Subject: sendmail limitations?
Message-Id: <3B4E4713.901C791C@utk.edu>
I have a script that searches our student database based on certain
criteria and obtains their email address. Then I'm emailing them a form
letter and emailing myself a list of the recipients. For some reason it
was failing half way through. I was able to make it work completely
when I commented some code out, but that's really the important code.
I'm thinking there is some limitation with sendmail, but not sure. See
the comments in the code excerpt:
.
.
.
my $mailprog = '/usr/lib/sendmail';
open(MAIL2,"|$mailprog -t") or die "Could not open mail2.\n";
print MAIL2 "To: ***********\n";
print MAIL2 "From: **********\n";
print MAIL2 "Subject: Mass Email\n";
print MAIL2 "You sent the following email to the listed individuals:
\n\n";
print MAIL2 "$emailsubj\n\n";
print MAIL2 "$emailtext\n\n";
while (@row = $sth->fetchrow_array()){
$counter += 1;
open(MAIL,"|$mailprog -t"); # When this section
print MAIL "To: $row[0]\n"; # is commented out,
print MAIL "From: *******\n"; # the script finishes
print MAIL "Subject: $emailsubj\n"; # and gives me a total
print MAIL "Dear $row[1],\n\n"; # of 7674 recipients
print MAIL "$emailtext\n"; # without the comments
close (MAIL); # it fails after 3286
printf MAIL2 ("%30s%30s%10s\n",$row[1],$row[0],$row[2]);
}
print MAIL2 "A total of $counter emails have been sent.\n";
close (MAIL2);
.
.
So what is the problem? What is the limiting factor?
-Mike
------------------------------
Date: 12 Jul 2001 19:49:28 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: sendmail limitations?
Message-Id: <87u20h64br.fsf@limey.hpcc.uh.edu>
>> On Thu, 12 Jul 2001 20:55:47 -0400,
>> Mike Ragsdale <mragsdal@utk.edu> said:
> print MAIL2 "To: ***********\n";
> print MAIL2 "From: **********\n";
> print MAIL2 "Subject: Mass Email\n";
^^^
Headers not terminated. You need a blank line.
> print MAIL2 "You sent the following email to the listed individuals:
> \n\n";
>
> $counter += 1;
Using the ++ operator is more perlish.
> open(MAIL,"|$mailprog -t"); # When this section
> print MAIL "To: $row[0]\n"; # is commented out,
> print MAIL "From: *******\n"; # the script finishes
> print MAIL "Subject: $emailsubj\n"; # and gives me a total
^^^
Headers not terminated. You need a blank line.
> print MAIL "Dear $row[1],\n\n"; # of 7674 recipients
> print MAIL "$emailtext\n"; # without the comments
*Always* check the success of open() and close() (the
latter especially when dealing with pipes).
hth
t
--
Beep beep! Out of my way, I'm a motorist!
------------------------------
Date: Thu, 12 Jul 2001 21:09:05 -0400
From: Mike Ragsdale <mragsdal@utk.edu>
Subject: Re: sendmail limitations?
Message-Id: <3B4E4A31.2AC88C9E@utk.edu>
Tony Curtis wrote:
>
> >> On Thu, 12 Jul 2001 20:55:47 -0400,
> >> Mike Ragsdale <mragsdal@utk.edu> said:
>
> > print MAIL2 "To: ***********\n";
> > print MAIL2 "From: **********\n";
> > print MAIL2 "Subject: Mass Email\n";
> ^^^
> Headers not terminated. You need a blank line.
The subject prints just fine as does the body of the email, but I'll add
another \n.
> > print MAIL2 "You sent the following email to the listed individuals:
> > \n\n";
> >
> > $counter += 1;
>
> Using the ++ operator is more perlish.
Trivial.
> > open(MAIL,"|$mailprog -t"); # When this section
> > print MAIL "To: $row[0]\n"; # is commented out,
> > print MAIL "From: *******\n"; # the script finishes
> > print MAIL "Subject: $emailsubj\n"; # and gives me a total
> ^^^
> Headers not terminated. You need a blank line.
Again, this does not affect the emails. The subject exists and the body
exists. The emails are going out. Just not all of them.
> > print MAIL "Dear $row[1],\n\n"; # of 7674 recipients
> > print MAIL "$emailtext\n"; # without the comments
>
> *Always* check the success of open() and close() (the
> latter especially when dealing with pipes).
Yes, I noticed that when I was copying this excerpt and have added
"....or die....." to them. But, this does not fix nor address the
problem of the limitations. Any ideas for that?
Thanks,
-Mike
------------------------------
Date: 12 Jul 2001 16:37:22 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: sortlen -- filter to sort text by line length
Message-Id: <m1r8vl90st.fsf@halfdome.holdit.com>
>>>>> "Ren" == Ren Maddox <ren@tivoli.com> writes:
Ren> Except that it misses the big win of GRT over ST: the default compare
Ren> operation is *much* faster.
Both the ST and the GRT map the sort list to and from some
intermediate representation. The ST is more general, the GRT requires
a bit more art, but is a win when you can use it.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Thu, 12 Jul 2001 22:54:53 GMT
From: echang@netstorm.net (E.Chang)
Subject: Re: Text variable containing '$'
Message-Id: <Xns90DCC1053B350echangnetstormnet@207.106.92.86>
Michael Carman <mjcarman@home.com> wrote in
<3B4E06F0.27AEC995@home.com>:
[snip]
>Er, well, not really. It's just a matter of how things behave in
>double-quoted strings. Because \ is an escape char, you need to use
>\\ to get a literal \. But Perl expects $ to begin a variable name,
>so you need to escape that, too, as \$. That's how we get the ugly
>\\\$. I like the version using s''' much better, but the special
>case behavior forms a trap for the novice.
>
>-mjc
Suddenly the light dawns. Yes, I saw the warning but was too brain-dead
to understand the implications because I still wasn't thinking of the
second part of the substitution as a double-quoted string subject to
interpolation. Thanks again.
--
EBC
------------------------------
Date: Fri, 13 Jul 2001 01:33:51 +0300
From: "Haim Lichaa" <haim.lichaa@intel.com>
Subject: Timingout a socket
Message-Id: <9il8ko$lnf@news.or.intel.com>
I'm using this perl snipit on a Solaris box running Perl 5.00403
my($s)=IO::Socket::INET->new(
PeerAddr => $host,
PeerPort => $port,
Proto =>'tcp',
Type => SOCK_STREAM,
Timeout => $to);
and any $to value has no affect on the Timeout. It remains constat @ ~4mins.
Any body know why and how I can fix it?
------------------------------
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 1295
***************************************