[16634] in Perl-Users-Digest
Perl-Users Digest, Issue: 4046 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 17 14:05:42 2000
Date: Thu, 17 Aug 2000 11:05:26 -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: <966535525-v9-i4046@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 17 Aug 2000 Volume: 9 Number: 4046
Today's topics:
Re: anyone know why when I add tr /a-z/A-Z/s-thanks <star@sonic.net>
Re: array weirdness. (Anno Siegel)
Attatching files in an email using perl <manojnair@mediaone.net>
Re: Checking if variables exist nobull@mail.com
Re: Checking if variables exist <lr@hpl.hp.com>
Clearing an array richh6870@my-deja.com
Re: Clearing an array <sariq@texas.net>
Re: cookie problem <martinqz@taiwan.com>
Deleting messages from web board xlr555usa@netscape.net
DOS Batch to PERL Conversion smilesdotcom@my-deja.com
Extracting values from a variable / using split or rege <jimmy.lantz@ostas.lu.se>
Extracting values from a variable / using split or rege <jimmy.lantz@ostas.lu.se>
Formatting Integer/String <johnt@sparc.nic.bc.ca>
Getting NT to run Perl/CGI program xscripter@my-deja.com
Re: Getting NT to run Perl/CGI program <latsharj@my-deja.com>
glob failed (child exited with status -1, core dumped) mrfloppy@sanitize.net
help i'm stuck!!! pape_98@my-deja.com
Re: help i'm stuck!!! <tom.kralidis@ccrs.nrcan.gcDOTca>
Help writing scriptlet interpreter bluearchtop@my-deja.com
iis4 path kalpeshv@my-deja.com
iis4 path kalpeshv@my-deja.com
Re: lucky7.to - What a lucky Free URL Redirection Servi (Tony L. Svanstrom)
Re: LWP nukes user alarms? <newspost@coppit.org>
Re: ODBC question <drawbridge@home.com>
Open a new process for read AND write <aca97mpw@sheffield.ac.uk>
Out of memory! error. Working with arrays... <samara_biz@hotmail.com>
Output to printer in Win NT hiroshiishii@my-deja.com
Re: perl 5.6 (Randal L. Schwartz)
Re: perl 5.6 (Abigail)
Re: perl 5.6 (Abigail)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 17 Aug 2000 16:32:32 GMT
From: arthur <star@sonic.net>
Subject: Re: anyone know why when I add tr /a-z/A-Z/s-thanks
Message-Id: <B5C0B8ED.6828%star@sonic.net>
I want to THANK everyone from this newsgroup for putting up with me and
helping me. Thank You All? Yes 'uc' worked like a champ, and thats all it
needed. :>
open (HOPE, ">/home/www_pages/star/dat.html") || die print "cant open:$!\n";
print (HOPE uc(param('question'))); #there is 'uc', pretty simple :>
close HOPE;
~arthur
star@sonic.net
------------------------------
Date: 17 Aug 2000 17:15:44 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: array weirdness.
Message-Id: <8nh6k0$ltt$1@lublin.zrz.tu-berlin.de>
Tom Briles <sariq@texas.net> wrote in comp.lang.perl.misc:
>Patches welcome...well, sort of...I sent a patch for this several months
>ago, and never heard back. Perhaps I'll resubmit it.
I don't think you get a response from perlbug unless they need you
to fix it. With a doc patch that would rarely be the case. :)
I sent a doc patch way back when and never heard of it, but it
was incorporated.
Anno
------------------------------
Date: Thu, 17 Aug 2000 13:03:23 -0400
From: M Nair <manojnair@mediaone.net>
Subject: Attatching files in an email using perl
Message-Id: <399C1ADB.86BD4BA0@mediaone.net>
Hi.
I am trying to send emails with attatchments from within perl running on
Solaris. I have done this before using mail and setting the
Content-Type and Mime formats etc..but I dont recollect it now...
Can anyone help me?
TIA.
M
------------------------------
Date: 17 Aug 2000 17:41:18 +0100
From: nobull@mail.com
Subject: Re: Checking if variables exist
Message-Id: <u9ya1vn8ys.fsf@wcl-l.bham.ac.uk>
Abe Timmerman <abe@ztreet.demon.nl> writes:
> use CGI qw(:standard);
> my %FORM = map { $_ => param($_) } param();
You mean:
my %FORM = map { $_ => scalar(param($_)) } param();
Intuatively you may expect => to put a scalar context on its RHS but
this is not the case.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Thu, 17 Aug 2000 10:49:17 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Checking if variables exist
Message-Id: <MPG.1405c57dda30147b98ac88@nntp.hpl.hp.com>
In article <MPG.1406133677d681599896c1@localhost> on Thu, 17 Aug 2000
05:19:08 GMT, jason <elephant@squirrelgroup.com> says...
...
> a) a scalar is false if it is undefined or if it equals the null string
> or if the numeric value of the scalar is zero
It's slightly more complicated than that.
A scalar is false if it is undefined or if it equals the null string
or if it equals the string '0' or if it is a number whose value is 0.
Thus a scalar with value '00' is true, but if assigned '00' + 0 it is
false, as is -0.0e100, etc.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 17 Aug 2000 15:54:04 GMT
From: richh6870@my-deja.com
Subject: Clearing an array
Message-Id: <8nh1qi$2lj$1@nnrp1.deja.com>
How do I reset an array in perl? I've tried things like:
$len = @array; @array = splice(@array,$len);
but I either end up deleting nothing or inserting whitespace
Cheers,
Rich
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 17 Aug 2000 16:04:08 GMT
From: Tom Briles <sariq@texas.net>
Subject: Re: Clearing an array
Message-Id: <399C0D14.82F9DCBF@texas.net>
richh6870@my-deja.com wrote:
>
> How do I reset an array in perl? I've tried things like:
>
> $len = @array; @array = splice(@array,$len);
>
> but I either end up deleting nothing or inserting whitespace
perldoc perldata
will explain how to "truncate an array down to nothing".
- Tom
------------------------------
Date: Fri, 18 Aug 2000 01:27:41 +0800
From: MartinQz <martinqz@taiwan.com>
Subject: Re: cookie problem
Message-Id: <399C208D.E2FA5C3D@taiwan.com>
>
Thanks for all your helps!
And I want to know how to remove any one of "name=value" pair in an
on-the-fly cookie?
Martin.Qz
------------------------------
Date: Thu, 17 Aug 2000 17:27:53 GMT
From: xlr555usa@netscape.net
Subject: Deleting messages from web board
Message-Id: <tgVm5.26591$47.473963@news.bc.tac.net>
Hi,
I am using Matt's wwwboard (scriptarchive.com) and I am trying to modify the wwwadmin.pl file so that entries older than a week will be deleted automatically.
Is there a way to create a conditional statement with the date function that will allow me to do this?
Any suggestions are greatly appreciated.
I posted my code for wwwadmin.pl here:
http://home.mindspring.com/~lexmesa/stest/wwwadmin.pl.txt
regards,
Tim
==================================
Posted via http://nodevice.com
Linux Programmer's Site
------------------------------
Date: Thu, 17 Aug 2000 17:21:38 GMT
From: smilesdotcom@my-deja.com
Subject: DOS Batch to PERL Conversion
Message-Id: <8nh6ua$9ad$1@nnrp1.deja.com>
I am looking for a simple utility that will convert a DOS batch file to
a PERL file. The batch is very simple. I am not looking for
perfection, just a starting point.
Thanks in advance,
Lazy
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 17 Aug 2000 08:41:15 +0200
From: Jimmy Lantz <jimmy.lantz@ostas.lu.se>
Subject: Extracting values from a variable / using split or regexp... /complex q.
Message-Id: <399B890C.52BEE62A@ostas.lu.se>
Hi,
(NB. I'm reposting this Q. since I cant find it anywhere on deja.com or
in this NG, if it's been posted before I do apologize, it's not my
meaning to spam.)
I have the following problem (Pseudocode mixed with snippets of perl):
I have an variable $targeted which I need to match with the following regexp
(the \D last in the reg exp needs to be lower-case)
/(\D{3}?)(\d{3}?$|\d{3}?\D)/
I need to push every occurence of a match in an array @targets .
(Examples of correct/incorrect values below)
if there's an incorrect occurence I need to push that into @missedtargets
the variable $ targeted sometimes containes spaces between the hits and
sometimes it doesn't.
CCCNNNc , CCCNNN /C = uppercase letter / N =num / c = lower-case letter
Example of correct values:
AAA123
BBB321HHH765d JIT763 #NB! this is 3 correct hits: BBB321, HHH765d and
JIT763.
CCT762a JJI876 KLO873s
Example of INcorrect values:
AB123#only 2 chars
ABC432dAP345d #NB! this is incorrect due to that the 2nd occurence only
has 2 chars in the beginning!
I would very much appreciate pointers or helpfull links on how to do this.
BTW. I have RTFM.
Yours sincerely
Jimmy Lantz
@Dept. of East Asian Languages
@Lund University @ Sweden @ www.
------------------------------
Date: Wed, 16 Aug 2000 17:05:14 +0200
From: Jimmy Lantz <jimmy.lantz@ostas.lu.se>
Subject: Extracting values from a variable / using split or regexp... /complex q.
Message-Id: <399AADAB.E57F3A24@ostas.lu.se>
Hi,
I have the following problem (Pseudocode mixed with snippets of perl):
I have an variable $targeted which I need to match with the following regexp
(the \D last in the reg exp needs to be lower-case)
/(\D{3}?)(\d{3}?$|\d{3}?\D)/
I need to push every occurence of a match in an array @targets .
(Examples of correct/incorrect values below)
if there's an incorrect occurence I need to push that into @missedtargets
the variable $ targeted sometimes containes spaces between the hits and
sometimes it doesn't.
CCCNNNc , CCCNNN /C = uppercase letter / N =num / c = lower-case letter
Example of correct values:
AAA123
BBB321HHH765d JIT763 #NB! this is 3 correct hits: BBB321, HHH765d and
JIT763.
CCT762a JJI876 KLO873s
Example of INcorrect values:
AB123#only 2 chars
ABC432dAP345d #NB! this is incorrect due to that the 2nd occurence only
has 2 chars in the beginning!
I would very much appreciate pointers or helpfull links on how to do this.
BTW. I have RTFM.
Yours sincerely
Jimmy Lantz
@Dept. of East Asian Languages
@Lund University @ Sweden @ www.
------------------------------
Date: Thu, 17 Aug 2000 11:03:37 -0700
From: John <johnt@sparc.nic.bc.ca>
Subject: Formatting Integer/String
Message-Id: <Pine.GSO.4.10.10008171058470.1476-100000@sparc.nic.bc.ca>
Is there a simple way to format an integer (turning it into a string) to
have a consistant number of digits irregardless of number?
ex All numbers would have 7 digits:
1000 = 0001000
45678 = 0045678
998765 = 0998765
1235678 = 1235678
The only thing I could come up in my resource books is to check the length
of the string "1000" (length = x) and pad the left with 7 - x "0"s.
I have a feeling there is an easier way.. i just don't know it.
Can you help?
John
------------------------------
Date: Thu, 17 Aug 2000 16:24:59 GMT
From: xscripter@my-deja.com
Subject: Getting NT to run Perl/CGI program
Message-Id: <8nh3k2$4sv$1@nnrp1.deja.com>
My setup, NT running Apache. Perl is installed.
I get the 500 Error on my page. On my linux
server i have for the start of my
script, /usr/bin/perl. I don't know what to put
in place of that on my Windows Box.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 17 Aug 2000 17:00:43 GMT
From: Dick Latshaw <latsharj@my-deja.com>
Subject: Re: Getting NT to run Perl/CGI program
Message-Id: <8nh5nd$7j7$1@nnrp1.deja.com>
In article <8nh3k2$4sv$1@nnrp1.deja.com>,
xscripter@my-deja.com wrote:
> My setup, NT running Apache. Perl is installed.
> I get the 500 Error on my page. On my linux
> server i have for the start of my
> script, /usr/bin/perl. I don't know what to put
> in place of that on my Windows Box.
Try #!C:/perl/bin/perl -Tw
or where ever you have it installed.
--
Regards,
Dick
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 17 Aug 2000 18:27:22 +0200
From: mrfloppy@sanitize.net
Subject: glob failed (child exited with status -1, core dumped)
Message-Id: <399C126A.F241BD35@sanitize.net>
Hi,
I'm getting these after upgrading perl (to perl-5.00503-11) on one of
our machines (RedHat Linux 6.0). They don't occur if I run the same
utility from the shell, only from crond and atd. /bin/csh is runnable
from atd and crond's enviroments, I've confirmed.
I can't strace because perl or the specific combination of things
involved when globbing in Perl doesn't seem to like that.
The script is still working - it looks like the glob returns what it
should and the script works with it, the error messages seems to be an
artifact but I don't know of what. I haven't even found the core that
it
claims is being dumped, but this line hasn't been properly exhausted
yet.
Any ideas?
Example of errors:
[...]
glob failed (child exited with status -1, core dumped) at
/usr/local/sbin/mmdom-process line 66, <_GEN_0> chunk 1.
glob failed (child exited with status -1, core dumped) at
/usr/local/sbin/mmdom-process line 73, <_GEN_1> chunk 1.
glob failed (child exited with status -1, core dumped) at
/usr/local/sbin/mmdom-process line 81, <_GEN_2> chunk 1.
[...]
Line 66, 73 and 81 are all similar to the following:
while (defined($filename = glob("rd*.pending"))) {
$pend_count++;
logprint("[info] processing $filename");
process_request($filename);# || logprint("[err] error processing
$filename");
}
------------------------------
Date: Thu, 17 Aug 2000 17:01:25 GMT
From: pape_98@my-deja.com
Subject: help i'm stuck!!!
Message-Id: <8nh5on$7qr$1@nnrp1.deja.com>
i'm trying to sort numbers and i'm using this approach:
@sorted = map { $_->[0] }
sort { $a->[1] cmp $b->[1] }
map { [ $_, uc( (/\d+\s*(\S+)/)[0]) ] } @data;
but it sorts the numbers by the first digit (1,10,15,2,25,3,5, etc..)
how do i get it to sort the numbers by order of greatness(1,2,3,4,5,..)
????
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 17 Aug 2000 13:18:43 -0400
From: "Tom Kralidis" <tom.kralidis@ccrs.nrcan.gcDOTca>
Subject: Re: help i'm stuck!!!
Message-Id: <8nh6pj$ghn13@nrn2.NRCan.gc.ca>
<pape_98@my-deja.com> wrote in message news:8nh5on$7qr$1@nnrp1.deja.com...
> i'm trying to sort numbers and i'm using this approach:
> @sorted = map { $_->[0] }
> sort { $a->[1] cmp $b->[1] }
> map { [ $_, uc( (/\d+\s*(\S+)/)[0]) ] } @data;
>
> but it sorts the numbers by the first digit (1,10,15,2,25,3,5, etc..)
> how do i get it to sort the numbers by order of greatness(1,2,3,4,5,..)
> ????
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
recipe 4.14 from the Cookbook:
#!/usr/bin/perl -w
use strict;
use vars qw(@unsorted @sorted $a $b);
my @unsorted = (1,10,15,2,25,3,5);
@sorted = sort { $a <=> $b } @unsorted;
foreach(@sorted) {
print $_ . "\n";
}
--
=================================
Tom Kralidis
Systems Specialist
Canada Centre for Remote Sensing
Tel: (613) 947-1828
http://www.nrcan.gc.ca/~tkralidi/
=================================
------------------------------
Date: Thu, 17 Aug 2000 17:08:43 GMT
From: bluearchtop@my-deja.com
Subject: Help writing scriptlet interpreter
Message-Id: <8nh669$88p$1@nnrp1.deja.com>
Hi,
I want to be able to embed perl code in a string delimited by <% %>
and have it evaluated.
Example:
$str=<<_EOF_;
This
is
a
<%
print "HELLO WORLD";
print localtime(time);
%>
TEST
AND
<%
print "HI";
%>
_EOF_
$str=~s/<%(.*?)%>/eval $1/iesg;
print $str;
=====================
It prints out:
HELLO WORLD3051317710042291HITHis i
is
a
1
TEST
AND
1
=========================
Couple problems:
1) It doesn't print the evaluated code in the place I want it.
It prints a 1 where I want the output to go.
2) If there is an error in the code, how can I neatly capture and print
the error?
Thanks!!
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 17 Aug 2000 15:16:36 GMT
From: kalpeshv@my-deja.com
Subject: iis4 path
Message-Id: <8ngvjv$vr2$1@nnrp1.deja.com>
I really hope someone can help me, or give me some pointers please.
I work for a company called CSU that provides career guidance to
students etc... and assist in finding them jobs.
We are running NT4, service pack 6a, IIS4 and Actistates latest Perl
software as of 17th August 2000. And the problem we have seems to be
something to do with PATH_INFO. We run a perl script called parser.pl
(called betsie which provides text html pages.) The script works fine
on its own and Im sure its an IIS4 issue.
When I try and run parser.pl from a browser and append a url at the
end - e.g
http://www.prospects.csu.ac.uk/scripts/betsie/parser.pl/www.prospects.cs
u.ac.uk
I get an error 404 as though the file is not found, it looks as though
iis is not seeing the url as a parameter to a perl script.
I can run a test perl script from a browser ok so the perl.exe %s %s is
working fine. I can also run parser.pl from the url and it runs
parser.pl fine altough it complains that it cant find the url to parse
as I havent supplied it.
We previously ran on iis3 and it worked fine on this and temporarily it
worked on iis4.
Ive searched high and low on the web for help before emailing you and
have tried the following steps to get it working:-
i) ensured the scripts folder has c:\Perl\bin\perl.exe %s %s for .pl
extensions
ii) marked each entry as a script interpreter
iii) tried Perlis.dll for .pl scripts instead of perl.exe
iv) ran adsutil.vbs to set W3SVC/1/CreateCGIWithNewConsole 1
v) ran adsutil.vbs to set W3SVC/AllowPathinfoforScriptMappings TRUE
vi) removed the service pack 6a to go back to service pack 5.
vii) Tried it on a completely different NT 4 server running service
pack 6a and IIS4.
Ive tried all the above steps including restarts of the server after
each step and in various combinations aswell but still no luck.
Please can you help?
please email me directly. Thanks.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 17 Aug 2000 15:16:39 GMT
From: kalpeshv@my-deja.com
Subject: iis4 path
Message-Id: <8ngvk3$vr5$1@nnrp1.deja.com>
I really hope someone can help me, or give me some pointers please.
I work for a company called CSU that provides career guidance to
students etc... and assist in finding them jobs.
We are running NT4, service pack 6a, IIS4 and Actistates latest Perl
software as of 17th August 2000. And the problem we have seems to be
something to do with PATH_INFO. We run a perl script called parser.pl
(called betsie which provides text html pages.) The script works fine
on its own and Im sure its an IIS4 issue.
When I try and run parser.pl from a browser and append a url at the
end - e.g
http://www.prospects.csu.ac.uk/scripts/betsie/parser.pl/www.prospects.cs
u.ac.uk
I get an error 404 as though the file is not found, it looks as though
iis is not seeing the url as a parameter to a perl script.
I can run a test perl script from a browser ok so the perl.exe %s %s is
working fine. I can also run parser.pl from the url and it runs
parser.pl fine altough it complains that it cant find the url to parse
as I havent supplied it.
We previously ran on iis3 and it worked fine on this and temporarily it
worked on iis4.
Ive searched high and low on the web for help before emailing you and
have tried the following steps to get it working:-
i) ensured the scripts folder has c:\Perl\bin\perl.exe %s %s for .pl
extensions
ii) marked each entry as a script interpreter
iii) tried Perlis.dll for .pl scripts instead of perl.exe
iv) ran adsutil.vbs to set W3SVC/1/CreateCGIWithNewConsole 1
v) ran adsutil.vbs to set W3SVC/AllowPathinfoforScriptMappings TRUE
vi) removed the service pack 6a to go back to service pack 5.
vii) Tried it on a completely different NT 4 server running service
pack 6a and IIS4.
Ive tried all the above steps including restarts of the server after
each step and in various combinations aswell but still no luck.
Please can you help?
please email me directly. Thanks.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 17 Aug 2000 17:34:25 +0200
From: tony@svanstrom.com (Tony L. Svanstrom)
Subject: Re: lucky7.to - What a lucky Free URL Redirection Service!
Message-Id: <1efiky7.16r312y1p9xlkgN%tony@svanstrom.com>
Christine <kittychim@sinagirl.com> wrote:
> lucky7.to - What a lucky Free URL Redirection Service!
>
> If the URL of your homepage is too long and too complex,
> e.g. www.free3hostingg.com/myaccount/index.html
> e.g. www.uuwaterlooooo.edu/cs/~tommy/index.html
>
> Instant Activiation!!!
> After signing up, you can have a free
> and a short URL and use it immediately as follow:
And since this has been done about a millon times using Perl it is very
much on topic in c.l.p.m... eh, NO!!!
/Tony
--
/\___/\ Who would you like to read your messages today? /\___/\
\_@ @_/ Protect your privacy: <http://www.pgpi.com/> \_@ @_/
--oOO-(_)-OOo---------------------------------------------oOO-(_)-OOo--
DSS: 0x9363F1DB, Fp: 6EA2 618F 6D21 91D3 2D82 78A6 647F F247 9363 F1DB
---ôôô---ôôô-----------------------------------------------ôôô---ôôô---
\O/ \O/ ©1999 <http://www.svanstrom.com/?ref=news> \O/ \O/
------------------------------
Date: Thu, 17 Aug 2000 11:29:27 -0400
From: David Coppit <newspost@coppit.org>
Subject: Re: LWP nukes user alarms?
Message-Id: <Pine.GSO.4.21.0008171117060.25107-100000@mamba.cs.Virginia.EDU>
On 17 Aug 2000, Gisle Aas wrote:
> David Coppit <newspost@coppit.org> writes:
>
> > I'd like to be able to put a time limit on my script, which is using LWP.
> > Unfortunately, it looks like LWP is using alarm() for its timeouts, which
> > is not interacting well with my alarms.
>
> LWP has not used alarm() since Dec 1997 (release 5.18), but LWP still use
> IO::Socket and some older versions of that module use alarm to timeout
> connect. Make sure you have IO-1.20 and things should be ok.
I have IO-1.20. Actually, it seems like the script has two nondeterministic
failure modes: either it ignores my alarm, or the HTTP request aborts as
though its timeout value was equal to my alarm.
When I run this script:
------------ SNIP ------------
$SIG{ALRM} = sub { die "timeout" };
sub lwp
{
use LWP::UserAgent;
$ua = new LWP::UserAgent;
my $req = new HTTP::Request GET => 'http://www.perl.com/';
$starttime = time;
my $res = $ua->request($req);
$endtime = time;
print "Length of fetched content is: ", length $res->content, "\n";
print "Time to fetch is: ", $endtime - $starttime, "\n";
}
# ----------
# Test timeouts with LWP
eval
{
alarm(1);
lwp();
alarm(0);
};
print "LWP Timed out!\n" if $@ =~ /timeout/;
# ----------
# Test timeouts with counting loop
eval
{
alarm(1);
for ($i = 0; $i < 10000000;$i++){}
alarm(0);
};
print "Counter Timed out!\n" if $@ =~ /timeout/;
------------ SNIP ------------
I get
Length of fetched content is: 27842
Time to fetch is: 3
Counter Timed out!
indicating that my 1 second timeout is not working with LWP, but that it is
working with a simple counter. On a different run with the same code I got a
content length of 0 fairly quickly, which made it seem that LWP was timing out
after 1 second. (But I can't convince the code to do this reliably.)
Regards,
David
------------------------------
Date: Thu, 17 Aug 2000 16:10:14 GMT
From: DM <drawbridge@home.com>
Subject: Re: ODBC question
Message-Id: <399C0EAB.19456FDA@home.com>
Henry,
Thanks for the link. The DSN however is not the problem. The error
occurs before
the DSN is even used. I'm including the line numbers in the code below:
---then inside of engine4.pl---
15
16 use Win32::ODBC;
17
18 $db = new Win32::ODBC("DSN=name;;;")
19 or die Win32::ODBC::Error();
---then inside of ODBC.pm---
25
26 require Exporter;
27
---then inside of Exporter.pm---
--- Error
Missing $ on loop variable at C:\perl\lib/Exporter.pm line 40. BEGIN
failed--compilation
aborted at C:\Inetpub\wwwroot\cgi-bin\engine4.pl line 16.
--- Error
The program never makes it past line 16 in the script. Any ideas?
Again, thanks for your input and help.
___James
Henry Hartley wrote:
> You've been there but did you read the FAQ
> <http://www.roth.net/perl/odbc/faq/>? See:
>
> "I can access my DSN from a command line but not from my Web Server."
>
> > Error:
> > Missing $ on loop variable at C:\perl\lib/Exporter.pm line 40. BEGIN
> > failed--compilation aborted at C:\Inetpub\wwwroot\cgi-bin\engine6.pl
> >
> > I am having trouble figuring out exactly what the error is because
> > Exporter.pm is not commented. I am assuming certian variables needed
> > are not being passed to the module. Hopefully soeone can provide some
> > helpful advise.
>
> Well, you didn't mention Exporter.pm in your original post. You just
> asked how to install ODBC.pm so it's not too surprising you just got
> pointed to the ODBC.pm documentation which has all the installation
> instructions I ever needed. At least read that FAQ mentioned above and
> ensure that's not your problem. Then, come back with more info and I'll
> see what I can do.
>
> Henry Hartley
------------------------------
Date: Thu, 17 Aug 2000 18:35:58 +0000
From: "Mark Wrangham" <aca97mpw@sheffield.ac.uk>
Subject: Open a new process for read AND write
Message-Id: <8nh818$am8$1@bignews.shef.ac.uk>
Hi all
I'm trying to use perl to automate my telnet sessions. I want to be able
to tie both <STDIN> and
<STDOUT> of the telnet process to file handles.
I know that open(TELNET_SEND "| telnet server.co.uk 110") will connect
the STDIN and open(TELNET_RECV "telnet server.co.uk 110") will connect the
STDOUT but how do I connect both. Hint: I cant use these two commands
becuase perl then starts two independant telnet sessions
I have tried using open(TELNET_SEND "| telent server.co.uk 110 >
~/telnet.temp") to connect the output of the telnet to a file then
open(TELNET_RECV "~/telnet.temp") to read from the file but this
introduces more issues involving timing
Thanks in advance for any help
Mark Wrangham
--
Bumper Sticker: My other car is a cdr
------------------------------
Date: Thu, 17 Aug 2000 13:07:10 -0400
From: "Alex T." <samara_biz@hotmail.com>
Subject: Out of memory! error. Working with arrays...
Message-Id: <399C1BBE.1E5DB6EA@hotmail.com>
Hi,
I'm writing a program for generating custom mailing lists from a flat
file database. Mailing lists are generated with the help of codes
describing the type of the address. My flat file database is about 500
kb and holds about 3,000 records 256 characters each. After I read
records from this database into an array of records, I have to sort
them. But when I try to run my program I get "Out of memory!" message.
I'm running Windows NT 4.0 with 160 MB of RAM. The maximum paging file
size is set up to 300 MB. Below are the relevant parts of my Perl
program:
-----------------------------------------------------------
...
#read the source file
open(SOURCE, "c:\\$ARGV[0]") || die "$!";
my @all_lines = <SOURCE>;
close(SOURCE);
...
#create an array to hold records
my @database;
...
foreach my $line (@all_lines){
chomp( $line );
...
#create a record
my $record = { "Firstname" => $firstname,
"Lastname" => $lastname,
"Address" => $address };
push(@database, $record);
} #foreach
------------------------------------------------------------
When I try to run sort function:
@database = sort{ %{$database[$a]}->{Address} cmp
%{$database[$b]}->{Address} } @database;
or just save the content of the @database into a flat file:
foreach my $index (@database){
print TARGET %{$database[$index]}->{Address}."\n";
} #foreach
I get "Out of memory!" error message.
Does anyone know what the problem is? Is it a Perl limitation that I can
not work with arrays, which exceed a certain size?
I seached for an answer in the PerlFaq, but I didn't see anything
relevant to my problem. Can anyone help me?
Thank you!
Alex
------------------------------
Date: Thu, 17 Aug 2000 15:13:38 GMT
From: hiroshiishii@my-deja.com
Subject: Output to printer in Win NT
Message-Id: <8ngvee$vna$1@nnrp1.deja.com>
Hi All:
Would someone give an advice on how to print an ASCII string, "Hello
world," to LaserJet4, which is on local parallel port (LPT1:), from
WinNT or 98?
I am using ActivePerl5.0.
Thank you.
-Hiroshi
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 17 Aug 2000 08:15:56 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: perl 5.6
Message-Id: <m18ztvq5oz.fsf@halfdome.holdit.com>
>>>>> "Alex" == Alex Buell <alex.buell@tahallah.clara.co.uk> writes:
Alex> I'm interested in knowing if one can run two different versions of
Alex> Perl on the same box, in a similar way to how GCC handles things.
Depends on what you consider "similar". You can certainly change the
-Dprefix=/what/ever during the Configure run, putting the entire
installation into a different directory. You then use
/what/ever/bin/perl for that version, and /usr/bin/perl for the other
one. I do that all the time.
--
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: 17 Aug 2000 17:18:30 GMT
From: abigail@foad.org (Abigail)
Subject: Re: perl 5.6
Message-Id: <slrn8po7i2.tj3.abigail@alexandra.foad.org>
dwb1@home.com (dwb1@home.com) wrote on MMDXLII September MCMXCIII in
<URL:news:Pine.LNX.4.20.0008160554320.9939-100000@ethyl.addictmud.org>:
}}
}} Hello,
}}
}} I'm about to upgrade some servers from perl 5.005_03 to 5.6. I'm
}} wondering if there are any traps I should watch out for. We have
}} an aweful lot of source code written in perl, (near 200000 lines
}} of code), so I'm naturally concerned.
*Blink*
You're about to do an upgrade of an production environment, and your
idea of regression testing is to ask on Usenet?
That's why you hava a test environment, and regression test, right?
Abigail
--
perl -we '$@="\145\143\150\157\040\042\112\165\163\164\040\141\156\157\164".
"\150\145\162\040\120\145\162\154\040\110\141\143\153\145\162".
"\042\040\076\040\057\144\145\166\057\164\164\171";`$@`'
------------------------------
Date: 17 Aug 2000 17:19:19 GMT
From: abigail@foad.org (Abigail)
Subject: Re: perl 5.6
Message-Id: <slrn8po7jj.tj3.abigail@alexandra.foad.org>
Eric Bohlman (ebohlman@netcom.com) wrote on MMDXLIII September MCMXCIII
in <URL:news:8nfubd$kgj$2@slb3.atl.mindspring.net>:
|| Gwyn Judd (tjla@guvfybir.qlaqaf.bet) wrote:
|| : err...I mean...Of course it should just work :) Actually I think you
|| : might like to hold off till 5.6.1 is released.
||
|| I think you mean 5.6.2. Under the new numbering scheme, odd-numbered
|| releases are developmental versions and even-numbered ones are production
|| versions.
But 6 is even....
Abigail
--
sub f{sprintf'%c%s',$_[0],$_[1]}print f(74,f(117,f(115,f(116,f(32,f(97,
f(110,f(111,f(116,f(104,f(0x65,f(114,f(32,f(80,f(101,f(114,f(0x6c,f(32,
f(0x48,f(97,f(99,f(107,f(101,f(114,f(10,q ff)))))))))))))))))))))))))
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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 V9 Issue 4046
**************************************