[10573] in Perl-Users-Digest
Perl-Users Digest, Issue: 4165 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Nov 6 11:07:35 1998
Date: Fri, 6 Nov 98 08:00:26 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 6 Nov 1998 Volume: 8 Number: 4165
Today's topics:
Re: #!/usr/local/bin/perl USE in Win95??? <Allan@due.net>
Re: #!/usr/local/bin/perl USE in Win95??? (Nathan V. Patwardhan)
Re: #!/usr/local/bin/perl USE in Win95??? <rtrussell@hps-inc.com>
Re: [HELP] Newbie question. <rtrussell@hps-inc.com>
Re: ActiveState vs. Perl? <perlguy@technologist.com>
Re: And Or Comparisons <Allan@due.net>
Re: And Or Comparisons <jdporter@min.net>
Re: Backward <perlguy@technologist.com>
CGI and Server Loads gabriel@communitech.net
Re: delete a file under win95 (!) (Nathan V. Patwardhan)
expect <michaelr@lndn.tensor.pgs.com>
Re: HELP !!! ASAP answer please! <dtauzel@uswest.com>
Re: Help! - Problem with "variable" variable.... (Greg Bacon)
Re: HELP: perl script fails on setuid binary (Andrew M. Langmead)
Re: Heterogeneous Data Structures: possible? If so, ho <jdporter@min.net>
How can I reset a file? <emills@harris.com>
Re: How can I reset a file? <Tony.Curtis+usenet@vcpc.univie.ac.at>
Re: How to run Perl/CGI under NT? <rtrussell@hps-inc.com>
Re: IIS4, Perl, Object Moved <Steve_Kilbane@cegelecproj.co.uk>
Re: Not to start a language war but.. (Anita M Wilcox)
Re: OLE and ActiveState, Why so slow? <rtrussell@hps-inc.com>
OLE and CGI with ActiveState and Apache <rtrussell@hps-inc.com>
Re: Pattern matching (Alan Dye)
Re: Pattern matching <jdf@pobox.com>
Re: Pattern matching (Alan Dye)
Re: Perl5 win32 directory structure and Config.PM (Nathan V. Patwardhan)
Perlmenu 4.0 (David Tucker)
Re: Problem running shell script in perl. latsharj@my-dejanews.com
Re: Processing Arrays / Hashes <jdf@pobox.com>
Re: reg. expr question. <Kien_Ha@Mitel.COM>
Re: reg. expr question. (Greg Bacon)
Relocating Perl Home Directory <Richmont.Sy@exchange.sms.siemens.com>
sending an email to two different email addresses <marcov@ctrl-v.nl>
Sendmail-code needed <ours@casema.net>
Re: time question (Andrew M. Langmead)
Re: time question (Andrew M. Langmead)
Re: Using recv in Socket programming <delonad@netdoor.com>
where to find irc - www gateway in perl? (Filipp Anthony Sapienza)
Re: Why is perl better than shell scripting language? <bradw@ca.newbridge.com>
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 6 Nov 1998 08:12:24 -0500
From: "AmD" <Allan@due.net>
Subject: Re: #!/usr/local/bin/perl USE in Win95???
Message-Id: <71usb7$apr$1@camel18.mindspring.com>
DDC wrote in message <71uk87$j66@dfw-ixnews8.ix.netcom.com>...
>How do you translate this line for proper CGI use in Windows 95 or windows
>NT? Or on my ISPs host?
>
>
>#!/usr/local/bin/perl
>
>I don't understand UNIX, and my Perl interpreter or PERL.EXE
>is at at C:\PERL\BIN
>Please advise?
>
Unless you are using the Apache web server the path information is
irrelevant. If you are using Apache for windows then the first line must
point to the directory where perl is installed. In this case you can use
#c:/perl/bin -w
make sure that perl is in your Windows 95 path.
HTH
AmD
------------------------------
Date: Fri, 06 Nov 1998 13:35:39 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: #!/usr/local/bin/perl USE in Win95???
Message-Id: <LWC02.27$lw.4615@news.shore.net>
DDC (wmodem@ix.netcom.com) wrote:
: How do you translate this line for proper CGI use in Windows 95 or windows
: NT? Or on my ISPs host?
Short answer: you don't. Longer answer: run 'pl2bat' on your Perl
script so that it's wrapped in a batch file.
--
Nate Patwardhan|root@localhost
"Fortunately, I prefer to believe that we're all really just trapped in a
P.K. Dick book laced with Lovecraft, and this awful Terror Out of Cambridge
shall by the light of day evaporate, leaving nothing but good intentions in
its stead." Tom Christiansen in <6k02ha$hq6$3@csnews.cs.colorado.edu>
------------------------------
Date: Fri, 6 Nov 1998 09:53:02 -0500
From: "Roger Kenneth Trussell" <rtrussell@hps-inc.com>
Subject: Re: #!/usr/local/bin/perl USE in Win95???
Message-Id: <71v2p7$sd8$1@supernews.com>
AmD wrote in message <71usb7$apr$1@camel18.mindspring.com>...
>
>DDC wrote in message <71uk87$j66@dfw-ixnews8.ix.netcom.com>...
>>How do you translate this line for proper CGI use in Windows 95 or windows
>>NT? Or on my ISPs host?
>>
>>
>>#!/usr/local/bin/perl
>>
>>I don't understand UNIX, and my Perl interpreter or PERL.EXE
>>is at at C:\PERL\BIN
>>Please advise?
>>
>Unless you are using the Apache web server the path information is
>irrelevant. If you are using Apache for windows then the first line must
>point to the directory where perl is installed. In this case you can use
>
>#c:/perl/bin -w
>
>make sure that perl is in your Windows 95 path.
When running CGI scripts with Apache, I found personally that
#!"C:\Perl\bin\perl.exe" -w seems to work for me. (Then again, I also made
several modifications to the conf files. The -w may not be necessary in a CGI
script.)
------------------------------
Date: Fri, 6 Nov 1998 10:36:41 -0500
From: "Roger Kenneth Trussell" <rtrussell@hps-inc.com>
Subject: Re: [HELP] Newbie question.
Message-Id: <71v5b2$ctu$1@supernews.com>
Matthew Bafford wrote in message ...
>In article <<363B527A.21ACA33D@mail2.intellect.com.tw>>,
>snip...
>The above example would be much better written as:
>
>my %vars;
>open CFG, 'config' or die "Unable to open 'config', reason: $!\n";
I don't mean to be a pain, but isn't the correct syntax for the "or die" command
for this context is as follows?
open CFG,'config' || die "Unable blah, blah, blah.\n";
Isn't "||" more correct than the word "or"?
Sincerely,
Roger Trussell
------------------------------
Date: Fri, 6 Nov 1998 12:35:43 GMT
From: Brent Michalski <perlguy@technologist.com>
Subject: Re: ActiveState vs. Perl?
Message-Id: <3642ED1F.B0F65276@technologist.com>
I am using ActivePerl from ActiveState along with the DBI and DBD::ODBC
drivers to connect to ODBC databases on NT. Use the "Perl Package
Manager" (PPM), that comes with ActivePerl to install your modules...
Have you tried something like that?
Brent
--
Java? I've heard of it, it is what I drink when I am hacking Perl. -me
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$ Brent Michalski $
$ -- Perl Evangelist -- $
$ E-Mail: perlguy@technologist.com $
$ Resume: http://www.inlink.com/~perlguy $
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
------------------------------
Date: Fri, 6 Nov 1998 09:22:57 -0500
From: "AmD" <Allan@due.net>
Subject: Re: And Or Comparisons
Message-Id: <71v09h$url$1@camel25.mindspring.com>
Billsterz wrote in message <71tubc$dpk$1@nntp.erinet.com>...
>Hi All,
>What would the syntax be to evaluate
>if (!($FORM{'value1'})) {
> &one_or_other;
>}
>AND
>if (!($FORM{'value2'})) {
> &one_or_other;
>}
>I would like to evaluate both variables, and if both were empty, run
>&one_or_other telling them one or the other fields are required.
>I read that you use && but I can't seem to put it in the right place.
I am a bit confused by your statement (typical for me really). I would think
you would want to know if *either* were empty, that would lead to an and
such as
&one_or_other unless ($FORM{'value1'} and $FORM{'value2'});
If *both* have to be empty before the sub is called:
&one_or_other unless ($FORM{'value1'} or $FORM{'value2'});
AmD
------------------------------
Date: Fri, 06 Nov 1998 10:21:21 -0500
From: John Porter <jdporter@min.net>
Subject: Re: And Or Comparisons
Message-Id: <364313F1.EBD86720@min.net>
Billsterz wrote:
>
> What would the syntax be to evaluate
>
> if (!($FORM{'value1'})) {
> &one_or_other;
> }
>
> AND
>
> if (!($FORM{'value2'})) {
> &one_or_other;
> }
>
> I would like to evaluate both variables, and if both were empty, run
> &one_or_other telling them one or the other fields are required.
Since you're testing the negation of a condition in both cases,
try converting to 'unless', which is exactly like 'if' except the
sense of the test is inverted. That gives
unless ( $FORM{'value1'} ) {
&one_or_other;
}
unless ( $FORM{'value2'} ) {
&one_or_other;
}
To combine them now is simple. How would you express it in English?
"Unless one or the other is defined, call one_or_other." So:
unless ( $FORM{'value1'} || $FORM{'value2'} ) {
&one_or_other;
}
hth,
John Porter
------------------------------
Date: Fri, 6 Nov 1998 12:51:34 GMT
From: Brent Michalski <perlguy@technologist.com>
Subject: Re: Backward
Message-Id: <3642F0D6.41EA9455@technologist.com>
Doh! Guess what today's "Daily Perl FAQ" was?
Question:
How do I reverse a string?
Use reverse() in scalar context, as documented in the "reverse"
entry in the perlfunc manpage.
$reversed = reverse $string;
So the code in my previous post could be re-written as:
$var = "ABC";
$r_var = reverse $var;
print "$r_var\n";
Gotta love the "Daily Perl FAQ"!
Wanna get it too? Go to: http://yoak.com/daily_perl/
Brent
--
Java? I've heard of it, it is what I drink when I am hacking Perl. -me
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$ Brent Michalski $
$ -- Perl Evangelist -- $
$ E-Mail: perlguy@technologist.com $
$ Resume: http://www.inlink.com/~perlguy $
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
------------------------------
Date: Fri, 06 Nov 1998 14:29:43 GMT
From: gabriel@communitech.net
Subject: CGI and Server Loads
Message-Id: <71v14n$2qf$1@nnrp1.dejanews.com>
Does anyone have any experience with the effect of mod_perl
on the server loads, especially if the server is handling quite
alot of CGI processes?
Our server loads are significant and it appears that mod_perl
is the answer. Theoretically, it should help with the load
averages. Can anyone speak for it in practice?
Does mod_perl make CGI run more efficiently and reduce the
server load averages?
Any feedback is appreciated.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 06 Nov 1998 13:39:07 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: delete a file under win95 (!)
Message-Id: <%ZC02.28$lw.4615@news.shore.net>
Avshi Avital (avitala@macs.biu.ac.il) wrote:
: unlink 'file_name'
What's 'file_name' equal to? You're not trying to delete
c:\foo\bar.txt, are you? If this is the case, I see where the problem
is. You are using the correct path to file_name, aren't you? You
could use unlink("/path/filename") or die("message .. ");
--
Nate Patwardhan|root@localhost
"Fortunately, I prefer to believe that we're all really just trapped in a
P.K. Dick book laced with Lovecraft, and this awful Terror Out of Cambridge
shall by the light of day evaporate, leaving nothing but good intentions in
its stead." Tom Christiansen in <6k02ha$hq6$3@csnews.cs.colorado.edu>
------------------------------
Date: Fri, 06 Nov 1998 14:48:09 +0000
From: Michael Renshaw <michaelr@lndn.tensor.pgs.com>
Subject: expect
Message-Id: <36430C29.1306@lndn.tensor.pgs.com>
has anyone used perl's expect ? if so, how does it compare with
tcl's expect which i hear so much about. i installed the expect
and pty/tty modules and within 1/2 hour i had a cute little
script for ftp. im sure i heard somewhere that tcl is better
than perl for expect type applications, discuss ? (as my
english teacher used to say to me).....
thanx
Mike
------------------------------
Date: Fri, 06 Nov 1998 09:21:10 -0600
From: David Tauzell <dtauzel@uswest.com>
To: yt@cs.purdue.edu
Subject: Re: HELP !!! ASAP answer please!
Message-Id: <364313E6.831C4726@uswest.com>
Use the 'index' function instead.
"Yulia. T" wrote:
>
> Hi, I want to search a string in a certain file.
> I use the following codes :
>
> open (TEMP, "<$dir/output3");
> $error3 = 0;
> while (<TEMP>) {
> if (/= -(1 *(2 ** 32) + (0))/i) {
> $error3 = 1;
> last;
> }
> }
> close TEMP;
>
> But it treats the above string as a regular expression so it generates
> error when it reads 2 ** 32. I know that grep has -F function so that it
> will treat the string as string only not as regular expression. My
> question is how can we do this in Perl ?
>
> Thanx so much
> Naoise
------------------------------
Date: 6 Nov 1998 14:44:45 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: Help! - Problem with "variable" variable....
Message-Id: <71v20t$an7$2@info.uah.edu>
Please read <URL:http://www.plover.com/~mjd/perl/varvarname.html>.
Greg
--
Words are the most powerful drug used by mankind.
-- Rudyard Kipling
------------------------------
Date: Fri, 6 Nov 1998 15:35:50 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: HELP: perl script fails on setuid binary
Message-Id: <F20BBq.CtF@world.std.com>
rsc@snipe.scd.ucar.edu (Robert S. Campbell) writes:
>$safe = $printer; $safe =~ /^(.*)$/; $safe = $1;
>Which worked.
It worked, but you are falling prey to the problem that perl was
trying to protect you against.
What if $printer contained
"lp /dev/null >/dev/null; cat >/dev/null"
the lpr command gets its printer name and a filename to print, (so it
runs without error) and directs the output of lpr to /dev/null to
avoid the "empty file" message. Then it runs cat to read the data your
script expects to send to the printer.
Since printer names can only contain alphanumeric chars, you would be
better off saying
if ( $printer =~ /^(\w+)$/ ) {
$safe = $1;
}
else {
die "There can't be a printer named $printer\n";
}
You might even want to write something to syslog so that you see what
is going on.
--
Andrew Langmead
------------------------------
Date: Fri, 06 Nov 1998 10:00:48 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Heterogeneous Data Structures: possible? If so, how?
Message-Id: <36430F20.58F712AE@min.net>
Charles Roten wrote:
>
> Actually, it's worse than my original post indicated.
>
> Sooner or later, I run into the need for something like _this_ ...
>
> $FireWall_Rule->[7]->{"services"}
>
> has to point to the following wretched sordid _list_-_style_ mess ...
>
> A scalar:
> "IMAP"
> A scalar:
> "pop-3"
> A hash key/value pair, where the key is a string and the value
> is an array-like construct:
> "smtp->In", [ "resource In", "service smtp", \
> {"color", "firebrick}, {"type", "Tcp"}]
>
> This is where matters get ugly. These are three elements in a LIST.
> The first two are _SCALARS_. The third is a _HASH_ key/value PAIR.
>
> At this point, I am not at all sure that something like this can be
> done cleanly in Perl. I would _really_ appreciate being proven
> wrong !!
The proof is in the Perl.
The thing to remember is that Perl never requires that your data
structures be homogeneous. There is nothing to stop you from
having strings, array-refs, and hash-refs all in the same array (or
hash). In other words, what you want is eminently feasible.
$FireWall_Rule->[7]->{"services"} =
[
"IMAP",
"pop-3",
{
"smtp->In" =>
[
"resource In",
"service smtp",
{ "color" => "firebrick },
{ "type" => "Tcp" }
]
}
];
But I would think you would want that innermost array to contain
one single hash as its third element, like so:
[
"resource In",
"service smtp",
{
"color" => "firebrick,
"type" => "Tcp"
}
]
(Btw, you don't need that backslash. This is Perl!)
--
John "Throbblefoot" Porter
Please Don't "Courtesy CC" me.
I read this newsgroup fanatically. You know that!
("Emailed only" is fine, though.)
"The people at the Grey Hotel
Are either aged or unwell." -- EG
------------------------------
Date: Fri, 06 Nov 1998 10:33:49 -0500
From: "PERL ROCKS!" <emills@harris.com>
Subject: How can I reset a file?
Message-Id: <364316DD.91A23AD0@harris.com>
If I have a file opened for reading, and I've read some of all of it
with <F>, how can I RESET the filepointer back to the beginning of the
file (just like RESET in PASCAL).
I investigated in my trusty camel book but I can't find any info on it
there. I don't want to have to CLOSE and OPEN the file again, but of
course I know that would do the trick if I have to. I thought that
maybe the code below would work (but I'm sure many of you know it
didn't!). It didn't like me trying to open an open'ed file, as I
suspected it might not.
Thanks,
E
#!/usr/local/bin/perl -w
#
open A,"./test";
while (<A>)
{print;}
open A;
while (<A>)
{print;}
close A;
------------------------------
Date: 06 Nov 1998 16:45:26 +0100
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: How can I reset a file?
Message-Id: <83yapoakq1.fsf@vcpc.univie.ac.at>
Re: How can I reset a file?, PERL <emills@harris.com> said:
PERL> If I have a file opened for reading, and I've read
PERL> some of all of it with <F>, how can I RESET the
PERL> filepointer back to the beginning of the file (just
PERL> like RESET in PASCAL).
<shudder :-) >
Seek and ye shall find:
perldoc -f seek
hth
tony
--
Tony Curtis, Systems Manager, VCPC, | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien, | <URI:http://www.vcpc.univie.ac.at/>
"You see? You see? Your stupid minds! | private email:
Stupid! Stupid!" ~ Eros, Plan9 fOS.| <URI:mailto:tony_curtis32@hotmail.com>
------------------------------
Date: Fri, 6 Nov 1998 10:08:06 -0500
From: "Roger Kenneth Trussell" <rtrussell@hps-inc.com>
Subject: Re: How to run Perl/CGI under NT?
Message-Id: <71v3ij$9k4$1@supernews.com>
Shane Baker wrote in message <363F4795.45E8E05C@merck.com>...
>I realize that many of you take offense at questions on this subject here,
>but there doesn't seem to be anything in any of the related FAQs about
>this. I have the same problem and I think I have narrowed it down to the
>way Windows handles file associations.
>
>This isn't really a perl problem, just hoping someone here will be able to
>help. Working from a command prompt, I got the following results (the
>contents of the script are not relavant, let's say that it just prints
>Hello World):
>
><prompt>perl test.pl --- this is fine.
><prompt>test.pl --- fine
><prompt>perl test.pl > out.txt --- fine
><prompt>test.pl > out.txt --- NOT FINE - out.txt is 0 bytes.
>
>I setup a test file association with the same results, so it is not perl
>specific (again, I know I might be inviting flames here). I am guessing
>that this is the reason Java WebServer and Netscape SuiteSpot both fail to
>produce any output when I try to use perl for my cgi programs (I rewrote
>in C and it worked fine).
>
>Reading through this newsgroup, it appears that everyone who is running
>perl/cgi on NT is using IIS and it looks as though IIS has its own file
>association stuff built in. I would like to stay as far away from MS
>products as possible (I'm writing on NT because it is mandated at work).
>I haven't installed IIS because it requires that I install IE.
>
>If there is anyone who has anything to offer on this subject, it would be
>greatly appreciated.
I've got CGI to work to some degree on Windows 98 so here is my response to the
question "How to run Perl/CGI under NT?".
I suggest that you take the following steps:
1. Download Perl for Win32 from www.activestate.com
2. Download Apache from www.apache.org (I know that you may be attached to using
other web servers, but I know for a fact that Apache supports CGI.)
3. Check out my reply to the thread "Re: Configuring desktop PC to run CGI
scripts" on the newsgroup comp.infosystems.www.authoring.cgi
- I gave away my few secrets to CGI in that thread :-)
- Also check out the replies that I got as a result of MY reply to that thread.
They will tell you about which steps in my CGI configuration technique are
superfluous and which are not
Sincerely,
Roger Trussell
------------------------------
Date: 6 Nov 1998 15:18:47 GMT
From: Steve Kilbane <Steve_Kilbane@cegelecproj.co.uk>
To: Ron Parker <sysop@scbbs.com>
Subject: Re: IIS4, Perl, Object Moved
Message-Id: <71v40n$t95$2@news.cegelecproj.co.uk>
[ Copy emailed ]
In article <3642B4FE.C3A040B7@scbbs.com>, Ron Parker <sysop@scbbs.com> writes:
> IIS is returning the "Object Moved" message as a reponse to the "POST" request
> sent by the script.
Ok.
> The URL in the POST request is correct. A similar program works on another Unix
> machine running an older NCSA www server and Perl 4.x.
Be specific here. Let's say your browser is on machine B, your Apache server
on machine U (unix) and IIS on machine W (windows). This other server - would
that be an alternative to W that U can talk to, or an alternative to U that can
talk to W?
> The only difference
> between the two is that Perl 5.x requires that I print the header "Content Type:
> text/html" before processing the POST request and Perl 4.x does not.
Well, this doesn't make sense. Perl 5 doesn't have any requirements at all,
but if your server (U?) sees any output that doesn't look like a header, before
the header is closed, it'll barf. Perl 5 might just be generating a warning about
your script.
> If I do print
> it, the IIS response to the POST request is "Object Moved". Any ideas?
Which status code are you giving in your response header on the Windows
machine? Is it a plain 200, or are you not specifying? I've seen IIS completely
ignore the response provided, because it decided that it knew how to handle
the status code itself...
Also, are you including Location: or URL: headers in your response? Those
will cause IIS to decide that what you *really* meant was that the object
had moved...
steve
--
<Steve_Kilbane@cegelecproj.co.uk> - All opinions are mine alone.
IIS4+Perl5 FAQ: http://www.whitecrow.demon.co.uk/steve/iis4.html
------------------------------
Date: Fri, 6 Nov 1998 14:01:45 GMT
From: amw@world.std.com (Anita M Wilcox)
Subject: Re: Not to start a language war but..
Message-Id: <F206yy.6xp@world.std.com>
In article <363F7422.61FDB6BE@sage.att.com>,
Garrett G. Hodgson <garry@sage.att.com> wrote:
>Anita M Wilcox wrote:
>>
>> >
>> >>: * its cleaner and simpler.
>> >
>> >> Perl is complex, it's a feature.
>> >
>> >It sure is. Unfortunately, Perl code is complex as well.
>> >
>> Can we say "job security"? Seriously, whether you prefer one
>> language over another, it is irrelevant as far as your career
>> goes if no one will hire you to work with it. I'm a consultant
>> and have to have a fairly broad repertoire of skills, and, as
>> such, have to try to cram in learning as much as possible. In
>> terms of the Python/Perl debate, Perl wins hands-down.
>
>sounds like VB or cobol is a better bet.
>particularly cobol, at least until 1/1/00.
>
Ack! Not cobol! Yuk! And you can't do VB on Unix :-) But
I'm learning it anyway, to compete in this increasingly
Gates-ified world. But I like that I can do Perl on just
about any platform.
Anita
------------------------------
Date: Fri, 6 Nov 1998 09:44:43 -0500
From: "Roger Kenneth Trussell" <rtrussell@hps-inc.com>
Subject: Re: OLE and ActiveState, Why so slow?
Message-Id: <71v29o$ptq$1@supernews.com>
Roger Kenneth Trussell wrote in message <71u09n$cqg$1@supernews.com>...
>Hello everyone,
>
> I'm puzzled by this problem. It may be due to something stupid that I
>did to my own computer.
>
> I'm trying to use ActiveState's OLE extensions to Perl for Win32. I'm
>able to create the Automation object that I want, but it seems to take
>forever to call the methods and the properties that I want. Is Perl for
>Win32 doing something strange when it interacts with Automation objects that
>make it slow sometimes? Is there probably something stupid that was
>configured incorrectly in the object?
>
>Sincerely,
>Roger Trussell
>
>
>
I'm sorry about the wasted bandwidth on this news groups. I'll reply to my own
post for the sake of posterity. The Automation object to which I was trying to
connect was originally developed for the purpose of using DCOM. That means that
it was reading a configuration file (a customized ini file) that told it to do
something on somebody else's machine. I reconfigured the Automation object so
that it will run as a local server not as a proxy for a remote COM server. I
apologize to this newsgroup.
Sincerely,
Roger Trussell
------------------------------
Date: Fri, 6 Nov 1998 10:48:09 -0500
From: "Roger Kenneth Trussell" <rtrussell@hps-inc.com>
Subject: OLE and CGI with ActiveState and Apache
Message-Id: <71v604$fa6$1@supernews.com>
Hello everyone,
I've had some success with the OLE libraries for Perl that came with
ActiveState's version of Perl for Win32. I've also had some success with making
a rudimentary CGI script that can read values off a web form.
I'm having problems with using the OLE libraries inside my CGI script. It
seems that once I embed references to an Automation object's methods and
properties in a CGI script, then those references fail to work. (Those same
references work just fine in a stand-alone perl script.) I'm using Windows 98
with Apache as my web server. Has anybody experienced this problem? Does
anybody have any suggestions?
Sincerely,
Roger Trussell
------------------------------
Date: Fri, 06 Nov 1998 14:33:58 GMT
From: alan@akqa.com (Alan Dye)
Subject: Re: Pattern matching
Message-Id: <36430894.710694124@news.theplanet.net>
<<snip>>
Hi, Sorry I forgot to mention that I cannot use modules as the script
needs to be portable from server to server.
>Perl Modules are your friend. You can do something like this with the
>Text::CSV module:
>
>#!/usr/local/bin/perl -w
>
>use Text::CSV;
>
>my $file = "foo.csv";
>
>$csv = Text::CSV->new();
>
>open FILE, "$file" or die "Can't open $file: $!\n";
>while (defined ($line = <FILE>)) {
> chomp $line;
> $status = $csv->parse($line);
> ($Id, $SizeSQ, $SizeSM, $AnnualRent, $RentSQ, $Comments, $Address,$Agent, $Duplicate) = $csv->fields();
>}
>--
>Clay Irving
>clay@panix.com
------------------------------
Date: 06 Nov 1998 15:52:51 +0100
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: Pattern matching
Message-Id: <m3g1bw6fgc.fsf@joshua.panix.com>
alan@akqa.com (Alan Dye) writes:
> Hi, Sorry I forgot to mention that I cannot use modules as the script
> needs to be portable from server to server.
That's a non-sequitor, like "I can't paint my walls orange because
it's Thursday."
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: Fri, 06 Nov 1998 15:03:23 GMT
From: alan@akqa.com (Alan Dye)
Subject: Re: Pattern matching
Message-Id: <36430f8e.712479441@news.theplanet.net>
On 06 Nov 1998 15:52:51 +0100, Jonathan Feinberg <jdf@pobox.com>
wrote:
>alan@akqa.com (Alan Dye) writes:
>
>> Hi, Sorry I forgot to mention that I cannot use modules as the script
>> needs to be portable from server to server.
>
>That's a non-sequitor, like "I can't paint my walls orange because
>it's Thursday."
>
No it means that the script needs to be portable between servers and
not have to require modules.
>--
>Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
>http://pobox.com/~jdf
------------------------------
Date: Fri, 06 Nov 1998 13:33:17 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Perl5 win32 directory structure and Config.PM
Message-Id: <xUC02.25$lw.4615@news.shore.net>
Brian P. Barnes (bbarnes@dev.tivoli.com) wrote:
: I have tried numerous times to compile the new source for Win32
: Perl5.005 according to the README. It always gives me a
: /perl/perl5.005/lib directory, no bin directory at all and Perl located
You should check out README.win32 which came with your Perl
distribution so you'll know what to add to your PATH (hint: perl.exe
and perlglob.exe binaries were built in these 'bin' directories). You
can also search for perl.exe with "Windows Explorer" or File Manager
if you're nasty. :-)
: I want to try to organize the essential files by hand and it would be
: great to have a normal, working model to look at. Could somebody who has
: compiled a WIN32, 5.005, (VC++ ?) possibly do a "ls -R" from the Perl
Since you're building with options specified in 'makefile.mk', I'm not
sure that you can get the flexbility with install directories that
you're anticipating.
--
Nate Patwardhan|root@localhost
"Fortunately, I prefer to believe that we're all really just trapped in a
P.K. Dick book laced with Lovecraft, and this awful Terror Out of Cambridge
shall by the light of day evaporate, leaving nothing but good intentions in
its stead." Tom Christiansen in <6k02ha$hq6$3@csnews.cs.colorado.edu>
------------------------------
Date: 6 Nov 1998 14:23:23 GMT
From: david@temss2.main.temple.edu (David Tucker)
Subject: Perlmenu 4.0
Message-Id: <71v0or$u49$1@cronkite.ocis.temple.edu>
I've tried everything in the INSTALLATION guide to fix the troubles that I'm
having with this module.
My main problem is that my screen does not redraw properly. Screens just
overwrite without repainting. I have a garbled mess. Does anyone have a
fix for this?
Thanks in advance
------------------------------
Date: Fri, 06 Nov 1998 15:38:51 GMT
From: latsharj@my-dejanews.com
Subject: Re: Problem running shell script in perl.
Message-Id: <71v56b$6i2$1@nnrp1.dejanews.com>
In article <36420EBC.C49507C2@ti.com>,
Navin Chander <navin@ti.com> wrote:
> I have three problems
> 1. I have a shell script that sets my environment before executing
> another command which invokes a tool.
>
> In my perl script I would like to execute this shell script followed by
> the command for the tool.
> 2. I use tcsh shell. so when I want to execute a script that does not
> have a header ("#!/bin/csh") I would like to use
>
> source shell.scr
> 3. when I use system to execute unix commands in perl and if I have
> to place braces "( or )" , the shell has some problems in executing the
> command.
Write a wrapper script:
#!/usr/bin/sh
. /path/to/env/file
exec "$@"
Then in your perl program:
system("/path/to/wrapper /path/to/cmd parms");
The surgeon general has determined that using csh for scripts can be hazardous
to your health.
--
Regards,
Dick
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 06 Nov 1998 15:01:52 +0100
From: Jonathan Feinberg <jdf@pobox.com>
To: "Neil Edmondson" <neiled@enteract.com>
Subject: Re: Processing Arrays / Hashes
Message-Id: <m3g1bwsywf.fsf@joshua.panix.com>
"Neil Edmondson" <neiled@enteract.com> writes:
> #!/usr/local/bin/perl
You *really* want to be using the -w switch up there.
> $newpage = {'subroutine' => 'NewPage', 'expiry' => '+1m', 'buttons' => ('a',
> 'b', 'c')};
This is exactly equivalent to
$newpage = { subroutine => 'NewPage',
expiry => '+1m',
buttons => 'a',
b => 'c' };
Those parentheses don't do anything.
If you mean for the buttons key to refer to an array reference, you
must use an array reference constructor, as in this excerpt:
buttons => ['a', 'b', 'c']
> @buttons=$newpage->{'buttons'};
And this line would have to dereference the reference:
@buttons = @{$newpage->{buttons}};
You need to read perldata, perlref, perllol, and perldsc.
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: Fri, 06 Nov 1998 09:51:37 -0500
From: Kien Ha <Kien_Ha@Mitel.COM>
Subject: Re: reg. expr question.
Message-Id: <36430CF9.716FC5A7@Mitel.COM>
Tk Soh wrote:
> Kjetil Svendsberget wrote:
> >
> > >
> > > ($bit) = $dest_dir =~ /([a-z])\\*$/;
> >
> > After a bit of testing: this does not what i want.
> > What if $dest_dir has 'f:\a\test\' or 'f:\a\TeSt\'
> >
> > i still want $bit to contain 'test' or 'TeSt'
>
> ($bit) = $dest_dir =~ /([a-z]+)\\*$/;
> ^
This wouldn't work for the case of 'f:\a\TeSt\'.
How about:
($bit) = $dest_dir =~ /(\w+)\\?$/;
-kh
> -tk
------------------------------
Date: 6 Nov 1998 14:42:45 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: reg. expr question.
Message-Id: <71v1t5$an7$1@info.uah.edu>
In article <71sqm3$tbt$1@nnrp1.dejanews.com>,
ptimmins@netserv.unmc.edu (Patrick Timmins) writes:
: This won't do what (I think) he wants in the real world ... assuming
: he uses directories that have names longer than one character.
:
: f:\a\doggy
: f:\a\doggy\
:
: will both give 'y', when 'doggy' is probably what's wanted.
Oh, rats.. greediness strikes again. :-)
#! /usr/bin/perl -w
for (qw( f: f:\ f:\a f:\a\ f:\a\b\c\d f:\a\b\c\d\ f:\a\doggy )) {
next unless /^f:\\ # must have leading f:\
[\w\\]*\\ # skip all backslashes and alphanum
(\w+) # save the last run of alphanums
\\* # followed by any number of backslashes
$/x;
print "$_: `$1'\n";
}
Greg
--
Fenster: Treat me like a criminal, I'll end up a criminal.
Hockney: You are a criminal.
Fenster: Why you gotta go and do that? I'm trying to make a point.
------------------------------
Date: 6 Nov 1998 15:09:00 GMT
From: "Rich Sy" <Richmont.Sy@exchange.sms.siemens.com>
Subject: Relocating Perl Home Directory
Message-Id: <01be0996$9bcb7820$5a2ae2a5@rsy.sms.siemens.com>
Can anyone suggest the easiest way to relocate Perl's home directory? Is
it as simple as changing some perl config or do I have to rebuild?
Thanks for you help.
Rich :)
Richmont.Sy@exchange.sms.siemens.com
------------------------------
Date: Fri, 06 Nov 1998 14:44:28 +0100
From: Marco Vlemmings <marcov@ctrl-v.nl>
Subject: sending an email to two different email addresses
Message-Id: <3642FD3B.41D64D4E@ctrl-v.nl>
Hello,
I have a script which will send an email to one person.
Now i want to send the same email to two or more persons.
Can anybody help me?
With kind regards
Marco Vlemmings
email:marcov@ctrl-v.nl
------------------------------
Date: Fri, 6 Nov 1998 16:30:14 +0100
From: "Casema" <ours@casema.net>
Subject: Sendmail-code needed
Message-Id: <71v4oa$o2k$1@sun4000.casema.net>
Hi Group,
To send mail to ours@casema.net
subject : test
body: $boy
What would the perl code be?
Thanks,
Michel
------------------------------
Date: Fri, 6 Nov 1998 15:42:40 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: time question
Message-Id: <F20Bn4.J32@world.std.com>
Greg Coit <gbc1@axe.humboldt.edu> writes:
>I use :
>$mon = "0$mon" if ($mon < 10); #This ensures a two digit month
You might want to look at the printf and sprintf functions.
($hour, $min, $sec) = (localtime(time))[2,1,0];
$time = sprintf "%02d:%02d:%02d", $hour, $min, $sec;
But this doesn't answer the original question.
--
Andrew Langmead
------------------------------
Date: Fri, 6 Nov 1998 15:56:21 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: time question
Message-Id: <F20C9y.5DJ@world.std.com>
cadman <cadman@tikipub.com> writes:
>How can I get "Wed Oct 21 15:00:30 1998" into the time format in perl?
>So that it will show the above date as an integer number of seconds past
>midnight GMT, January 1, 1970.
Take a look at the Date::Parse module on CPAN.
<URL:http://reference.perl.com/module.cgi?Date::Parse>
use Date::Parse;
$secs = str2time('Wed Oct 21 15:00:30 1998');
--
Andrew Langmead
------------------------------
Date: Fri, 6 Nov 1998 09:00:29 -0600
From: Aaron Delong <delonad@netdoor.com>
Subject: Re: Using recv in Socket programming
Message-Id: <Pine.GSO.4.05.9811060857190.6477-100000@lance.netdoor.com>
There are several ways, I'm sure. The way I've used might not be the
best, but I'll share it with you anyway.
Basically, my code is assuming that all data it receives will be
terminated by a newline "\n". First it takes data from STDIN and
prints it to the socket. Then, it reads data from the socket one char
at a time until it encounters a newline. This loop continues
indefinitely actually....but here's the code.
while(<STDIN>) {
print S;
while ($content ne "\n") {
$content="";
recv(S, $content, 1, 0);
print $content;
}
On Thu, 5 Nov 1998, Arvind Krishnaswamy wrote:
> I want to use the recv function multiple times to get data from a socket
> into a buffer. The bytes of data vary with each recv (and this is not
> known). Is there any way I can use recv to do this? What is the
> alternative if I cannot use recv?
>
> If I specify a fixed number like 1000 for example, I may not get all
> data if it exceeds that number. The code basically looks like
>
> for (@querylist) {
> ....
> ....
> printf SOCKET $query;
> recv (SOCKET, $result, ???? , 0);
> }
>
> Thanks,
>
> Arvind
>
>
>
------------------------------
Date: 6 Nov 1998 09:49:18 -0500
From: sapief@cortez.sss.rpi.edu (Filipp Anthony Sapienza)
Subject: where to find irc - www gateway in perl?
Message-Id: <71v29e$1nva@cortez.sss.rpi.edu>
Hello. I am looking for a free Perl WWW script that acts as
a gateway to an IRC channel. Can someone tell me where I might
find such a script? Thank you.
Fil Sapienza
sapief@rpi.edu (please reply via email)
--
kk
------------------------------
Date: 06 Nov 1998 08:49:50 -0500
From: Brad Warkentin <bradw@ca.newbridge.com>
Subject: Re: Why is perl better than shell scripting language?
Message-Id: <op1zpa5szgh.fsf@ca.newbridge.com>
yong <yong@shell.com> writes:
> There's one situation I can think of I have to use the shell language,
> that is when I want to change the environment variables of the parent
> process.
Nope.... :-)
If you want to add/change/delete a single variable then sure, but if
you want to build environments, based on complex conditionals tis way
easier to do in perl. For instance we have a tool that builds tool
suite environments for CAE tools, which have all sorts of stupid
environmental variable requirements, many of which overlap.
Just have to have a shell wrapper that runs your perl program to build
a shell appropriate file and then sources that file. Source the
wrapper or better yet hide the Korn versus Csh versus Bash versus ?
syntactical differences behind an alias an you are done
Do it right and you have user independance across multiple os' and
shells, and only have to maintain 1 perl source, plus 1 trivial
wrapper script per shell you support.
bj
------------------------------
Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 4165
**************************************