[16085] in Perl-Users-Digest
Perl-Users Digest, Issue: 3497 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 28 06:05:37 2000
Date: Wed, 28 Jun 2000 03:05:14 -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: <962186714-v9-i3497@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 28 Jun 2000 Volume: 9 Number: 3497
Today's topics:
Re: Abigail's date line <blah@nospam.com>
about time out! <chkwok@unitechnetworks.com>
Re: attach file in e-mail <andre@UltraShell.Net>
Cant get perl cgi result (directly..) omtslug@my-deja.com
Defining regular expression char class netunl@my-deja.com
different behaviour when running from web and command l (Shao Zhang)
Re: Embedding images into Perl script <vlad@soft-tronik.ru>
Re: Embedding images into Perl script <news@webneeds.com>
File upload output <staceysmithNOstSPAM@legaljargon.com.invalid>
Re: File upload output <news@webneeds.com>
Re: Finding the directory of the current script <sami.maki@nokia.com>
Golf problem <hump@katz.cc.univie.ac.at>
How can I use perl to print $ in a string? <chenshaohong@sim.edu.sg>
How to access all the files in a dir including its sub <abuse@localhost>
Re: How to access all the files in a dir including its <news@webneeds.com>
Re: How to access all the files in a dir including its (A.J. Norman)
How to change Solaris user password alexyuen2092@my-deja.com
how to count number of line in a file ? tvn007@my-deja.com
Re: how to count number of line in a file ? amitr@w-o-i.com
Re: how to count number of line in a file ? <bill.kemp@wire2.com>
Re: how to count number of line in a file ? <news@webneeds.com>
Re: how to count number of line in a file ? amitr@w-o-i.com
Re: How to test for file? <Peter.Dintelmann@dresdner-bank.com>
Re: Image size change by Perl <dennis@osiris.gt.owl.de>
Lots of soft from NORMAN!! cdsimpl_2000@my-deja.com
Re: LWP::UserAgent blocking problem <gisle@ActiveState.com>
Re: module return value <news@webneeds.com>
NetSSLeay Help <rob9428@swbell.net>
Re: newbie REGEX problem <nnickee@nnickee.com>
Re: newbie REGEX problem <uri@sysarch.com>
Re: Oracle minimum install for perl DBI on Linux <thunderbear@bigfoot.com>
Re: Perl and Sockets <dennis@osiris.gt.owl.de>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 28 Jun 2000 11:19:40 +0200
From: Marco Natoni <blah@nospam.com>
Subject: Re: Abigail's date line
Message-Id: <3959C32B.91DC8AF7@nospam.com>
Craig,
Craig Berry wrote:
> In Ye Olden Days of the Net, most net.newbies found their way
> online by virtue of attending college and being given a
> Usenet-capable account by the school. As a result, each
> September, the net would be inundated with the usual
> newbie foolishness, misbehavior, and occasional active evil. Within
> a month or two things would settle down again.
Very similar to what happened in Christmas time on Fidonet, when guys
got money to buy a modem and came in the conference world... ;)
Best regards,
Marco
------------------------------
Date: Wed, 28 Jun 2000 17:46:52 +0800
From: "Kwok Chi Hang" <chkwok@unitechnetworks.com>
Subject: about time out!
Message-Id: <3959c940$1@newsgate.hknet.com>
I want my CGI script can do something when user does not click the submit
button in the form for 2 hours. How can I do it?
Thanks
------------------------------
Date: Wed, 28 Jun 2000 09:40:12 GMT
From: Andre van Straaten <andre@UltraShell.Net>
Subject: Re: attach file in e-mail
Message-Id: <0Kj65.15502$l_1.339762@news-east.usenetserver.com>
JL <ltlau@yahoo.com> wrote:
> Hi,
> Can anyone tell me how to use perl to attach file like using e-mail in
> yahoo/hotmail?
> Thanks alot.
On my Web site are mail examples. Go "scripting".
-- avs
Andre van Straaten
http://www.vanstraatensoft.com
______________________________________________
flames please to /dev/null@vanstraatensoft.com
------------------------------
Date: Wed, 28 Jun 2000 06:55:00 GMT
From: omtslug@my-deja.com
Subject: Cant get perl cgi result (directly..)
Message-Id: <8jc7g0$ne6$1@nnrp1.deja.com>
Hi! I'm stuck with my perl cgi script which creates a
bash file (variabel setup and source of other scripts) and
then executing it.
I don't get my html response until the script finishes which
might be up to 1 hour..
I've made stdout unbuffered but it still doesn't work.
I also got the suggestion to close stdout which then delivers
the browser output directly but I don't get any logging from
my executed script to it's logfile.
I don't know if this is a perl or apache problem and I can't
get this to work.
All tips appreciated.
Running Apache 1.3.12 on NT4, perl 5.004_02.
BR
Stefan
ps. You get the same result just doing a sleep instead
of the exec. ds
Here's some code:
#------------------------------------------------------------
#!/usr/bin/Perl -w
$forminfo = <STDIN>;
$formpure = $forminfo;
$forminfo =~ s/&/\n/g;
[snip] here I get some vars from the form
($a,$a,$a,$mday,$mon,$a,$a,$a,$a) = localtime;
$buildfile="bs_".sprintf("%02d%02d%d", $mon+1, $mday, time);
select(STDERR); $| = 1;
select(STDOUT); $| = 1;
print "Content-type: text/html \n\n";
print "<html><head>";
print "<title>Build Confirm</title>";
print "</head>";
print "<body bgcolor=lightblue>";
print "Thank you! Your input has been processed and the kit<br>";
print "build is started. Your build id is: ".$buildfile;
print "<p>Links to your setup file and log file:<br>";
print "<a href=/buildset/".$buildfile.".sh>".$buildfile.".sh<br>";
print "<a href=/buildset/".$buildfile.".log>".$buildfile.".log</p>";
print "</body></html>";
print "\n\n";
print "\015\012"; #nothing helps...
[snip] Here I generate the bash shell file (buildfile.sh)
# force the server to deliver the content.........
#close(STDOUT); #close(STDERR); # this kills my buildfile.sh
output below!!
exec "/Cygnus/cygwin-b20/H-i586-
cygwin32/bin/bash.exe ".$buildsetupdir."/".$buildfile.".sh
> ".$buildsetupdir."/".$buildfile.".log 2>&1";
exit(0);
#------------------------------------------------------
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 28 Jun 2000 07:41:20 GMT
From: netunl@my-deja.com
Subject: Defining regular expression char class
Message-Id: <8jca6u$q56$1@nnrp1.deja.com>
Hi,
I want to define a character class that only contains
chars like ()\{}.><....
I tried to do it like this, but it doesn't work:
$chars=~s/[\W[^\s]]/TEST/g; # no word and no whitespace
Thanks,
Kai
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 28 Jun 2000 18:16:02 +1000
From: shao@linux.cia.com.au (Shao Zhang)
Subject: different behaviour when running from web and command line
Message-Id: <3959b442@news>
Hi,
I have wrote a simple perl script that basically does a query from a
website, however, it only works when run from command line, not
from the web...
Here is the code:
print "<h3>looking up aunic for $domain ...</h3>\n";
@a = `/bin/echo \"domain-name=$domain&html-form=yes\" | /usr/bin/lynx \
-post_data -dump \"http://aunic.telstra.net/cgi-bin/namestatus.pl \"`;
print "<h1> BEGIN debugging... </h1>\n";
print "<PRE>\n";
print @a;
print "</PRE>\n";
print "<h1> END debugging... </h1>\n";
When run from the command line, everything works, when run from the web,
@a is empty. I am using perl5.005
Thanks for any help in advance.
Regards,
Shao.
--
____________________________________________________________________________
Shao Zhang - Running Debian 2.1 ___ _ _____
Department of Communications / __| |_ __ _ ___ |_ / |_ __ _ _ _ __ _
University of New South Wales \__ \ ' \/ _` / _ \ / /| ' \/ _` | ' \/ _` |
Sydney, Australia |___/_||_\__,_\___/ /___|_||_\__,_|_||_\__, |
Email: shao@cia.com.au |___/
_____________________________________________________________________________
------------------------------
Date: Wed, 28 Jun 2000 12:09:51 +0400
From: "Vladimir Rybintsev" <vlad@soft-tronik.ru>
Subject: Re: Embedding images into Perl script
Message-Id: <8jcbmg$2e4b$1@storm.comstar.ru>
No, image src is contents of Perl variable,
not image file name or location path.
And it works.
Dan Manion <news@webneeds.com> wrote
> I think what your subject should read is "Embedding images into HTML".
>
> The <img> in html is simply a link to a server location where the browser
> should connect and pull down an image. Yes you can have perl kick out an
> image .. but that has nothing to do with an HTML image tag.
>
> You could have <img src="/path/to/a/perlfile.cgi">
>
> and that perlfile could spit out an image.
>
> Ex.
> print "Content-type: image/gif\n\n";
> print $fG; # assuming $fG is the image file in your example
>
------------------------------
Date: Wed, 28 Jun 2000 02:31:13 -0600
From: "Dan Manion" <news@webneeds.com>
Subject: Re: Embedding images into Perl script
Message-Id: <Qrk65.77$lF.22705@news.uswest.net>
Umm read the original posted question and proposed solution. Yes perl can
store the actual image in the code .. but it cannot be used how it was
trying to be applied.
<img src="/path"> <<== works
<img src="byte code of an image"> <<== does not work
Thats just how HTML is!
What does work is in my reply to the first message.
This has nothing to do with html
"Vladimir Rybintsev" <vlad@soft-tronik.ru> wrote in message
news:8jcbmg$2e4b$1@storm.comstar.ru...
> No, image src is contents of Perl variable,
> not image file name or location path.
> And it works.
>
> Dan Manion <news@webneeds.com> wrote
> > I think what your subject should read is "Embedding images into HTML".
> >
> > The <img> in html is simply a link to a server location where the
browser
> > should connect and pull down an image. Yes you can have perl kick out
an
> > image .. but that has nothing to do with an HTML image tag.
> >
> > You could have <img src="/path/to/a/perlfile.cgi">
> >
> > and that perlfile could spit out an image.
> >
> > Ex.
> > print "Content-type: image/gif\n\n";
> > print $fG; # assuming $fG is the image file in your example
> >
>
>
------------------------------
Date: Wed, 28 Jun 2000 00:00:39 -0700
From: stacey843 <staceysmithNOstSPAM@legaljargon.com.invalid>
Subject: File upload output
Message-Id: <08335b66.3ba10369@usw-ex0106-048.remarq.com>
I have a subroutine &html_output.
&html_output correctly outputs html code
to the browser.
I am using subroutine &file_maker to
create a file (LOG) and and write to it.
And I want to write the html output of
&html_output to the new file so I can
create it in my directory.
Here is my code &file_maker:
#######------ Start file_maker sub ----#########
sub file_maker {
$x = &html_output;
open (LOG, ">C:/cheapfree/newfile.html")||&ErrorMessage;
print LOG "$x"; #i have tried [print LOG &html_output;]
close (LOG);
} #End file_maker
It creates the file newfile.html, but
will not write in the contents of
&html_output.
thanks
* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!
------------------------------
Date: Wed, 28 Jun 2000 01:33:41 -0600
From: "Dan Manion" <news@webneeds.com>
Subject: Re: File upload output
Message-Id: <UBj65.36$lF.8732@news.uswest.net>
Both:
print LOG &html_output; #AND
the way you are doing it in your example:
print LOG "$x";
*should* work.
Which leads me to believe that if it is not, it is because you have an error
in your &html_output.
The return value of that function should be the data that you want to be
printed in the line .. ex.
sub html_output {
return <<"CHUNKOHTML";
<br>testing
<hr>one
CHUNKOHTML
}
Read up on perldoc -f print for more info. Hope this helps!
"stacey843" <staceysmithNOstSPAM@legaljargon.com.invalid> wrote in message
news:08335b66.3ba10369@usw-ex0106-048.remarq.com...
> I have a subroutine &html_output.
>
> &html_output correctly outputs html code
> to the browser.
>
> I am using subroutine &file_maker to
> create a file (LOG) and and write to it.
> And I want to write the html output of
> &html_output to the new file so I can
> create it in my directory.
>
> Here is my code &file_maker:
> #######------ Start file_maker sub ----#########
> sub file_maker {
> $x = &html_output;
> open (LOG, ">C:/cheapfree/newfile.html")||&ErrorMessage;
> print LOG "$x"; #i have tried [print LOG &html_output;]
> close (LOG);
>
> } #End file_maker
>
>
> It creates the file newfile.html, but
> will not write in the contents of
> &html_output.
>
> thanks
>
>
>
> * Sent from RemarQ http://www.remarq.com The Internet's Discussion Network
*
> The fastest and easiest way to search and participate in Usenet - Free!
>
------------------------------
Date: Wed, 28 Jun 2000 05:52:25 GMT
From: "Sami Maki" <sami.maki@nokia.com>
Subject: Re: Finding the directory of the current script
Message-Id: <tog65.4226$AM5.52548@news1.nokia.com>
To get path of current working directory..
use Cwd;
print cwd();
BR, Sami
conic@bigpond.com wrote in message <8jbi4t$94r$1@nnrp1.deja.com>...
>Is there a way for a script to realise what directory it is in? I want
>to examine files that are in the same directory as the script, but also
>to be able to move the script to any directory without changing it.
>
>
>Sent via Deja.com http://www.deja.com/
>Before you buy.
------------------------------
Date: 28 Jun 2000 09:34:14 GMT
From: Peter Marksteiner <hump@katz.cc.univie.ac.at>
Subject: Golf problem
Message-Id: <8jcgqm$29vm$1@www.univie.ac.at>
Suppose you want to find words with exactly ten non-repeating letters such
as "binoculars", "fishmonger", or "paintbrush", suitable for games or simple
encryption of numbers where every decimal digit is represented by a letter.
I've tried to write the shortest possible Perl program to extract
such words from a wordlist and have found the following two solutions:
perl -pe '%c=();length==11&!grep{$c{$_}++}split""or$_=""' /usr/dict/words
perl -pe '$_=""if(keys%{{map{$_,1}split""}})*length!=121' /usr/dict/words
Is there anybody who can do it with fewer keystrokes?
Peter
--
Peter Marksteiner
Vienna University Computer Center
------------------------------
Date: Wed, 28 Jun 2000 17:57:46 +0800
From: "shaohong" <chenshaohong@sim.edu.sg>
Subject: How can I use perl to print $ in a string?
Message-Id: <8jchql$9mt$1@newton3.pacific.net.sg>
Hi,
Since $ is a reserve character in Perl. If I want to print $ in a string,
for example I want to print " Total amount is S$100", I only get the result
"Total amount is S", $100 is missing!
Need your help. Thanks.
shaohong
------------------------------
Date: Wed, 28 Jun 2000 14:16:37 +0800
From: "multiplexor" <abuse@localhost>
Subject: How to access all the files in a dir including its sub dir?
Message-Id: <8jc4pm$1j053@imsp212.netvigator.com>
For example, print the name of all files in a dir and its sub like the
command in M$ DOS: dir *.* /s
I heard that it needs recursive function. Can you give me a hint or point me
to a source?
Thanks.
------------------------------
Date: Wed, 28 Jun 2000 02:04:55 -0600
From: "Dan Manion" <news@webneeds.com>
Subject: Re: How to access all the files in a dir including its sub dir?
Message-Id: <a3k65.69$lF.17162@news.uswest.net>
So where is your perl question?
The unix "ls" command has recursive support .. ls -R /path/to/dir works but
you sould really be looking for that kind of support in a unix newsgroup.
If you are looking to create a program in perl that does what you are
looking for, refer to
perldoc -f readdir
for more info that can get you started.
"multiplexor" <abuse@localhost> wrote in message
news:8jc4pm$1j053@imsp212.netvigator.com...
> For example, print the name of all files in a dir and its sub like the
> command in M$ DOS: dir *.* /s
> I heard that it needs recursive function. Can you give me a hint or point
me
> to a source?
>
> Thanks.
>
>
>
------------------------------
Date: 28 Jun 2000 09:45:03 +0100
From: nja@le.ac.uk (A.J. Norman)
Subject: Re: How to access all the files in a dir including its sub dir?
Message-Id: <8jcduf$1kp8@harrier.le.ac.uk>
In article <8jc4pm$1j053@imsp212.netvigator.com>,
multiplexor <abuse@localhost> wrote:
>For example, print the name of all files in a dir and its sub like the
>command in M$ DOS: dir *.* /s
>I heard that it needs recursive function. Can you give me a hint or point me
>to a source?
Look at the script below. The show_files() function is called
recursively whenever it finds a directory.
use strict;
my $indent = "";
show_files();
exit;
sub show_files()
{
$indent .= " ";
foreach my $file (<*>)
{
print "$indent$file\n";
if (-d $file)
{
chdir $file;
show_files();
chdir "..";
}
}
chop $indent;
}
--
Andrew Norman, Leicester, England
nja@le.ac.uk || andrew.norman@le.ac.uk
http://www.le.ac.uk/engineering/nja/
------------------------------
Date: Wed, 28 Jun 2000 09:15:24 GMT
From: alexyuen2092@my-deja.com
Subject: How to change Solaris user password
Message-Id: <8jcfn3$tmk$1@nnrp1.deja.com>
Hiya,
I am working with Netscape Enterprise Server and would like to
implement some forms of security with Solaris Build-in security.
However, I would like if there's any programs/scripts that allow user
to change their own password in Solaris.
Any lights is greatly appreciated.
Best regards,
Alex Yuen
P.S. please email me at alexyuen2092@my-deja.com as I could not do
frequent access to this newsgroup.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 28 Jun 2000 06:32:22 GMT
From: tvn007@my-deja.com
Subject: how to count number of line in a file ?
Message-Id: <8jc65m$mlq$1@nnrp1.deja.com>
Hi,
I have a lot of files in a directory and would like to
count how many line each file has. These files might
be very large, therefore I would not want to put it in an array.
Would someone please help me the best way to count
the number of lines in a file ?
Thanks in advance for any help,
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 28 Jun 2000 07:10:47 GMT
From: amitr@w-o-i.com
Subject: Re: how to count number of line in a file ?
Message-Id: <8jc8dg$o69$1@nnrp1.deja.com>
hi,
> Would someone please help me the best way to count
> the number of lines in a file ?
I think you can do it in the following way,
my $no_of_lines = `wc -l "$path/$filename" | awk '{ print $1 }'`;
bye
Amit
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 28 Jun 2000 08:44:02 +0100
From: "W Kemp" <bill.kemp@wire2.com>
Subject: Re: how to count number of line in a file ?
Message-Id: <962178370.20899.0.nnrp-01.c3ad6973@news.demon.co.uk>
amitr@w-o-i.com wrote in message <8jc8dg$o69$1@nnrp1.deja.com>...
>hi,
>
>> Would someone please help me the best way to count
>> the number of lines in a file ?
>
>I think you can do it in the following way,
>
>my $no_of_lines = `wc -l "$path/$filename" | awk '{ print $1 }'`;
>
Not very cross platform.
I am suggesting the following _because_ it looks inefficient.
Any comments?
open a FILE, then:-
$i=0;
while(<FILE>){$i++}
------------------------------
Date: Wed, 28 Jun 2000 01:58:49 -0600
From: "Dan Manion" <news@webneeds.com>
Subject: Re: how to count number of line in a file ?
Message-Id: <sZj65.67$lF.15747@news.uswest.net>
If you are wanting to open the files anyways you can count them easily like
this:
open (FILE, "bigassfile") || die "open error: $!";
print scalar @{[ <FILE> ]};
close (FILE);
but like you said this is gonna get you into trouble once you are dealing
with very large files.
man wc should get you on the right track for large files though.
<tvn007@my-deja.com> wrote in message news:8jc65m$mlq$1@nnrp1.deja.com...
> Hi,
>
> I have a lot of files in a directory and would like to
> count how many line each file has. These files might
> be very large, therefore I would not want to put it in an array.
>
> Would someone please help me the best way to count
> the number of lines in a file ?
>
>
> Thanks in advance for any help,
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
------------------------------
Date: Wed, 28 Jun 2000 08:22:58 GMT
From: amitr@w-o-i.com
Subject: Re: how to count number of line in a file ?
Message-Id: <8jcckn$rn2$1@nnrp1.deja.com>
In article <962178370.20899.0.nnrp-01.c3ad6973@news.demon.co.uk>,
"W Kemp" <bill.kemp@wire2.com> wrote:
>
> amitr@w-o-i.com wrote in message <8jc8dg$o69$1@nnrp1.deja.com>...
> >hi,
> >
> >> Would someone please help me the best way to count
> >> the number of lines in a file ?
> >
> >I think you can do it in the following way,
> >
> >my $no_of_lines = `wc -l "$path/$filename" | awk '{ print $1 }'`;
> >
> Not very cross platform.
>
> I am suggesting the following _because_ it looks inefficient.
> Any comments?
>
> open a FILE, then:-
>
> $i=0;
> while(<FILE>){$i++}
I know what I had suggested is "Not very cross platform".
But the person, already telling that he is dealing with a large files.
I think opening a file, counting the lines in a loop should take some
time. It wont be a good idea afterall.
So,
if he is using unix(like) system he should go for what I have suggested.
what say?
Amit
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 28 Jun 2000 10:42:07 +0200
From: "Dr. Peter Dintelmann" <Peter.Dintelmann@dresdner-bank.com>
Subject: Re: How to test for file?
Message-Id: <8jcdnn$7n55@intranews.dresdnerbank.de>
Hi,
Don Smith schrieb in Nachricht <8jajkj$14hb$1@thoth.cts.com>...
>I have a Solaris 7 system for our Intranet, and an NT system for the audio
>server.
--snip--
>The script first does a test to see if there is any audio being sent, if
>not, a message displays that says "No meetings at this time"
>The problem I'm having is, I don't know how to make the perl script test
for
>the audio server file on the NT system.
--snip--
>if (-e "file://Audio/stream/Station1.asx") {
well the problem is: You need to check from a Solaris machine
for the existence of a file on a NT box.
You can only check for the existence of a file if you have
(somehow) access to the file system of your NT box. A link
like file://.... does not do this. I t is intended to tell a client
(browser)
where to look for additional information.
There are several ways to check for the existence of your files:
a) Use a smb client (contained in the solaris samba package)
to connect from unix to nt and share the directory on your nt box.
b) use nfs for nt instead.
c) use ftp for communication (ftp server on nt).
d) write your own client and server...
You can even do it the other way round with the nt box being the
client telling the unix box when files are available...
Good luck ;-)
Best regards,
Peter Dintelmann
------------------------------
Date: 27 Jun 2000 18:33:44 GMT
From: Dennis Wetzig <dennis@osiris.gt.owl.de>
Subject: Re: Image size change by Perl
Message-Id: <fwtsw9.3lw@osiris.gt.owl.de>
Lucas Tsoi <lucas@cplhk.com> wrote:
> Hi
> I am to ask that could I change the image size by Perl,
> i.e. from high pixel values to low pixel values?
You may want to have a look at the ImageMagic module.
Hth,
--
- Dennis
--------
Dennis Wetzig - dennis@osiris.gt.owl.de
------------------------------
Date: Wed, 28 Jun 2000 09:00:56 GMT
From: cdsimpl_2000@my-deja.com
Subject: Lots of soft from NORMAN!!
Message-Id: <8jces2$t1e$1@nnrp1.deja.com>
Lots of soft from NORMAN!!
AUTOCAD 2000 ON 2 CD'S
and other soft
NORMAN
pls contact me:
cdsimpl@mailcity.com
nor11@fcamil.com
cdsimpl@angelfire.com
If you should lost me please send faxmessage to:
Fax: + 442076917580 (UK)
Fax: + 493069088166 (Germany)
Fax: + 18883572558 (USA)
Fax: + 61294750241 (Sydney)
Do not hesitate to contact me anytime:
Norman Tel: + 370 8977935
ICQ: 59912397
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 28 Jun 2000 09:09:45 +0200
From: Gisle Aas <gisle@ActiveState.com>
Subject: Re: LWP::UserAgent blocking problem
Message-Id: <m3g0pyqo1y.fsf@eik.g.aas.no>
Kostis <ke77le@my-deja.com> writes:
> I'm writing a little app which retrieves data from a web server and
> I've decided to use the CPAN modules which seem to work fine apart from
> a little problem...
>
> The problem is that if the webserver I'm trying to connect to is down
> the part of the code that actually make the request i.e.:
>
> my $response = $ua->request($request);
>
> blocks for ages!!!
>
> I tried calling:
> $ua->timeout(60);
>
> But this didn't seem to have any effect.
If you are not using perl-5.6.0, you might need to upgrade your IO
modules to version 1.20 get connect timeout to work.
> I'm pretty sure (* see note below) the underlying code found in the
> UserAgent module blocks when it tries to connect to the server (if the
> server is down) but I don't know how to solve this.
>
>
> Can anyone help?
>
> Maky Thanks,
> Kostas
>
> * I think the strace I did proves this:
> connect(10, {sin_family=AF_INET, sin_port=htons(80), sin_addr=inet_addr
> ("some.ip.add.ress")}, 16
And what happens after 60 seconds? alarm?
--
Gisle Aas
------------------------------
Date: Wed, 28 Jun 2000 02:20:55 -0600
From: "Dan Manion" <news@webneeds.com>
Subject: Re: module return value
Message-Id: <fik65.74$lF.20510@news.uswest.net>
A perl module *must* return true at compile time or it will die a horrible
death, well atleast croak on you. A "1;" at the end of the script returns
true to the original program that is calling that module.
"man perlmod" will give you all sorts of helpful information on this topic.
Hope this helps!
"* Tong *" <sun_tong_001@yahoo.com> wrote in message
news:sa81z1i322y.fsf@sun_tong_001.personal.yahoo.com...
> Hi,
>
> I saw many modules end with "1;". Is that the return value for the
> module?
>
> When I checked the template provided in perlmod, I found no such
> return values. So, do I need it?
>
> BTW, the END {} section of the module, is it executed just before
> program is closed?
>
> thanks
>
> --
> Tong (remove underscore(s) to reply)
> http://members.xoom.com/suntong001/
> - All free contribution & collection & music from the heavens
>
------------------------------
Date: Wed, 28 Jun 2000 01:34:50 -0500
From: "Rob" <rob9428@swbell.net>
Subject: NetSSLeay Help
Message-Id: <t3h65.583$Gv1.103338@nnrp3.sbc.net>
ok another quick question. I got the OpenSSL Libraries compiled, is there a
certain location they are supposed to be? I'm running a NT system. OK the
main question, I still have to install the module for NetSSLeay. I attempt
to do a makefile on it and it searches for openssl but is unable to locate
it in the path I set. Which of course goes back to the first question on a
specific location.Help Please :0
Almost there by god......
Thanks
------------------------------
Date: Wed, 28 Jun 2000 00:00:34 -0500
From: Nnickee <nnickee@nnickee.com>
Subject: Re: newbie REGEX problem
Message-Id: <490DF13392548F55.DE2B3B6E6236B436.5BEA44848958E300@lp.airnews.net>
On Wed, 28 Jun 2000 03:38:29 GMT, someone claiming to be
kcivey@cpcug.org (Keith Calvert Ivey) said:
>Here's one rewrite:
> foreach (@array) {
> if (/stuff/) {
> my($out) = m#/(.*)\.#;
> print "$_ - $out\n";
> }
> }
and here's another:
foreach (@array) {
if ( /stuff/ && m#/(.*)\.# ) {
my $out = $1;
print "$_ - $out\n";
}
}
for giggles, I slapped mine into a sub and yours (Keith's) into
another sub and used Benchmark (timed them using $count = 500000) and
mine actually came out 2 wallclock seconds faster (I removed the print
statements from each of them first, of course).
My question now, why is Keith's better than mine? (I'm not arguing
the point, I really want to understand why his way is better than what
I came up with so I can learn...)
Nnickee
------------------------------
Date: Wed, 28 Jun 2000 05:27:29 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: newbie REGEX problem
Message-Id: <x7d7l2tlxc.fsf@home.sysarch.com>
>>>>> "N" == Nnickee <nnickee@nnickee.com> writes:
N> On Wed, 28 Jun 2000 03:38:29 GMT, someone claiming to be
N> kcivey@cpcug.org (Keith Calvert Ivey) said:
N> foreach (@array) {
N> if ( /stuff/ && m#/(.*)\.# ) {
N> my $out = $1;
N> print "$_ - $out\n";
N> }
N> }
/stuff/ && m#/(.*)\.# && print "$_ - $1\n" foreach @array ;
N> for giggles, I slapped mine into a sub and yours (Keith's) into
N> another sub and used Benchmark (timed them using $count = 500000) and
N> mine actually came out 2 wallclock seconds faster (I removed the print
N> statements from each of them first, of course).
learn to use the Benchmark.pm module. it is much more accurate than a
wall clock and a must have skill for any perl hacker.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Wed, 28 Jun 2000 09:47:27 +0200
From: =?iso-8859-1?Q?Thorbj=F8rn?= Ravn Andersen <thunderbear@bigfoot.com>
Subject: Re: Oracle minimum install for perl DBI on Linux
Message-Id: <3959AD8F.3ACAF911@bigfoot.com>
Kathryn Cassidy wrote:
>
> Hi all,
>
> I'm trying to set up a linux machine so that I can access a remote
> Oracle 8.0.5 server using DBD::Oracle. I don't want to have to install
> all of oracle on my machine, but I can't seem to find any reliable
> information about what files I need to copy over in order to get
> DBD::Oracle to compile. Any info I could find was about Oracle 7 and
> doesn't seem to apply. I've copied over just about all the files from
> the machine
> with Oracle installed on it, but I still can't get it to work.
>
> I just get the following when I run perl Makefile.PL
>
> The ORACLE_HOME environment variable must be set.
> It must be set to hold the path to an Oracle installation directory
> on this machine (or a compatible archtecture).
> See the README.clients file for more information.
>
> $ORACLE_HOME is set.
>
> Has anyone done this before? Can you let me know what files you
I recently compiled DBI::Oracle under Perl 5.6 under Solaris
with Oracle 8.1.6. You need a copy of rdbms and lib locally
(remember to install the demo stuff under rdbms since that
is apparently needed), and point ORACLE_HOME to the
directory containing them.
With that in place the installation went smooth.
--
Thorbjørn Ravn Andersen "...plus...Tubular Bells!"
http://bigfoot.com/~thunderbear
------------------------------
Date: 27 Jun 2000 18:54:22 GMT
From: Dennis Wetzig <dennis@osiris.gt.owl.de>
Subject: Re: Perl and Sockets
Message-Id: <fwttum.3sw@osiris.gt.owl.de>
valarkin@my-deja.com wrote:
> Hello Everyone,
> Here is a quick question. I have created a script in Perl *Dah I am
> asking questions in a Perl Forum *grins* * I use Sockets in it. I can
> connect to the server just fine. Here is what I must do, and the prob.
> Get the first four bytes of data from the server. Unpack the data into
> an int value and use that to receave the rest of the data. *hint it
> tells the length of the text to come*
> The code I have tried is bellow:
> sysread(SOCKET, $len, 4);
> $realNumber = int (unpack("S", $len));
> read(SOCKET, $motd, $realNumber);
> @lines = split(/\r/, $motd);
> foreach $line (@lines)
> {
> print "$line<p>";
> }
> close(SOCKET);
You don't want to mix up read()s and sysread()s. It is not a good idea
to use buffered and unbuffered I/O on the same handle.
Other than that: You do not have to use int().
Also make sure you know which byte order (host/network) the received
int is in.
--
- Dennis
--------
Dennis Wetzig - dennis@osiris.gt.owl.de
------------------------------
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 3497
**************************************