[16092] in Perl-Users-Digest
Perl-Users Digest, Issue: 3504 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 28 18:10:29 2000
Date: Wed, 28 Jun 2000 15:10:18 -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: <962230218-v9-i3504@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 28 Jun 2000 Volume: 9 Number: 3504
Today's topics:
Re: newbie REGEX problem <nnickee@nnickee.com>
Re: newbie REGEX problem <nnickee@nnickee.com>
Please help me for win32 perl yau818@yahoo.com
Re: Please help me for win32 perl (Clinton A. Pierce)
Problem compiling DBI module!!! Help!!! <shon@mad.scientist.com>
Reading files from PerlScript? <samara_biz@hotmail.com>
Re: regex and hashes <bwalton@rochester.rr.com>
running script on remote server <jmarsan@my-deja.com>
Re: running script on remote server nobull@mail.com
Seattle Perl Talks by Damian Conway <spug@halcyon.com>
Re: Sending HTML messages, using perl and sendmail <peter.sundstrom@eds.com>
start a programm under windows via cgi <yannick@koechlin.com>
swatch problem mparker@myra.com
Tips when using HP-UX compiler to build perl <mlh@swl.msd.ray.com>
trouble compiling modules <lsloan@umich.edu>
two BEGINs ? <nomail@nomail.com>
weirdness accessing a hash (darren chamberlain)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 28 Jun 2000 14:52:43 -0500
From: Nnickee <nnickee@nnickee.com>
Subject: Re: newbie REGEX problem
Message-Id: <A8068DF365BBF4B9.6FEDDEC70E2A0DFF.0F80F09547C5DA41@lp.airnews.net>
On Wed, 28 Jun 2000 12:01:36 GMT, someone claiming to be
kcivey@cpcug.org (Keith Calvert Ivey) said:
>>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...)
>No one said anything about mine being better. They do behave
>differently, though. Suppose you have a line like this:
Except for me (*I* said yours is better :)
> ksbkabkljbhjdstuffbkjbkjbskjbd
>Mine will print "ksbkabkljbhjdstuffbkjbkjbskjbd - \n", while
>yours will skip it. We don't know what the original poster
>wanted.
True.. I made an assumption which I probably shouldn't have made.
This is exactly why I asked why your code is better than mine here.
Thank you! :)
Nnickee
------------------------------
Date: Wed, 28 Jun 2000 14:52:44 -0500
From: Nnickee <nnickee@nnickee.com>
Subject: Re: newbie REGEX problem
Message-Id: <4AA381B560493991.67DBA63B7B308C46.29B026B41623461D@lp.airnews.net>
On Wed, 28 Jun 2000 05:27:29 GMT, someone claiming to be Uri Guttman
<uri@sysarch.com> said:
> 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.
I did use Benchmark.pm (sorry I didn't make that clear). I didn't
post the code after modifying it into the subs and using Benchmark.pm
because I didn't want to confuse the OP. Benchmark.pm is what told me
that my sub was 2 wallclock seconds faster (9 seconds vs. 11 seconds).
Keith himself cleared up for me why his code is better than what I
came up with. I just found it interesting that mine was slightly
faster (I honestly wasn't expecting that to be the case).
Oh, and I don't judge the speed of a script by how many times I blink
my eyes, either, although I did once have a script go so out of
control that I probably could have timed it by how many times I had to
go to the bathroom before it finished (it ended up producing a 1.2 gig
html file :)
Nnickee
------------------------------
Date: Wed, 28 Jun 2000 19:57:59 GMT
From: yau818@yahoo.com
Subject: Please help me for win32 perl
Message-Id: <8jdlbt$r8e$1@nnrp1.deja.com>
How can I capture the return message (& error message) when I run below
script?
use Win32::Process;
Win32::Process::Create($ProcessObj,
"d:/appl/evprob.exe",
"evprob -h esmilabea6",
0,
NORMAL_PRIORITY_CLASS,
".");
Any suggestion is appreciate.
yau
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 28 Jun 2000 20:56:06 GMT
From: clintp@geeksalad.org (Clinton A. Pierce)
Subject: Re: Please help me for win32 perl
Message-Id: <GDt65.13008$fR2.156836@news1.rdc1.mi.home.com>
[Posted and mailed]
In article <8jdlbt$r8e$1@nnrp1.deja.com>,
yau818@yahoo.com writes:
> How can I capture the return message (& error message) when I run below
> script?
>
> use Win32::Process;
>
> Win32::Process::Create($ProcessObj,
> "d:/appl/evprob.exe",
> "evprob -h esmilabea6",
> 0,
> NORMAL_PRIORITY_CLASS,
> ".");
>
> Any suggestion is appreciate.
Perhaps you meant qx{}. See "perldoc perlop" under quotes and quote-like
operators. Also, while you're at it, see "How can I capture STDERR from an external command?" in the FAQ (section 8). But note that the Win32 "shell" might
eliminate some of those potential answers.
--
Clinton A. Pierce Teach Yourself Perl in 24 Hours!
clintp@geeksalad.org for details see http://www.geeksalad.org
"If you rush a Miracle Man,
you get rotten Miracles." --Miracle Max, The Princess Bride
------------------------------
Date: Wed, 28 Jun 2000 18:48:24 GMT
From: Shon Stephens <shon@mad.scientist.com>
Subject: Problem compiling DBI module!!! Help!!!
Message-Id: <8jdh9h$nrl$1@nnrp1.deja.com>
I am trying to install the DBI module (so I can conversely install
DBD::mysql) I have successfully compiled and installed on 1 machine.
Solaris2.7, SPARC, gcc2.95.2, perl 5.6.0. On the machine that is
failing I have the exact same setup. But I am getting this error:
gcc -c -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -
D_FILE_OFFSET_BITS=64 -O -DVERSION=\"1.14\" -DXS_VERSION=\"1.14
\" -fPIC -I/usr/local/lib/perl5/5.6.0/sun4-solaris/CORE -Wall -Wno-
comment -DDBI_NO_THREADS Perl.c
In file included from /usr/local/lib/perl5/5.6.0/sun4-
solaris/CORE/perl.h:2086,
from DBIXS.h:19,
from Perl.xs:1:
/usr/local/lib/gcc-lib/sparc-sun-solaris2.7/2.95.2/include/math.h:5:
math.h: No such file or directory
*** Error code 1
make: Fatal error: Command failed for target `Perl.o'
I tried reinstalling my compiler and perl both. math.h is there. I just
can't figure it out???
Any ideas?
--
Shon Stephens
UNIX Systems Administrator
shon@mad.scientist.com
"You want a piece of me?"
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 28 Jun 2000 14:15:36 -0400
From: "Alex T." <samara_biz@hotmail.com>
Subject: Reading files from PerlScript?
Message-Id: <395A40C8.E9F92874@hotmail.com>
Hi,
I'm trying to write a PerlScript, which would dynamically output an HTML
page from a file, depending on the results passed to it from the Query
string.
For example:
http://www.website.com/index.asp?login should display login.html
http://www.website.com/index.asp?signup should display signup.html,
etc...
I can not use simple redirection, because I don't want those other files
(login.html, signup.html... etc) to be accessible without calling them
through index.asp and the PerlScript, meaning that those files are not
gonna have read permissions... I only want my script to be able to read
them.
Does anyone know how to go about it? Can I use standard Perl open, read,
close functions? Maybe something like the code below? (I tried it but it
doesn't do anything)
<%
open(SOURCE, "<login.html");
while(read(SOURCE, $data, 1024))
{
$Response->Write($data);
} #while
close(SOURCE);
%>
Thanks in advance!
Alex
------------------------------
Date: Wed, 28 Jun 2000 19:24:13 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: regex and hashes
Message-Id: <3981DCCB.7D0AFD1F@rochester.rr.com>
Chris Denman wrote:
>
> I have a hash array as follows:
>
> $hash{'john'}='1';
> $hash{'John'}='2';
> $hash{'JOHN'}='3';
>
> and I want to somehow do a case insensitive lookup for 'john' to bring back
> 3 values without going through all of the keys.
>
> Is there a way?
> i.e.
> print $hash{/john/i};
>
> The reason is that the hash has thousands of keys and checking every one of
> them would be too resourceful.
...
> Chris
I assume that you would have resources to do a one-time computation
generating the additional hash keys. If so, just add a second set of
hash keys to your existing hash of the form:
$hash{'/john/i'}='1,2,3';
(I assume you really want to make the values strings as you show in your
code above rather than references to arrays of integers? -- that's
probably smart if you want to tie your hash to a DBM-style file so you
don't have to keep regenerating it)
Something like:
map {push @{$newhash{"/".lc $_."/i"}},$hash{$_}} keys %hash;
@hash{keys %newhash}=map {join ',',@{$_}} values %newhash;
Then your hash would have both the original keys and the
case-insensitive keys of the form '/name/i'. You would look it up with
something like:
$hash{'/john/i'}
(quoting required).
--
Bob Walton
------------------------------
Date: Wed, 28 Jun 2000 20:31:23 GMT
From: JMarsan <jmarsan@my-deja.com>
Subject: running script on remote server
Message-Id: <8jdnar$spj$1@nnrp1.deja.com>
Hi,
I would like to know what is the simplest way to call a shell script on
a remote server from my Perl script and get the output of the shell
script in my Perl script.
Thanks in advance.
--
J. Marsan
Technician, IT
N.S.D.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 28 Jun 2000 22:38:03 +0100
From: nobull@mail.com
Subject: Re: running script on remote server
Message-Id: <u9g0pxo5ac.fsf@wcl-l.bham.ac.uk>
JMarsan <jmarsan@my-deja.com> writes:
> I would like to know what is the simplest way to call a shell script on
> a remote server from my Perl script and get the output of the shell
> script in my Perl script.
Backticks and rsh.
@script_output = `rsh some.other.server some_script`;
That's the simplest way. It may not be the best way (or even a
possible way) in your cirvcumstances.
But then you didn't describe your circumstances so I gave you the
simplest way that would exist under ideal circumstances.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: 28 Jun 2000 20:06:22 GMT
From: Seattle PERL Users Group <spug@halcyon.com>
Subject: Seattle Perl Talks by Damian Conway
Message-Id: <8jdlru$b3k$1@brokaw.wa.com>
Keywords: Damian Conway SPUG Seattle meetings seminars talks user groups
Dr. Damian Conway, celebrated Perl Guru and author of
the long-awaited "Object Oriented Perl" book, will be
visiting Seattle from his home in Australia, thanks in
part to sponsorship arrangements with NeoInformatics
(http://www.neoinformatics.com) and Consultix
(http://www.consultix-inc.com).
He'll be giving free talks on the evenings of July 5th
and 6th, with the latter being another presentation of
his "Quantum Superpositions and the First Virtue" talk
from the June YAPC.
Dr. Conway will also be presenting fee-based training
seminars on July 6th and 7th entitled "ADVANCED OBJECT
ORIENTED PERL" and "BEYOND REGEXES: TEXT PARSING with
PERL MODULES".
Brief summaries of these talks are attached below.
For complete details on all the Seattle presentations
by Dr. Conway, see the SPUG (Seattle Perl Users Group)
web page,
http://www.halcyon.com/spug
and the Consultix web page,
http://www.consultix-inc.com
==============================================================
| Tim Maher, Ph.D. Tel: (206) 781-UNIX |
| SPUG Founder & Leader Email: spug@halcyon.com |
| Seattle Perl Users Group: http://www.halcyon.com/spug |
==============================================================
Seattle Perl Users Group (SPUG) Meetings, July 2000
Sponsored by SPUG and NeoInformatics, http://www.neoinformatics.com
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
MULTIMETHODS: Polymorphism Gone Mad
Dr. Damian Conway, Monash University, Australia
SPUG Meeting, Union Bank of California., 5th and Madison, Seattle
July 5, 6:45pm
Abstract
<RIGHT_LOBE>
A world gone crazy, as method calls throw off their shackles and
start telling objects "Who ya gonna call?" Plus the secret shame
of subroutine overloading. In Perl!
</RIGHT_LOBE>
<LEFT_LOBE>
A sober and serious talk discussing the technique of multiple
dispatch of object methods, and its implementation in Perl. Ad
hoc approaches will be described and dismissed, and use of the
Class::Multimethods module advocated and explained. The implications
of the multimethod construct as a mechanism for signature-based
subroutine overloading will also be pondered.
</LEFT_LOBE>
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
Quantum Superpositions and the First Virtue
Dr. Damian Conway, Monash University, Australia
E-SPUG Meeting, Lucent Technologies, Redmond WA
July 6, 7:00pm
Abstract
Take two quantized disjunctive/conjunctive equiprobable scalar
datastructures, add a dash of multidimensional polymorphism, a
handful of redefined operators, and a pinch of breadth-first optree
evaluation. Simmer gently in the Principle of Least Effort. Decant
into a grandiosely named module. Now serve vector operations (prime
generation, list membership, list extrema, etc.) without loops
or recursion.
(Tim asked me if it's meant to be a parody lecture. I know it looks
that way, but actually it's just like my Coy paper at last year's
TPC: serious science and useful Perl techniques smuggled into
unsuspecting brains hidden behind a dazzlingly stupid idea - Damian)
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Damian Conway Professional Seminars, presented by Consultix (7/6,7/7)
Dr. Damian Conway of Monash University, Australia, will be presenting
two one-day seminars from July 6-7 in the Seattle USA area entitled
"ADVANCED OBJECT ORIENTED PERL" and "BEYOND REGEXES: TEXT PARSING
with PERL MODULES".
These fee-based full-day training seminars teach programming professionals
how to accomplish important tasks using Perl. For further details, see
the Consultix web site (www.consultix-inc.com).
------------------------------
Date: Thu, 29 Jun 2000 09:46:34 +1200
From: "Peter Sundstrom" <peter.sundstrom@eds.com>
Subject: Re: Sending HTML messages, using perl and sendmail
Message-Id: <8jdrr3$gi2$1@hermes.nz.eds.com>
E. Preble wrote in message ...
>This question could apply to many newsgroups, but since I'm
>coding in PERL, I'll post here. Simply put, I want to send
>HTML formatted messages through PERL, with sendmail if
>possible. How is this done?
>
>Typical, text only, messages can be sent as follows:
>
>open (MAIL, "|$mailprog -t") || print "Can't start mail
>program";
>print MAIL "To: $address\n";
>print MAIL "From: $Myaddress\n";
>print MAIL "Subject: $subject\n\n";
>print MAIL "$message";
>close (MAIL);
Use the MIME::Lite module. It will allow you to send any type of message.
------------------------------
Date: Wed, 28 Jun 2000 23:16:21 +0200
From: "YK" <yannick@koechlin.com>
Subject: start a programm under windows via cgi
Message-Id: <8jdpq4$cmf4$1@ID-32283.news.cis.dfn.de>
how can i start, (within a cgi script), a
windows console programm with parameters?
eg. a .bat file?
thanx
yk
------------------------------
Date: Wed, 28 Jun 2000 21:13:35 GMT
From: mparker@myra.com
Subject: swatch problem
Message-Id: <8jdppd$v16$1@nnrp1.deja.com>
swatch -t is supposed to tail a file, but when I restart swatch it
rereads the entire file. Is this normal? Am I doing something wrong?
I am using swatch 3.05b and 3.0.1 with File::Tail version 0.95.
Any help would be great.
Thanks
Margarita
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 28 Jun 2000 20:00:55 GMT
From: Milton Hankins <mlh@swl.msd.ray.com>
Subject: Tips when using HP-UX compiler to build perl
Message-Id: <8jdlhc$rb7$1@nnrp1.deja.com>
Here are some tips that I've submitted via perlbug. I've posted them
because they might be useful to others. They involve building Perl
5.6.0 under HP-UX 11.00.00 using the C compiler that is distributed with
the OS. In retrospect, getting gcc probably would have been easier.
:-)
Tip 1.
Running make produces the following error:
Make: Don't know how to make Bletch:. Stop.
The makefile (note lower case) which Configure generates is the one
being implicitly used. The error is because of the following line:
config.h: Bletch: How does this C preprocessor catenate tokens?
But earlier, Configure reported favorably on the preprocessor's ability
to catenate tokens:
Checking to see how your cpp does stuff like catenate tokens...
Oh! Smells like ANSI's been here.
We can catify or stringify, separately or together!
Removing makefile and instead using Makefile does the trick.
Tip 2.
The file hints/hpux.sh recommends using the -Ae flag with the HPUX C
compiler. On my system, this flag causes "perl -P" to break because it
removes C++-style comments:
s/foo//g;
becomes
s/foo
To get around this, use the following flags for preprocessing: either
"cc -Aa -E", which enforces strict ANSI compliance; or "cc -Ae -C -E",
which leaves comments intact in the output file.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 28 Jun 2000 15:44:59 -0400
From: Lance E Sloan <lsloan@umich.edu>
Subject: trouble compiling modules
Message-Id: <395A55BB.DA5C87CE@umich.edu>
I've recently installed Perl 5.6.0 on a
Solaris 2.6 machine. The compile and install
went well. However, when it came to some
modules, I ran into trouble.
For example, the AFS 1.8 module. I had to
use the "POLLUTE=1" option when running
Makefile.PL and I got a few warnings during
compilation. I figured they're probably no
big deal. But when I ran "make test", I got
this error:
> t/AFS...............Can't load 'blib/arch/auto/AFS/AFS.so' for module
> AFS: ld.so.1: /usr/um/perl/5.6.0/bin/perl: fatal: relocation error:
> file blib/arch/auto/AFS/AFS.so: symbol _et_list: referenced symbol not
> found at /usr/um/perl/5.6.0/lib/5.6.0/sun4-solaris-thread/DynaLoader.pm
> line 200.
> at t/AFS.t line 11
> Compilation failed in require at t/AFS.t line 11.
> BEGIN failed--compilation aborted at t/AFS.t line 11.
Can anybody suggest where I've gone wrong? If you need
more info, like the output of "perl -V", I can
provide that.
I'd appreciate it if responses are cc'ed to me in
addition to posted to this newsgroup. My newsserver
sometimes loses or never gets some articles.
Thanks in advance!
--
Lance E Sloan
------------------------------
Date: Wed, 28 Jun 2000 14:44:34 -0400
From: "Jonah" <nomail@nomail.com>
Subject: two BEGINs ?
Message-Id: <8jdnkm$5ke$1@onlink3.onlink.net>
BEGIN {require "config.cgi" };
use vars qw($password $idfile $errors);
BEGIN
{
use CGI::Carp qw(carpout);
open(LOG, ">>$errors") or die("Unable to open $errors: $!\n");
carpout(LOG);
}
use strict;
use CGI::Carp qw(fatalsToBrowser);
use CGI;
use Time::Local;
my $q = new CGI;
print $q->header;
#and so on
The first BEGIN is to import the variables. I'm doing it this way because
the script in which I'm importing has use strict, as you can see.
I need to import variables to get the $errors variable for the second
BEGIN.
Anything wrong with this? It works, but something seems not right.
comments?
From what I understand of BEGIN, this is really just using use
twice.....I think.
thanks for your help
------------------------------
Date: 28 Jun 2000 21:08:37 GMT
From: darren44@cybercom.net (darren chamberlain)
Subject: weirdness accessing a hash
Message-Id: <8jdpgm$24ul$1@newsie2.cent.net>
Here is a situation I discovered by accident. Can anyone explain this?
bash$ perl
my %hash = ( foo => 1,
bar => 2,
baz => 3,
);
printf "%d\n",%hash->{foo};
^D
1
bash$
Accessing an element of a regular hash (not a hashref) using hashref
syntax with the leading % (not a $). It works for more than just simple
integers as well -- any valid hash key works (references, strings, objects).
Any explanations?
Thanks,
darren
------------------------------
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 3504
**************************************