[9119] in Perl-Users-Digest
Perl-Users Digest, Issue: 2737 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 27 15:08:49 1998
Date: Wed, 27 May 98 12:00:27 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 27 May 1998 Volume: 8 Number: 2737
Today's topics:
Re: 'insecure dependency in _____ when using setuid' in <mrbaseball2@rocketmail.com>
Re: c.l.p.misc is `perl support' (was Re: O'Reilly has <Russell_Schulz@locutus.ofB.ORG>
Re: c.l.p.misc is `perl support' (was Re: O'Reilly has <merlyn@stonehenge.com>
Re: Call another perl script (Jonathan Stowe)
Re: Clearly define "free software" (Mark Wooding)
Re: dead URL ? (Michael J Gebis)
Getting filesystem free space <nobroin@esoc.esa.de>
Re: Handling Dates Help Please <jc@ral1.zko.dec.com>
Re: hash of hashes in Berkeley DB? <zenin@bawdycaste.org>
Re: HOWTO : UDP ping ? (Greg Lindahl)
Re: HOWTO : UDP ping ? <zenin@bawdycaste.org>
Re: Invoking the Perl interpreter from DOS shell (Jonathan Stowe)
Job Postings <dtyree@genelogic.com>
Re: Modules in Perl (Jonathan Stowe)
Re: Need a "word-count" <tchrist@mox.perl.com>
Re: Need a "word-count" <lr@hpl.hp.com>
Re: Need a "word-count" <lr@hpl.hp.com>
Okay, NOW I'm confused (redirect) (Phil Buckley)
Perl32 on NT kzhu@tstc.edu
Re: Please help with silly problem... (brian d foy)
Re: Q: How much data will closure handle? (Lanny Ripple)
Re: Rand on NT perl <aqumsieh@matrox.com>
Special Variables bthak@bascom.com
Re: system question <aqumsieh@matrox.com>
using 'read' in a CGI script ? <daniel@webnet.fr>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 27 May 1998 13:12:57 -0500
From: Brad Bradley <mrbaseball2@rocketmail.com>
Subject: Re: 'insecure dependency in _____ when using setuid' in HP/UX 10.2
Message-Id: <356C57A9.9CFF0F4B@rocketmail.com>
> If I call a perl script from another program, if I try to use file
> activities, I get this
> message, it seems from the operating system, but I'm not sure. It works
> with
> file opens, `touch foo`, or anything trying to get at a file.
>
> Another solution was to use something to the effect of:
> su - bar -c script
> when calling from the program.
>
> Is there a "clean" way to get my script to work without wrapping it?
Scott,
I had the same problem and the best solution I found was to indeed wrap it.
Just do an Internet search on wrapsuid and you will get the program that will
wrap it for you. Change the ID of the script/C program you are running to the
permissions you need, and all is set. It is really quite a smiple process, jut
not too well documented.
Good luck,
Brad Bradley
------------------------------
Date: Wed, 27 May 1998 11:23:37 +0100
From: Russell Schulz <Russell_Schulz@locutus.ofB.ORG>
Subject: Re: c.l.p.misc is `perl support' (was Re: O'Reilly has helped promote the acceptance of Perl)
Message-Id: <19980527.112337.8K9.rnr.w164w@locutus.ofB.ORG>
Randal Schwartz <merlyn@stonehenge.com> writes:
> Please clarify your need for clarification. It seems mighty clear to
> me, and to the thousands of others that turn to my books and Usenet
> every day for help.
it seems `mightly clear' to me that the readers of c.l.p.misc do
NOT want to be `perl support', except for particularly interesting
problems.
there is a difference between `mundane support' and `homework', yet
it seems both requests are unwelcome.
(and when I think of `is this a supported product?', I don't usually
equate that with `did it ship with a manual?')
--
Russell_Schulz@locutus.ofB.ORG Shad 86c
------------------------------
Date: Wed, 27 May 1998 17:56:38 GMT
From: Randal Schwartz <merlyn@stonehenge.com>
Subject: Re: c.l.p.misc is `perl support' (was Re: O'Reilly has helped promote the acceptance of Perl)
Message-Id: <8c1ztfa980.fsf@gadget.cscaper.com>
>>>>> "David" == David Adler <dha@panix.com> writes:
David> I don't believe it. *You* need *help*? ;-)
Well, at least, that's what many people tell me. :-)
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 96 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: Wed, 27 May 1998 18:08:18 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Call another perl script
Message-Id: <356c5423.3745390@news.btinternet.com>
On Wed, 27 May 1998 18:34:21 +0200, Richard Amdi Madsen wrote :
>Hi,
>
>I try to have one perl program call another, an redirect the output to
>the browser. The secound program works, because I can call it directly,
>but the first one gives "Document contains no data" in Netscape?
>
>Thanks for your help,
>
<snip>
You almost certainly want to be calling your second script as a CGI
via the server. You can achieve this simply by using the LWP
(libwww-perl) suite of modules available from CPAN.
With the script as it stands you are going to end up with two
Content-type:" headers.
/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: 27 May 1998 17:47:37 GMT
From: mdw@catbert.ebi.ac.uk (Mark Wooding)
Subject: Re: Clearly define "free software"
Message-Id: <slrn6mokdp.6tn.mdw@catbert.ebi.ac.uk>
le Fanttme <fantome/@/usa/./net> wrote:
> And the two "best" editors that the open source community has to offer
> are both too difficult for the average person to use, as well as the
> fact that they don't produce formatted output without using a
> non-WYSIWYG presentation.
What on earth are you on about? Why should a text editor have anything
at all to do with producing formatted output? It's a text editor. It
edits text files. It's not a document formatter, or a word processor,
or anything else like that.
Perhaps you'd like your desktop calculator to be able to read news, or
your clock to be able to be able to accept SQL queries. To me, these
things are absurd, just as the idea that a text editor should do the job
of a document formatter is absurd.
> ... if they can even use Linux because it doesn't have consumer-grade
> software available.
So, what is this `consumer-grade' software you keep going on about?
What are the criteria? I'll offer a list of important features for
`consumer-grade' software, based on the what I see in popular
proprietary software:
* Unreliable. Consumer-grade software must crash regularly.
* Unusable. Consumer-grade software must treat the user as an idiot.
It must bury useful functionality beneath irritating and insulting
layers of menus and dialogue boxes.
* Unhelpful. Consumer-grade software must provide only obvious
information in help text. Error messages must be verbose and
unenlightening.
* Unautomatable. Consumer-grade software must make performing
repetitive tasks as awkward as possible, by keeping all the useful
functionality hidden behind condescending user interfaces, or
providing ill-documented and cumbersome scripting languages.
Essentially, consumer-grade software must sacrifice any form of
usefulness to an experienced user just so that people with low
intelligence and short attention spans can get poor quality output
without having to waste time finding out how to do the job properly.
Have I been venomous enough? I'm not sure I have.
This requirement for `consumer-grade' software is even applying to
development tools. And not just the Noddy-and-Bigears-query-a-database
tools either (although the results of letting the clue-impoverished near
such tools are rarely pretty): serious software development systems are
`consumer-grade' too. `Wizards' reduce program development to filling
in the blanks; compilers helpfully fail to diagnose common faults;
examples show the easy, poor way, instead of the robust, portable and
efficient way. And all in the name of `time-to-market'; all so that one
team of idiots can push low quality software out of the door faster than
the next. Who cares if it works or not, as long as it's out a week
before the next company's low quality offering? Instant gratification!
Keep the lowest common denominator happy! Cover everything with the
stench of mediocrity!
And people wonder why I've given up on proprietary software.
> How many decision makers know about open source software and just
> don't give a damn because no one in the open source movement to date
> has bothered to mess with usability tests ("just learn how to do it;
> we don't need to make it easier for you") much less a good WYSIWYG
> interface to layout.
Usability tests? I use Unix because it does what I tell it to, without
question, without hesitation, and because I can tell it what to do
quickly, simply, easily, by applying a few elementary concepts. That's
usable. Not some overweight overburdened monster with pretty windows
and pointless animations, worthless sounds and condescending messages;
layers of windows and menus, and dialogue boxes, and tiny undecipherable
icons which only exist as an attempt to delude the user about the way
the system really works.
Sure, I had to read the manual for a day or two, and I had to think a
bit. Not very hard; there's not really much to learn. And afterwards,
I can do what I need to much faster than I could with some drool-proof
windowing system in the way. Yes, I run X. I use it to preview
documents I've written in LaTeX, and to view images; it also lets me see
lots of information on the screen at once. It doesn't get in the way; I
told it not to.
A `WYSIWYG' interface can't hope to provide enough information to the
user. If my screen display looks like the printed output, how can I
tell whether a piece of text is indexed? How can I tell where the
targets of cross-references are? How can I tell which piece of text a
floating figure insertion is attached to? If you `enhance' the screen
display to show paragraph breaks, tab characters, indexing markers,
you've already left WYSIWYG behind. It's not a big step from an
abstract representation like this to a markup language, and it's not a
big step from clicking on little pictures to typing command names. And
then you've really got usability.
--
[mdw]
`Don't be too proud of this technological terror you've constructed.'
-- Darth Vader
------------------------------
Date: 27 May 1998 17:53:02 GMT
From: gebis@albrecht.ecn.purdue.edu (Michael J Gebis)
Subject: Re: dead URL ?
Message-Id: <6khjtu$jtu@mozo.cc.purdue.edu>
Wei Weng <wweng@attila.stevens-tech.edu> writes:
}How do I test a URL is deadlink or not?
Click on it.
--
Mike Gebis gebis@ecn.purdue.edu mgebis@eternal.net
------------------------------
Date: Wed, 27 May 1998 14:40:10 +0000
From: Niall O Broin <nobroin@esoc.esa.de>
Subject: Getting filesystem free space
Message-Id: <356C25CA.510ABCFD@esoc.esa.de>
How do I do the above ? I'm sure I saw mention of a Perl statfs once
upon a day, but I've looked everywhere (grepped the entire source,
DejaNews, CPAN) to no avail. I know that I can simply grab the output of
a df command, but I'd like a cleaner solution if there is one. I'd
appreciate CC'ed replies to me.
--
Kindest regards,
Niall O Broin
UNIX Network Administrator nobroin@esoc.esa.de
Ground Systems Engineering Department Ph./Fax +49 6151 90 3619/2179
European Space Operations Centre, Darmstadt, Germany
------------------------------
Date: Wed, 27 May 1998 10:24:32 -0400
From: John Chambers <jc@ral1.zko.dec.com>
Subject: Re: Handling Dates Help Please
Message-Id: <356C2220.7220B248@ral1.zko.dec.com>
...
> Today is 26/5/98, so the "today" script would take you to a page called
> 98-05-26.html -- but what I'd like to do is enable browsers to go backward and
> forward with buttons on the pages marked "Next Day" and "Previous Day".
>
> I know how to do this by adding/subtracting from the 26 and making it 27 or 25
> etc., but what happens when I get to 1 June? I'll end up with Previous Day
> being the zero of June and so on, won't I?
How about localtime(time-86400)?
86400 is 24*60*60, a useful number to memorize if you ever need to do
date/time calculations. If you store all timestamps in the second-count
form, and do all your arithmetic on that, the calculations become much,
much easier.
There's the minor problem of what happens if the page is sent at 23:59:57
and the user presses the button at 00:00:05 the next day. But most users
can probably deal with that.
------------------------------
Date: 27 May 1998 17:31:35 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: hash of hashes in Berkeley DB?
Message-Id: <896290732.138216@thrush.omix.com>
tarou@kormedia.com wrote:
: Just a quick question Is it possible to write a hash of hashes to a
: Berkeley DB file using Perl? I've tried it and I seem to be able to
: access it in the same script that loads the information from a flat
: file. The problem comes when I try to open the file and read the hash
: of hashes after loading it in another script.
: I am able to get the original key-value, but am unable to get the
: values from the next hash. Any ideas?
The MLDBM module, at your locat CPAN.
--
-Zenin
zenin@archive.rhps.org
------------------------------
Date: 27 May 1998 16:29:59 GMT
From: lindahl@pbm.com (Greg Lindahl)
Subject: Re: HOWTO : UDP ping ?
Message-Id: <6khf27$rl6@news3.newsguy.com>
Calle Dybedahl <qdtcall@esb.ericsson.se> writes:
> "Jerome Gay" <gay@aspentech.com> writes:
>
> > I need some kinda "UDP ping" and I'm pretty sure perl can do it... how ?
>
> RTFM Net::Ping
pingecho() uses a TCP echo (not an ICMP one) to determine
if the remote host is reachable.
I don't know of anyone who's implemented UDP ping in perl, and tcp
ping is not appropriate for all applications.
-- g
------------------------------
Date: 27 May 1998 17:45:45 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: HOWTO : UDP ping ?
Message-Id: <896291582.32277@thrush.omix.com>
Greg Lindahl <lindahl@pbm.com> wrote:
: Calle Dybedahl <qdtcall@esb.ericsson.se> writes:
: > "Jerome Gay" <gay@aspentech.com> writes:
: >
: > > I need some kinda "UDP ping" and I'm pretty sure perl can do it... how ?
: >
: > RTFM Net::Ping
:
: pingecho() uses a TCP echo (not an ICMP one) to determine
: if the remote host is reachable.
:
: I don't know of anyone who's implemented UDP ping in perl, and tcp
: ping is not appropriate for all applications.
...Where did you get this above "quote"? It's not from the
current Net::Ping, which does fully support UDP, TCP, and ICMP
(with root ID) ping.
--
-Zenin
zenin@archive.rhps.org
------------------------------
Date: Wed, 27 May 1998 18:08:10 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Invoking the Perl interpreter from DOS shell
Message-Id: <356c490f.1162597@news.btinternet.com>
On Wed, 27 May 1998 11:21:49 -0400, Ajit Mandalay wrote :
>I am in the process of learning Perl, and would like to know how the
>Perl interpreter can be invoked from a file containing Perl script and
>have it interpret the script in the file in a DOS or Windows
>environment. Does the file have to have a special extension? Any
>suggestions would be highly appreciated.
>
On Win/Dos systems (using the standard command interpreter) one doesnt
have the advantage of the shebang (#!) construct that is available on
unix and similar systems.
You can always run your script thus:
C:\>perl myscript.pl
But you get tired of typing that perl all the time.
With the "standard" distribution you will get a file called pl2bat.bat
that will encapsulate your Perl program in a DOS batch file that can
be run just like any other.
On NT you can also use the ASSOC command to associate an interpreter
with a filetype such as .pl. ASSOC /? will fill you in on the details
for that.
An alternative that will appeal to those of us who are Unix
programmers stuck in a Windows body is to get hold of the Cygwin32
port of the GNU shell ( from <URL:http://www.cygnus.com/>) and the
various other utilities. Once you have got this working you will be
able to use the #!/perl/bin/perl construct as you would with Unix.
However if you are using networked drives you may have a problem as
the Perl script's filename is passed to perl in a format that perl
itself doesnt recognize unless you have compiled your own perl with
Cygwin32.
Have Fun
/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: Wed, 27 May 1998 14:12:15 -0400
From: Darryl Tyree <dtyree@genelogic.com>
Subject: Job Postings
Message-Id: <356C577F.27782F86@genelogic.com>
Hi-
My name is darryl tyree and I am the HR Specialist at Gene Logic Inc. I
would like to know what I need to do to place job openings on your site?
Pleas reply asap.
Thank you,
Darryl Tyree
------------------------------
Date: Wed, 27 May 1998 18:08:16 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Modules in Perl
Message-Id: <356c4ee4.2655294@news.btinternet.com>
On Wed, 27 May 1998 15:56:57 GMT, J wrote :
<snip>
>but every time I include this in the script the server throws back a 500
>Error......
<snip>
>what am I doing wrong?
>
Does the script run correctly from the shell ?
If you are using CGI.pm (and I strongly advise you to do so) you can
do:
use CGI::Carp qw(fatalsToBrowser);
to catch any errors that you might get. Read the perldoc on it.
Alternatively you might put one of these similar things right at the
beginning of your script:
>From Randal Schwartz:
## death handler, presumes no output yet
$SIG{'__DIE__'} = $SIG{'__WARN__'} = sub {
my $error = shift;
chomp $error;
$error =~ s/[<&>]/"&#".ord($&).";"/ge; # entity escape;
print "Content-type: text/html\n\n[$error]\n";
exit 0;
};
>From Larry Rosler:
## death handler, presumes no output yet
$SIG{'__DIE__'} = $SIG{'__WARN__'} = sub {
print "Content-type: text/plain\n\n", shift;
exit 0;
};
Either of these will print some diagnostic stuff to your browser.
/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: 27 May 1998 17:44:54 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Need a "word-count"
Message-Id: <6khjem$505$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
[which lr evilly didn't indicate in his private mail to me!!!!!]
In comp.lang.perl.misc, "Larry Rosler" <lr@hpl.hp.com> writes:
:Actually, they're not. It works perfectly well without them.
My point is that spaces matter in quotes where they don't
outside them.
print "I have $a->[3]";
print "I have $a -> [3]";
print "I have $a[3]";
print "I have $a [3]";
--tom
--
There are probably better ways to do that, but it would make the parser
more complex. I do, occasionally, struggle feebly against complexity... :-)
--Larry Wall in <7886@jpl-devvax.JPL.NASA.GOV>
------------------------------
Date: Wed, 27 May 1998 10:47:09 -0700
From: "Larry Rosler" <lr@hpl.hp.com>
Subject: Re: Need a "word-count"
Message-Id: <6khjin$anp@hplntx.hpl.hp.com>
Charlie Stross wrote in message ...
>On Wed, 27 May 1998 09:04:06 -0700, Larry Rosler
><lr@hpl.hp.com> wrote:
>
>>I was slightly concerned by the original submitter's use of the token
>>'->' when all he wanted was the appearance of an arrow. Apparently
the
>>perl lexer doesn't see the syntax there either.
>
>Yeah, I noticed that double-quoting seems to prevent interpretation
>of symbolic refs some time ago (though I have to admit, I still felt
>the need to include those spaces!). Is this potentially a problem? If
>nothing else, it seems to me to be something of a linguistic
>inconsistency ...
>
>
>-- Charlie
But these are not "symbolic refs" -- they are hard refs.
I was getting even more confused, so I expanded the previous example to
look like this:
my %words = (foo => 4, bar => 2);
print map "$_->$words{$_}\n", sort keys %words;
my @words = ([foo => 4], [bar => 2]);
print map "$_->[0]=>$_->[1]\n", @words;
__END__
bar->2
foo->4
foo=>4
bar=>2
And the last line fails to compile if the '=>' is replaced by '->'.
While I was writing this, Tom C. sent the following by email:
My point is that sometimes -> is special in strings, sometimes not.
I'll say! Apparently, if the '->' follows the scalar immediately
(without spaces) and the thing immediately following the '->'
syntactically resolves a ref -- [index] or {key} -- the expression is
compiled that way. Otherwise, the '->' is compiled as simply '->'. A
great example of dwimming, I think, and a great surprise to those of us
used to C's dogged left-to-right token-at-a-time lexing.
--
Larry Rosler
Hewlett-Packard Laboratories
lr@hpl.hp.com
------------------------------
Date: Wed, 27 May 1998 11:21:39 -0700
From: "Larry Rosler" <lr@hpl.hp.com>
Subject: Re: Need a "word-count"
Message-Id: <6khljj$bgp@hplntx.hpl.hp.com>
[courtesy cc of this posting sent to cited author via email]
[which lr evilly didn't indicate in his private mail to me!!!!!]
Tom Christiansen wrote in message
<6khjem$505$1@csnews.cs.colorado.edu>...
> [courtesy cc of this posting sent to cited author via email]
> [which lr evilly didn't indicate in his private mail to me!!!!!]
Evil is very much in the eye of the beholder, and perhaps you need a
vision test. Fully aware of your fetish in this regard, I carefully cut
and pasted exactly the superscription in your post when I responded, as
I have done again above. Here is the letter you refer to, verbatim:
: [courtesy cc of this posting sent to cited author via email]
:
: Tom Christiansen wrote in message
: <6khc3j$nan$2@csnews.cs.colorado.edu>...
: > [courtesy cc of this posting sent to cited author via email]
: >
: >In comp.lang.perl.misc,
: > "Larry Rosler" <lr@hpl.hp.com> writes:
: >:print map "$_ -> $words{$_}\n", sort keys %words;
: > ^ ^
: >
: >Boy, those space are sure important there!
: >
: >--tom
As for the real point of all this:
>In comp.lang.perl.misc, "Larry Rosler" <lr@hpl.hp.com> writes:
>:Actually, they're not. It works perfectly well without them.
>
>My point is that spaces matter in quotes where they don't
>outside them.
>
> print "I have $a->[3]";
> print "I have $a -> [3]";
>
> print "I have $a[3]";
> print "I have $a [3]";
>
>--tom
>--
>There are probably better ways to do that, but it would make the parser
>more complex. I do, occasionally, struggle feebly against
complexity... :-)
> --Larry Wall in <7886@jpl-devvax.JPL.NASA.GOV>
Yes. I (and perhaps others) have profitted from this (newly revealed?)
insight.
Are you quite sure that the Wall quotes are random? This one seems very
much to the point :-).
--
Larry Rosler
Hewlett-Packard Laboratories
lr@hpl.hp.com
------------------------------
Date: Wed, 27 May 1998 18:19:57 GMT
From: pbuckley@tiac.net (Phil Buckley)
Subject: Okay, NOW I'm confused (redirect)
Message-Id: <356c5897.23593974@News.Varian.COM>
Last week I solicited some advice about a redirect script, well I got
that working, except it still lets SOME people from that domain
through! It works for some, but not on others, any ideas???
here's the perl:
#!/usr/local/bin/perl
# Simple domain restriction script
# Created by Phil Buckley
# Created on: 5/21/98 Last Modified on: 5/27/98
# Version 1.0
################################################################
# Variables
$res_dom = "varian.com";
$varian_url = "http://www.tiac.net/users/intstute/varian.shtml";
$other_url = "http://www.tiac.net/users/intstute/private.shtml";
################################################################
$host = "$ENV{'REMOTE_HOST'}";
$packed_ip_addr = pack ("C4", $host =~
/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/);
if ($host = gethostbyaddr $packed_ip_addr, 2) { # If they are coming
from Varian
print "Location: $varian_url\n\n";
}
else { # For any other domain
print "Location: $other_url\n\n";
}
Thanks in advance,
Phil
pbuckley@tiac.net
------------------------------
Date: Wed, 27 May 1998 17:53:36 GMT
From: kzhu@tstc.edu
Subject: Perl32 on NT
Message-Id: <6khjv0$r0c$1@nnrp1.dejanews.com>
Dear sir,
I am running NT4 server on a PC, and I need Perl for it. I don't have C
compiler on NT. So, I download binary Perl32 called WP32i316.exe from
www.activestate.com, and run this exe file. Is that all I need to do ? What
directory should I put Perl32 in? My web documents are all stored in
\InetPub\Mywebsite. In InetPut directory, I created Perl32 directory
and all perl stuff is here.
I have successful experience of downloading and compiling Perl5 for my Unix
box. I wish someone would help me out with the installation of Perl32 on NT
with a comparison to a Unix environment, so that I can understand better.
Thanks for your help.
Kelly Zhu
Internet/Web Librarian
Texas State Technical College
(254)867-2348
(254)867-2339(fax)
http://libgate.tstc.edu
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Wed, 27 May 1998 13:08:29 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Please help with silly problem...
Message-Id: <comdog-ya02408000R2705981308290001@news.panix.com>
Keywords: from just another new york perl hacker
In article <356BE2A6.3021@calabama.com>, tim@calabama.com posted:
>If I call the script from a browser , it does not respond the same way.
>a file is NOT creatd if it does not exist already . It also seems to NOT
>append an existing file.
see the helpful information in the CGI Meta FAQ, especially the
Idiot's Guide to Solving Perl CGI Problems.
good luck :)
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers T-shirts! <URL:http://www.pm.org/tshirts.html>
------------------------------
Date: 27 May 98 17:22:18 GMT
From: lanny@cisco.com (Lanny Ripple)
Subject: Re: Q: How much data will closure handle?
Message-Id: <lanny.356c4bca@lanny-ss20.cisco.com>
Tom Phoenix (rootbeer@teleport.com) wrote:
>
> Perl doesn't impose a specific limit. If your program isn't working with
> large arrays, that may be due to a bug in Perl or in your code. Can you
> cut it down to a simple test case which doesn't do what you think it
> should? Try to make it fewer than a dozen lines or so. Thanks!
>
Here's a full script to generate the error.
--
#!/opt/perl/bin/perl -w
use strict;
use IO::File;
my $USAGE = "usage: fgrep.pl [-v] patterns_file input_file\n";
my $opt_v = 0; $opt_v = 1, shift if ( @ARGV && $ARGV[0] eq '-v' );
my $patterns = shift || die $USAGE;
my $input = shift || die $USAGE;
my $fh = IO::File->new($patterns, 'r');
my @ptrn_list = <$fh>;
chomp(@ptrn_list);
$fh->close();
my $match = bm_or(@ptrn_list);
$fh = IO::File->new($input, 'r');
while ( <$fh> ) {
print $_ if ( $opt_v ^ &$match );
}
$fh->close();
## subs
sub _bm_build {
my $condition = shift;
my @regex = @_; # my() for closure.
my $expr = join $condition => map { "m/\$regex[$_]/io" } (0..$#regex);
my $match_func = eval "sub { $expr }";
die if $@; # die if error during eval
return $match_func;
}
sub bm_and { _bm_build('&&', @_) }
sub bm_or { _bm_build('||', @_) }
__END__
% /opt/perl/bin/perl -v
This is perl, version 5.004_04 built for sparc-sun-solaris2.5.1
Test input:
for ( $c = 0, $a = 'aaaaa'; $c < 200; ++$c, ++$a ) {
print $a, "\n";
}
Test patterns:
for ( $c = 0, $a = 'aaaaa'; $c < 100; ++$c, ++$a ) {
print $a, "\n";
}
The above patterns and input work. Increasing the number of
patterns to 101 gives the following error:
Global symbol "regex" requires explicit package name at (eval 1) line 1.
Use of uninitialized value at ./fgrep.pl line 20, <GEN1> chunk 1.
Can't use string ("") as a subroutine ref while "strict refs" in use at
./fgrep.pl line 20, <GEN1> chunk 1.
I've tried different data (usernames from a group file) and the
magic number of patterns still seems to be 101 to generate the error.
-ljr
--
Lanny Ripple <lanny@cisco.com> Voice: (408) 527-0328
ECS / Cisco Systems, Inc. Pager: (408) 814-8224
Fax : (408) 526-4575
------------------------------
Date: Wed, 27 May 1998 11:38:19 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Rand on NT perl
Message-Id: <356C336B.CAECF4A0@matrox.com>
gbm@my-dejanews.com wrote:
> Hi,
> I have problems running the rand function on NT perl.
> When I run the function $number = int(rand 5) I allways get the same number
> in $number.
> I tryed it with the command line and on the NT server and I get the same
> result.
> Is there a bug with the function or do I need to use another one?
>
No .. computers can't generate totally random numbers, only pseudorandom. So,
they have to start somewhere and you are always starting from the same spot.
You should "seed" your pseudorandom number generator.do an srand() somewhere
in your script (only once!)
for example:
srand(time);
or
srand($$);
> Cheers,
>
> Guillaume.
I also heard, from reliable sources, that with the upcoming new version of
perl, an srand is not needed anymore (but it doesn't hurt to have it anyway)!
Regards,
--
Ala Qumsieh | No .. not just another
ASIC Design Engineer | Perl Hacker!!!!!
Matrox Graphics Inc. |
Montreal, Quebec | (Not yet!)
------------------------------
Date: Wed, 27 May 1998 18:43:59 GMT
From: bthak@bascom.com
Subject: Special Variables
Message-Id: <6khmtg$3u$1@nnrp1.dejanews.com>
Is there a special variable that holds the value of the last failed match.
Consider the following code..
@array = qw(123 34455 35 4r6 8654 687688);
foreach $index (0..$#array){
if $array[$index] =~ /^\d+$/){
$count++;
}
else {
print "Not all digits";
last;
}
}
I would like to get the vaule of the non digit part. Simple put (i think) the
value where the loop breaks out. Is it stored in a special variable such as $_
is the value of last successful match.
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Wed, 27 May 1998 11:47:41 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: system question
Message-Id: <356C359D.B6DBEE39@matrox.com>
the count wrote:
> But then I had the idea: what if I could generalize this to run
> ANY command on a bunch of files? Specify the command to run as
That should make life easy!
> the first argument, and run it on the rest of @ARGV. Only, I am
> not particularly sure how to proceed. I tried:
>
> command.pl
> ----------
> @ARGV = ('-') unless @ARGV;
> $command = shift; # Yes, I need to check for the existance of this...
>
> while ($ARGV = shift) {
> system "$command";
> }
>
> But, I am not even sure how to run it:
> perl -w command.pl 'dos2unix $ARGV > tmp; mv tmp $ARGV' *.txt
>
Hmm.. you are hoping that $ARGV, which would hold the value "*.txt", to
interpolate into the $command which contains 'dos2unix $ARGV > tmp; mv
tmp $ARGV' ... but .. mind the single quotes which don't allow that!
> This fails - it seems to start processing the first file:
It doesn't actually process the first file ... it's trying to process a
file whose name is specified in the environment variable ARGV. Usually,
that variable is not defined.
> could not open /dev/kbd to get keyboard type US keyboard assumed
> could not get keyboard type US keyboard assumed
This has nothing to do with the system command. This is due to the
dos2unix command.
> But then just hangs.
> tmp exists, but is empty.
>
> Any pointers on how to go about doing this?
Well, the quick and easy way, without greatly modifying your code, is
to add a simple regexp statment right before your system call:
$command =~ s/\$ARGV/$ARGV/g;
This should replace all occurences of '$ARGV' with the value within the
variable $ARGV.
Hope that helps,
--
Ala Qumsieh | No .. not just another
ASIC Design Engineer | Perl Hacker!!!!!
Matrox Graphics Inc. |
Montreal, Quebec | (Not yet!)
------------------------------
Date: Thu, 28 May 1998 20:13:41 +0200
From: Daniel FAUXPOINT <daniel@webnet.fr>
Subject: using 'read' in a CGI script ?
Message-Id: <356DA954.9651C58D@webnet.fr>
Hi,
Not sure this is the appropriate place to post this, please route me
somewhere else if appropriate.
I work with perl 5 under win NT 4 WS.
I would like to use
read(STDIN, $in, $ENV{'CONTENT_LENGTH'}, 0);
in a perl script that processes a form.
The script seems to stay stuck on the call to 'read' when I submit my
form from any browser.
The same script ran manually from command line works nicely when I set
the appropriate environement variables, launch the script and enter a
line and press enter.
I've tried to add
$^W=0;
binmode STDIN;
before the call, as seen in CGI.pm (where 'read' is used to read the
query string from STDIN too), but without succes.
I know CGI.pm does all I need to get my parameters, but I would like to
understand why I can't get 'read' to work.
Any suggestion ?
Thanks in advance,
Daniel
daniel@webnet.fr
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.
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 2737
**************************************