[15808] in Perl-Users-Digest
Perl-Users Digest, Issue: 3221 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 31 14:10:41 2000
Date: Wed, 31 May 2000 11:10:20 -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: <959796620-v9-i3221@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 31 May 2000 Volume: 9 Number: 3221
Today's topics:
Re: Please help me with this ONe? <apage.net[remove]@usa.net>
Re: Programming Perl Realtime ChatRoom <eae@eae.net>
Question about LWP::UserAgent? ()
Reference Sorting <skpurcell@hotmail.com>
Re: Reference Sorting nobull@mail.com
Re: Reference Sorting <makarand_kulkarni@My-Deja.com>
RFC: HTML templates and templates in general. <memmett@fraser.sfu.ca>
Re: runtime errors - Q how to do this <100115.1010@CompuServe.COM>
Re: simple regexp question <bg@skypoint.com>
Re: simple regexp question <bg@skypoint.com>
Re: simple regexp question (Abigail)
Re: socket : should I use 'print' to send data ? nobull@mail.com
Re: Strategies for determining if there's a memory leak (Ilya Zakharevich)
Timeout value in IO::Socket wingo01@my-deja.com
Re: Timeout value in IO::Socket nobull@mail.com
Re: Timeout value in IO::Socket <franl-removethis@world.omitthis.std.com>
Re: What do I need to write my first perl program?? <mark@sharewire.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 31 May 2000 13:49:56 -0400
From: "Zowwie" <apage.net[remove]@usa.net>
Subject: Re: Please help me with this ONe?
Message-Id: <sjak6b35pj123@corp.supernews.com>
"...now, i am porting it to windows environment."
One of the things that I have noticed with Perl/CGI under Linux and Windows
NT is the path statements.
Basically... Everything functions great under Linux, but NT is a whole
different beast at times.
Relational statements will function under Linux... But under NT try this:
$root_path=c:/web/cgi-bin
Then change anything that used to say ./ in Linux to $root_path/.....
Good luck!
"Chung Derek" <dchk_78NOdcSPAM@yahoo.com.invalid> wrote in message
news:0f380c77.9a20daea@usw-ex0106-046.remarq.com...
> i have programmed a perl script under unix emvironment.
>
> now, i am porting it to windows environment.
>
> the question?
>
> my previous script have some command suck as "unlink" to delete
> a specified file. do i need to change to (eg. del file.txt)?
> basically, my question is can are this command based from unix
> command , or perl? If the latter, can I assume the function can
> be used no matter where I port the script, right.
>
>
>
> this would really be a great help. thnaks
>
> * 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, 31 May 2000 17:07:19 +0200
From: "Emil A Eklund" <eae@eae.net>
Subject: Re: Programming Perl Realtime ChatRoom
Message-Id: <959785641.911938@news2.cybercity.dk>
Can be done using push, however for some reason ie doesn't support it, and
it takes a lot of bw from the server...
/Emil
Chung Derek <dchk_78NOdcSPAM@yahoo.com.invalid> wrote in message
news:01d04948.ee51cc45@usw-ex0106-046.remarq.com...
> i am interested in a Perl real-time chatroom.
>
> most of the example i see in the Internet uses the meta tage
> refresh, which is very unsightly. I also don't want to use java.
>
> just want to keep the connection alive, but without the
> intricacies of Socket programming. Can it be done, with using
> Perl strong text base foundation.
>
> Please give me a link , or better still the programming process
>
> * 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: 31 May 2000 17:47:19 GMT
From: rddliu@ms1.hinet.net ()
Subject: Question about LWP::UserAgent?
Message-Id: <8h3j77$6u9@netnews.hinet.net>
Dear all:
I want to simulate a browser.So I use the LWP::UserAgent module.
But this module only can simulate
1. User-Agent : like Mozilla/4.0 ...
2. Content-type : application/x-www-form-urlencoded
The question here is that" Can I simulate more ? "
Like
1. Accept: application/msword ,...
2. Accept-Language : en-us
3. Some or every variables in $ENV{$key}
Than you !!
Frank
------------------------------
Date: Wed, 31 May 2000 11:35:13 -0500
From: "spurcell" <skpurcell@hotmail.com>
Subject: Reference Sorting
Message-Id: <39353f45$0$16894@wodc7nh1.news.uu.net>
Hello,
I am working with references and need to do a sort on a array of hashes.
Here is what I have done. I created an array of hashes using
"autovivification"
$class->{'id'} = "someval";
$class->{'name'} = "someotherval";
on and on ...
push @classes, $class;
# then here is the second tricky part, I needed to send this array back, but
wanted to pass as reference.
# so I did this.
$classes = \@classes
# where I picked it up in another routine.
# so now I am trying to sort against the 'name' key of the array reference.
@names = sort { lc{$a->{'name'} cmp lc{$b->{'name'})) @{$class};
# but that sort does not work This is where I need a hand.
# because when I print it, it is not worted.
foreach $x(@{$names}) {
print "$x->{'name'}
}
# I get
cars
trucks
trains
tractors
(Which is not in a sorted list?)
Thanks
Scott
------------------------------
Date: 31 May 2000 18:04:59 +0100
From: nobull@mail.com
Subject: Re: Reference Sorting
Message-Id: <u9vgzur6pw.fsf@wcl-l.bham.ac.uk>
"spurcell" <skpurcell@hotmail.com> writes:
> Here is what I have done.
No it isn't. That code isn't syntactically valid. Chances are the
transcription errors will have obscured the real problem which is
most likely in your ordering subroutine.
Do not transcribe by hand.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Wed, 31 May 2000 10:32:24 -0700
From: Makarand Kulkarni <makarand_kulkarni@My-Deja.com>
Subject: Re: Reference Sorting
Message-Id: <39354CA8.EE764DB8@My-Deja.com>
> (Which is not in a sorted list?)
$class1->{'id'} = 1;
$class1->{'name'} = 'p';
$class2->{'id'} = 2;
$class2->{'name'} = 'a';
$class3->{'id'} = 3;
$class3->{'name'} = 'x';
$class4->{'id'} = 4;
$class4->{'name'} = 'w';
push @classes, $class1;
push @classes, $class2;
push @classes, $class3;
push @classes, $class4;
$class = \@classes;
@names = sort { $a cmp $b } map { $_->{name} } @{$class};
print join(" ",@names), "\n";
------------------------------
Date: 31 May 2000 10:30:13 -0700
From: Matthew Wilson Emmett <memmett@fraser.sfu.ca>
Subject: RFC: HTML templates and templates in general.
Message-Id: <yvw9ya4qfx0a.fsf@fraser.sfu.ca>
Hello all,
I've noticed several different packages to implement HTML templates
(eg, CGI::FastTemplate). Anyone have any good/bad experiences with
any of these packages they'd like to share? Any comments on speed,
ease of use, flexibility?
Thanks in advance,
Matt
------------------------------
Date: 31 May 2000 16:48:20 GMT
From: Dick Nickalls dicknickallscompuservecom <100115.1010@CompuServe.COM>
Subject: Re: runtime errors - Q how to do this
Message-Id: <8h3fok$5i$1@sshuraab-i-1.production.compuserve.com>
Jonathan,
With this sort of construction one still has to
put || warn $! on the end of every command you think might
generate an error - in which case you might just as
well use Eval().
We need some method of making perl direct any runtime
problem into some global recoverable errortrap
we can have access to, and hence continue/return etc.
Am I missing something here, or am I just trying to do
the ompossible?? :-)
cheers,
Dick
--
Dick Nickalls
dicknickalls@compuserve.com
Department of Anaesthesia, City Hospital, Nottingham, UK.
------------------------------
Date: Wed, 31 May 2000 11:10:22 -0500
From: "Barry Grupe" <bg@skypoint.com>
Subject: Re: simple regexp question
Message-Id: <8h3dgh$2pg3$1@shadow.skypoint.net>
> Now, this allows domains like:
>
> a.----------0.foo
>
> but that's according to your specification.
>
>
> Abigail
Aaah, gigo, you're right.
------------------------------
Date: Wed, 31 May 2000 11:17:54 -0500
From: "Barry Grupe" <bg@skypoint.com>
Subject: Re: simple regexp question
Message-Id: <8h3dui$2pno$1@shadow.skypoint.net>
>
> Instead of using regexes, I think I'd go for something like:
>
> @parts = split /\./, $domain, -1;
> and check each part. BTW the '-1' part makes sure split() doesn't throw
> away empty trailing fields.
That's too easy. ;)
The -1 is good to know though.
> Well, maybe we *could* throw this into one single regex. It won't be a
> "simple regex", though.
>
> $valid = /^([a-z][a-z0-9]*(?:-[a-z0-9]+)*\.)+[a-z]{2,3}$/i;
Ah so, this looks like what I've been trying. The $ in [a-z]{2,3}$ was what
I was missing. This gets me on the right track to fully understanding this
(as well as everybody else's suggestions).
Thank you all.
------------------------------
Date: 31 May 2000 16:32:27 GMT
From: abigail@arena-i.com (Abigail)
Subject: Re: simple regexp question
Message-Id: <8h3eqr$qn9$2@news.panix.com>
On Wed, 31 May 2000 11:17:54 -0500, Barry Grupe <bg@skypoint.com> wrote:
++
++ Ah so, this looks like what I've been trying. The $ in [a-z]{2,3}$ was what
++ I was missing. This gets me on the right track to fully understanding this
++ (as well as everybody else's suggestions).
Note that if you use $, you would allow domains ending in a newline.
Abigail
------------------------------
Date: 31 May 2000 17:55:40 +0100
From: nobull@mail.com
Subject: Re: socket : should I use 'print' to send data ?
Message-Id: <u9ya4qr75f.fsf@wcl-l.bham.ac.uk>
Michelizza Arnauld <am@bocal.cs.univ-paris8.fr> writes:
> If I use 'Socket' module and if I try to send the request with print,
> the server
> never receive the request. I mean that the server blocks because he
> waits for a
> request (that was already send by the client). Instead, if the client
> sends the
> request with 'send', all works fine.
Do you perhaps have an old version of IO::Socket?
From perldoc IO::Socket:
IO::Sockets will be in autoflush mode after creation.
Note that versions of IO::Socket prior to 1.1603 (as
shipped with Perl 5.004_04) did not do this. So if
you need backward compatibility, you should set
autoflush explicitly.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: 31 May 2000 16:16:01 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Strategies for determining if there's a memory leak?
Message-Id: <8h3ds1$58a$1@charm.magnus.acs.ohio-state.edu>
[A complimentary Cc of this posting was sent to Matt Sergeant
<matt@sergeant.org>],
who wrote in article <3934E8D3.6E33391E@sergeant.org>:
> However that may be the bit you found/fixed earlier, as it's a well known
> problem. Unfortunately finding these sorts of memory leaks in large object
> oriented code is extremely hard - I had one in an application of mine that
> used DBD::ODBC, which is where the leak was, but I only found out by
> toggling values (in this case it was AutoCommit causing the leak) and
> print() statements all over the code. Not much fun. FWIW I didn't find
> Devel::Leak to be any use whatsoever - perhaps if I'd written a report
> generator for it's output things would have been easier.
If you dump the value from the debugger, it will detect repeated
values. They may indicate circular references. But sometimes not,
as, say, in
[\$a, \$a]
Ilya
------------------------------
Date: Wed, 31 May 2000 14:56:53 GMT
From: wingo01@my-deja.com
Subject: Timeout value in IO::Socket
Message-Id: <8h397c$atc$1@nnrp1.deja.com>
I am using the Timeout option as follows,
$remote = IO::Socket::INET->new (
Proto => "tcp",
PeerAddr => $host,
PeerPort => $port,
Timeout => "25",
)
or die "Can not connect\n";
I thought that the 25 was seconds, but in testing it came back in about
6 secs. Can anyone tell me what the Timeout value is in. Also how can I
get it to print to a log file if it fails to connect.
Thanks
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 31 May 2000 18:07:03 +0100
From: nobull@mail.com
Subject: Re: Timeout value in IO::Socket
Message-Id: <u9snuyr6mg.fsf@wcl-l.bham.ac.uk>
wingo01@my-deja.com writes:
> I am using the Timeout option as follows,
>
> $remote = IO::Socket::INET->new (
> Proto => "tcp",
> PeerAddr => $host,
> PeerPort => $port,
> Timeout => "25",
> )
> or die "Can not connect\n";
>
> I thought that the 25 was seconds, but in testing it came back in about
> 6 secs.
Obvious question: have you eliminated the possibility that it failed
for some reason other than a timeout?
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Wed, 31 May 2000 17:36:57 GMT
From: Francis Litterio <franl-removethis@world.omitthis.std.com>
Subject: Re: Timeout value in IO::Socket
Message-Id: <m34s7ek4ee.fsf@franl.andover.net>
wingo01@my-deja.com writes:
> I am using the Timeout option as follows,
>
> $remote = IO::Socket::INET->new (
> Proto => "tcp",
> PeerAddr => $host,
> PeerPort => $port,
> Timeout => "25",
> )
> or die "Can not connect\n";
>
> I thought that the 25 was seconds, but in testing it came back in about
> 6 secs.
That method can return (unsuccessfully) for more reasons than simply
expiry of the timeout period.
Maybe a router between you and $host sent back a "destination
unreachable" indication. Less likely: if $host holds a hostname rather
than an IP address, then the 6 seconds may simply be the time it takes
DNS to respond with "unknown host".
> Can anyone tell me what the Timeout value is in.
It is seconds, because it is passed to the builtin function alarm().
--
Francis Litterio
franl-removethis@world.std.omit-this.com
PGP public keys available on keyservers.
------------------------------
Date: Wed, 31 May 2000 11:02:11 -0400
From: "Mark Aisenberg" <mark@sharewire.com>
Subject: Re: What do I need to write my first perl program??
Message-Id: <8h39kp$57j$1@paxfeed.eni.net>
You can download Perl for Windows from
http://www.activestate.com
Then all you need to write scripts is Windows'
Notepad program or any other text editor.
1) Install Perl (the activestate.com download
comes with a Windows installation program).
2) To see if Perl is installed and in your PC's
"path", just type "perl -v" at a DOS command
line prompt. If Perl is OK, it will print a version
number and some copyright info.
3) Use Notepad to write a simple program; e.g.:
print "hello there";
exit;
Save the Notepad document in a file called
hello.pl, e.g.
4) Run the program you just write by typing:
"perl hello.pl". It should print "hello there".
There: that is your first program.
To go a lot beyond that, I'd recommend buying
a Perl book. The publishing company O'Reilly
tends to have the best ones on Perl.
--
Mark Aisenberg <mark@sharewire.com>
http://www.sharewire.com/
Free forms, programs, and content for web sites.
No assembly required.
"Abigail" <abigail@arena-i.com> wrote in message
news:8h1ke2$7ba$5@news.panix.com...
> On Sun, 28 May 2000 09:26:37 +0200, Nelly Hemp <N.Hemp@wanadoo.fr> wrote:
> ++ Hi, I am trying to find out what I need to install onj my PC computer
to
> ++ write and test perl programs.
>
>
> Foreground memory.
> Background memory will be very convenient.
> An input device.
> An output device.
>
> The rest is pure luxery.
>
>
>
> Abigail
------------------------------
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 3221
**************************************