[8775] in Perl-Users-Digest
Perl-Users Digest, Issue: 2391 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Apr 22 16:17:22 1998
Date: Wed, 22 Apr 98 13:00:38 -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, 22 Apr 1998 Volume: 8 Number: 2391
Today's topics:
Re: 'wait' under perl5.004 (possibly a perl bug?) <Michael.Francis@gs.com>
Re: 'wait' under perl5.004 (possibly a perl bug?) <jdf@pobox.com>
Re: array elements -- how to exclude when reading in? <lr@hpl.hp.com>
Re: ask people to wait (brian d foy)
Re: Calculating business dates? (Tom Mornini)
Re: Changing case of specific characters in string (brian d foy)
Re: Command line instructions don't execute in Win95 <jdf@pobox.com>
Re: control characters!! tigger@io.com.nospaam
Re: Defending Perl (Mark-Jason Dominus)
Re: Defending Perl (brian d foy)
Re: fixed width text files <barnett@houston.Geco-Prakla.slb.com>
Get keystroke immediately without <RETURN> (Michael Haertfelder)
Re: Get keystroke immediately without <RETURN> (Mark-Jason Dominus)
Re: Get keystroke immediately without <RETURN> (Abigail)
Re: How can I get the correct answer? (Bart Lateur)
Re: How to read lines between two keywords in a file (Kevin Reid)
Re: Image can view but cannot download? (brian d foy)
Re: Nested Multiline array sort help needed! <jdf@pobox.com>
Re: Perl and IIS 4.0 <tony@cyberscape.net>
Re: Perl and IIS 4.0 (Michael Rubenstein)
Re: print $fh redefinition (Kevin Reid)
Re: print multiple lines before or after match ? (brian d foy)
Re: print reverse pack strangeness? <andrew@erlenstar.demon.co.uk>
Re: Problem creating users on an NT server via Perl scr <rootbeer@teleport.com>
Re: Q: Simple RegExp match help required... (Craig Berry)
Re: Question on: printf %o STDOUT <jamesr@aethos.co.uk.nospam>
Re: Question on: printf %o STDOUT (brian d foy)
Re: Random Number Generation PERL 5.0 <jdf@pobox.com>
regexp to return list of matches from string (William York)
Re: regexp to return list of matches from string <rootbeer@teleport.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 22 Apr 1998 09:44:12 +0100
From: Michael Francis FIR LDN <Michael.Francis@gs.com>
Subject: Re: 'wait' under perl5.004 (possibly a perl bug?)
Message-Id: <353DADDB.AEE4D00C@gs.com>
This is a multi-part message in MIME format.
--------------D1351BB3A81A5F9CAFCFB067
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Ok, here is the test program again. Incidentally this is a cut down
version of my full code, i.e. I have not replicated all the checks that
the full code uses, just the minimum to show the problem. The output
from this code is as follows -
First without the alarm going off (i.e. what I expect to see.)
[spud:~/perltest]%./test.pl
Child 14402 exited
Child 14394 exited
Child 14398 exited
Child 14400 exited
Child 14395 exited
Child 14401 exited
Child 14393 exited
Child 14396 exited
Child 14399 exited
Child 14397 exited
All children are dead
[spud:~/perltest]%
Next with the command line flag (i.e. with the signal handler.)
- This is what I don't expect to see. (and would work correctly in
C/C++)
[spud:~/perltest]%./test.pl -alarm
All children are dead
[spud:~/perltest]%
Now looking at the process list -
[spud:~/perltest]%ps -auxww | grep sleep
francm 14472 0.0 0.0 16 0 p2 IW 09:34 0:00 /bin/sleep 33
francm 14476 0.0 0.0 16 0 p2 IW 09:34 0:00 /bin/sleep 68
francm 14475 0.0 0.0 16 0 p2 IW 09:34 0:00 /bin/sleep 68
francm 14467 0.0 0.0 16 0 p2 IW 09:34 0:00 /bin/sleep 56
francm 14473 0.0 0.0 16 0 p2 IW 09:34 0:00 /bin/sleep 53
francm 14468 0.0 0.0 16 0 p2 IW 09:34 0:00 /bin/sleep 86
francm 14469 0.0 0.0 16 0 p2 IW 09:34 0:00 /bin/sleep 44
francm 14474 0.0 0.0 16 0 p2 IW 09:34 0:00 /bin/sleep 50
francm 14471 0.0 0.0 16 0 p2 IW 09:34 0:00 /bin/sleep 56
francm 14470 0.0 0.0 16 0 p2 IW 09:34 0:00 /bin/sleep 44
This shows that the forks all worked correctly and that they correctly
exec'd the sub processes. The 'wait' call correctly blocked during the
first time-out period, but when called again returns -1.
Mike
--------------D1351BB3A81A5F9CAFCFB067
Content-Type: application/x-perl; name="test.pl"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="test.pl"
#!/wrk/perl/bin/perl
#
# Simple program showing the problem with wait.
$time_out = 5;
for($i = 0; $i < 10; $i++)
{
# Set a delay between 30 and 90 secs
$delay = int(rand(60))+30;
# 'bulletproof' checks .....
FORK:
{
if ($pid = fork)
{
# This is the parent process
}
elsif ( defined $pid )
{
# $pid is 0, this is the child process
exec("/bin/sleep $delay");
exit(1);
}
elsif ( $! =~ /No more processs/)
{
# EAGAIN recoverable fork error
sleep 5;
redo FORK;
}
else
{
# strange error
die "Can't fork: $!\n";
}
}
}
# Created 10 processes
# Install the signal handler
$SIG{'ALRM'} = \&alarm_handler;
# Start the timer
alarm($time_out) if ($ARGV[0] =~ /-alarm/);
while(($pid = wait) != -1)
{
print "Child $pid exited\n";
}
print "All children are dead\n";
exit(0);
sub alarm_handler
{
alarm($time_out);
}
--------------D1351BB3A81A5F9CAFCFB067--
------------------------------
Date: 22 Apr 1998 11:00:20 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: Michael Francis FIR LDN <Michael.Francis@gs.com>
Subject: Re: 'wait' under perl5.004 (possibly a perl bug?)
Message-Id: <yawx978r.fsf@mailhost.panix.com>
[posted and mailed]
Michael Francis FIR LDN <Michael.Francis@gs.com> writes:
> This is a multi-part message in MIME format.
Please, please do not use MIME in Usenet posts. Plain text is the
specified medium. Thanks.
> sleep 5;
[snip]
> alarm($time_out) if ($ARGV[0] =~ /-alarm/);
[snip]
> alarm($time_out);
Perlfunc's description of the alarm builtin states:
It is usually a mistake to intermix alarm() and sleep() calls.
Under sleep, it says
You probably cannot mix alarm() and sleep() calls, because sleep()
is often implemented using alarm().
I'm not sure whether this is related to the trouble you're
experiencing, but it's worth noting.
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
------------------------------
Date: Wed, 22 Apr 1998 10:55:55 -0700
From: "Larry Rosler" <lr@hpl.hp.com>
Subject: Re: array elements -- how to exclude when reading in?
Message-Id: <6hlav1$3oj@hplntx.hpl.hp.com>
Craig Berry wrote in message <6hl989$o01$1@marina.cinenet.net>...
>Jason Gloudon (jgloudon@hyssop.bbn.com.bbn.com) wrote:
>: Jonathan Feinberg <jdf@pobox.com> wrote:
>: >mshavel@erols.com (Michael Shavel) writes:
>: >In which case
>: >
>: > while(<>) {
>: > next if /\026/;
>: > push @records, $_;
>: > }
>:
>: or if he's just interested in filtering before processing one could
say
>:
>: @records = map { /\026/ ? () : $_ } <>;
>
>How's that different (other than being less clear) from
>
> @records = grep !/\026/, <>;
>
>?
It is significantly slower, too :-) [I posted the Benchmarks on this
yesterday.]
But note that this "selective map" (someone called it "grap" yesterday,
for "grep and map") lets you do interesting things with $_ rather than
simply pass it along, as in the above example.
--
Larry Rosler
Hewlett-Packard Laboratories
lr@hpl.hp.com
------------------------------
Date: Wed, 22 Apr 1998 14:37:32 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: ask people to wait
Message-Id: <comdog-ya02408000R2204981437320001@news.panix.com>
Keywords: from just another new york perl hacker
[follow-ups set]
In article <6hk9j9$h1n@eng-ser1.erg.cuhk.edu.hk>, Sleep <mhchau@cse.cuhk.edu.hk> posted:
> I am writing a CGI(Perl of course :) programme that will verify
>a user and then do a search in another server. The problem is that
>Internet always has traffic congession. And the search may take up to few
>mins which, I believe, will confuse the user that the machine is hang !
> So I want to prompt a messag when the user suceed in the verification
> but searching hasn't finish. I've try the "server push" technique to
>show the user a page of "warning" and it work fine, but unlucky it's a
>Netscape "product" & so M$ doesn't "like" it :(
i kinda like putting a message on the search page that says "this may
take a few minutes. please be patient" :)
>PS. I don't know which newgroup should I post. So please forward this post
>to a more appropraite one if u think it is :P
if you want a high technology solution, you probably want to ask in
comp.infosystems.www.authoring.cgi, but not before checking the FAQs
referenced in the CGI Meta FAQ.
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 <URL:http://www.pm.org>
------------------------------
Date: Wed, 22 Apr 1998 06:48:20 GMT
From: tmornini@netcom.com (Tom Mornini)
Subject: Re: Calculating business dates?
Message-Id: <tmorniniErsywK.K98@netcom.com>
Timothy Reed (treed@cpr.com) wrote:
: Hi,
: I need to determine if a given date falls (or fell) on a business date. I also
: need to tell if a day x days ahead or behind is a business date or note. Has
: anyone worked out a solution in Perl?
Check CPAN for Date::Manip. Even handles custom holiday schedules. :-)
-- Tom Mornini
-- InfoMania
------------------------------
Date: Wed, 22 Apr 1998 15:09:18 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Changing case of specific characters in string
Message-Id: <comdog-ya02408000R2204981509180001@news.panix.com>
Keywords: from just another new york perl hacker
In article <Pine.GSO.3.96.980422094512.6132O-100000@user2.teleport.com>, Tom Phoenix <rootbeer@teleport.com> posted:
>On Wed, 22 Apr 1998 martinja@exis.net wrote:
>
>> I believe Perl can do this, but I'm not sure how to do it. I want uppercase
>> all characters inside of <>, but not uppercase characters inside of inner
>> quotation marks. Example <img src="home.gif"> becomes <IMG SRC="home.gif">.
>
>You (almost certainly) want to parse HTML. There is a module HTML::Parse
>on CPAN which should be useful. Hope this helps!
HTML::Parse is deprecated in favor of HTML::Parser. Gisle posted a nice
example in this newsgroup, so you might check DejaNews [1] for it.
[1] DejaNews - <URL:http://www.dejanews.com>
--
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 <URL:http://www.pm.org>
------------------------------
Date: 21 Apr 1998 09:23:42 -0500
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: Command line instructions don't execute in Win95
Message-Id: <vhs3qmmp.fsf@mailhost.panix.com>
"Allan M. Due" <due@discovernet.net> writes:
> It runs fine but if I enter the same commands at the Dos prompt (home) I
> receive the following error message:
>
> Can't find string terminator "'" anywhere before EOF at -e line 1.
The DOS shell (and its descendants) do not recognize ' as a quote
character. When writing one-liners on DOS boxes, you must use " to
keep the program text intact, and the q// and qq// operators to quote
things in Perl.
C:\> perl -MConfig -e "print qq(Darn this $Config{sh}!\n)"
There is a FAQ entry for this question in perlfaq3, "Why don't perl
one-liners work on my DOS/Mac/VMS system?" but I don't advocate the
use of escaped quotes. I like the q// qq// solution better. Please
do read perlfaq3, though.
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
------------------------------
Date: 22 Apr 1998 18:46:05 GMT
From: tigger@io.com.nospaam
Subject: Re: control characters!!
Message-Id: <6hldtd$chr$1@nntp-3.io.com>
Well, I'm just starting out in perl, so I don't know if there is a better way,
but you could specify the control character in octal notation. I don't know
what the octal for ^M is, but ^G (BEL) is, for example, \007.
Michael Russo <russo02@zon.eelab.newpaltz.edu> wrote:
> I'm trying to write a script to remove '^M' and replace it with control-M,
> which looks like '^M', but is only one character. (In vi, you would type
> <ctrl-V><ctrl-M> to achieve this.) I can't seem to make any progress.
> The search-replace operator sees '^M' as two seperate characters...
--
---------------------------------------------------------------------
On the side of the software box, in the "System Requirements" section,
it said "Requires Windows 95 or better". So I installed Linux.
---------------------------------------------------------------------
------------------------------
Date: 22 Apr 1998 14:37:17 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Defending Perl
Message-Id: <6hldct$akm$1@monet.op.net>
Keywords: bench bend glimpse sway
In article <353e152d.10406811@news>, Marjorie Roswell <roswell@umbc.edu> wrote:
>Anonymous contributor says:
>>since it is interpreted it has some installation problems.
Anyone who sees an implicit connection between `interpreted' and
`installation problems' must have a real pointy little head.
------------------------------
Date: Wed, 22 Apr 1998 14:54:56 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Defending Perl
Message-Id: <comdog-ya02408000R2204981454560001@news.panix.com>
Keywords: from just another new york perl hacker
In article <353e152d.10406811@news>, roswell@umbc.edu (Marjorie Roswell) posted:
>I'd like to answer the fellow who wrote this in response to my brief
>perl advocacy on a mailing list.
>
>"Perl does indeed offer alot of power, especially when working with
>data. (And its being free certainly doesn't hurt!!) However, it
>offers problems as well. Very few people use Perl, and since it is
>interpreted it has some performance and installation problems. It is
>almost easier to work in the power of C or C++.
one would have to define "easier".
>So: How many people use perl?
i don't know if this is a good question - my boss, a classically
trained musician, points out a similiar question - "how many
violinists are there in the world?". the answer may be very
misleading since there may be millions of people who call themselves
violinists, but only a couple thousand whom people might pay to
hear.
>Does it have performance problems?
do you want your program this week or next year? i think a couple
of microseconds lost in compilation is more than made up for in
development time. perhaps you should ask for benchmarks when
people say these sorts of things :)
let's not forget the important question: which language is more
fun to use? i would hate my job if i had to use C. (and i did
last week and i didn't have a good time). :)
>Oh, the fellow was responding to my query about whether folks were
>writing GIS translators in Perl. I'm sad to see only one "geographic"
>application at www.perl.com. I bet there's thousands out there that
>people simply haven't submitted.
well, feel free to submit :)
--
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 <URL:http://www.pm.org>
------------------------------
Date: Wed, 22 Apr 1998 13:11:29 -0500
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: fixed width text files
Message-Id: <353E32D1.C0F7D078@houston.Geco-Prakla.slb.com>
Jeff wrote:
>
> I have a text file with approximately 400 rows. Each row has 31
> columns, and each column has a different width.
Ok.
> I'm a newbie so if
> this elementary question frustrates anyone I apologize.
No particularly.
> But, how can
> I read from this file and set the width for each individual column so
> I can reference them?
>
I'm not exactly sure what you mean by getting the width, but
length($yourVariable);
Will tell you how many characters are in $yourVariable.
> TIA,
> Jeff
How are the fields divided? Comma-delimited? Double colon (::)?
Space? Tab?
All very relevant information.
Maybe a few sample lines of the input file, and what you've tried (aka a
code snippet) would be appropriate?
For help without providing the above, please post to
comp.lang.perl.psychic
No one here (at least not me) is psychic. We're willing to help those
who (at least attempt to) help themselves.
HTH.
Dave
--
"Security through obscurity is no security at all."
-comp.lang.perl.misc newsgroup posting
----------------------------------------------------------------------
Dave Barnett U.S.: barnett@houston.Geco-Prakla.slb.com
DAPD Software Support Eng U.K.: barnett@gatwick.Geco-Prakla.slb.com
----------------------------------------------------------------------
------------------------------
Date: 22 Apr 1998 18:51:00 +0200
From: haert@wharp.rhein-main.de (Michael Haertfelder)
Subject: Get keystroke immediately without <RETURN>
Message-Id: <6sMxCfdFZZB@wharp.rhein-main.de>
Well, the headline said it already:
Let's say I push the "a" on the keyboard (without the <RETURN>
afterwards).
Is it possible to give the perl script the control for the further
processing ?
As far as I know there is another tiny, external program necessary ?
What about the special keys <F1>,...<F12> ?
How is this done ?
Thanx in advance
Michael
------------------------------
Date: 22 Apr 1998 14:38:36 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Get keystroke immediately without <RETURN>
Message-Id: <6hldfc$alc$1@monet.op.net>
Keywords: coincidental courtier fame stylish
In article <6sMxCfdFZZB@wharp.rhein-main.de>,
Michael Haertfelder <haert@wharp.rhein-main.de> wrote:
>Well, the headline said it already:
>Let's say I push the "a" on the keyboard (without the <RETURN>
>afterwards).
FAQ.
------------------------------
Date: 22 Apr 1998 18:16:42 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Get keystroke immediately without <RETURN>
Message-Id: <6hlc6a$ti$4@client2.news.psi.net>
Michael Haertfelder (haert@wharp.rhein-main.de) wrote on MDCXCV September
MCMXCIII in <URL: news:6sMxCfdFZZB@wharp.rhein-main.de>:
++ Well, the headline said it already:
++ Let's say I push the "a" on the keyboard (without the <RETURN>
++ afterwards).
++
++ Is it possible to give the perl script the control for the further
++ processing ?
That is discussed in the FAQ.
Abigail
--
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'
------------------------------
Date: Wed, 22 Apr 1998 09:05:22 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: How can I get the correct answer?
Message-Id: <353fb2ab.2843851@news.tornado.be>
James Yang wrote:
>But I got the following result after I execute this program
>
>55.46 + 50 -100 = 5.46000000000001
>1553.05 + 50 - 1600 = 3.04999999999995
>
>Is it a bug or I can get the correct answer in the other way?
That's floating point for ya. You can get the correct answer, in the
examples that you presented anyway. "All" you have to do is calculate
the results in cents, and divide by 100 for printout.
$\ = "\n";
$number = 55.46 + 50 -100;
print $number;
$cents = 5546 + 5000 -10000;
print $cents/100;
Result:
5.46000000000001
5.46
Bart.
------------------------------
Date: Wed, 22 Apr 1998 14:35:13 -0400
From: kpreid@ibm.net (Kevin Reid)
Subject: Re: How to read lines between two keywords in a file
Message-Id: <1d7vwfb.3vj80a1uvmruoN@slip166-72-108-76.ny.us.ibm.net>
Ying Peng <peng@cae.cig.mot.com> wrote:
> I'd like read through lines between two keywords. For example:
>
> H-daok-N/A-1998<--Keyword1
> /home/daok/f1
> /home/daok/f2
> .
> .
> /home/daok/f?
> H-peng-N/A-N/A<--Keyword2
>
> What I want to do is to find the first keyword and start reading the
> following lines before the next keyword. Suppose the data in a file
> called "data.txt". My problem is that which statement can read line by
> line in a file like $newline=<INFILE>?. Hope I can get answers from you
> experts. Thanks for your thoughts and help.
Use the scalar range operator:
while (<INFILE>) {
if (m|H-daok-N/A-1998| .. m|H-peng-N/A-N/A|) {
# ...process lines...
}
}
--
Kevin Reid. | Macintosh.
"I'm me." | Think different.
------------------------------
Date: Tue, 21 Apr 1998 17:10:44 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Image can view but cannot download?
Message-Id: <comdog-ya02408000R2104981710440001@news.panix.com>
Keywords: from just another new york perl hacker
In article <slrn6jq0rb.1gd.tranhu@derby.jsp.umontreal.ca>, tranhu@jsp.umontreal.ca posted:
>Un jour, Craig Berry (cberry@cinenet.net)
> affirmait publiquement que:
>
>| brian d foy (comdog@computerdog.com) wrote:
>| : In article <353b89a0.1412664@news.hknet.com>, stevenchan69@hotmail.com (LM386) posted:
>| : >Image can view but cannot download?
>| : >how is the technique to make it possible?
>| :
>| : if you can see it you can download it. the LWP module makes this
>| : an even easier thing to do.
>|
>| To put it even more strongly, if you can see it you have obviously
>| *already* downloaded it! The image bits are there inside your machine,
>| or you couldn't see them on your screen.
>
>To put my version of the answer: Java applet.
sorry - doesn't solve the problem. maybe *you* can't save it,
which is entirely different. give up - it can't be done for
just the reasons that Craig said!
--
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 <URL:http://www.pm.org>
------------------------------
Date: 22 Apr 1998 10:43:30 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: lawm@hotmail.com
Subject: Re: Nested Multiline array sort help needed!
Message-Id: <90oxaml9.fsf@mailhost.panix.com>
[posted and mailed]
lawm@hotmail.com writes:
> P.S I just started learning perl and might not know some of the
> "easy" stuff.
Your task isn't very difficult, but it's *impossible* if you haven't
yet mastered a bunch of perl fundamentals (like the syntax of while
loops, the use of arrays and hashes, the use of filehandles, etc.).
Therefore, you should get a hold of the book _Learning Perl_ and work
through all of the exercises. Once you've done that, you may be able
to write a short program to solve the task you're asking about here.
Then, if you're still having difficulty, you can post a brief sample
of what you've tried, and we can tell you why it's not working. I
hope this helps.
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
------------------------------
Date: Wed, 22 Apr 1998 10:24:34 +0100
From: "Tony Kenny" <tony@cyberscape.net>
Subject: Re: Perl and IIS 4.0
Message-Id: <6hkd19$h63$1@svr-c-01.core.theplanet.net>
OK, I have seen this one but it turned out that the person had also changed
the names of his wwwroot directories in the upgrade, it might be a good idea
just to ckeck that you directories are still as they were etc..
Also, i found that the one i saw had a space in the directory name 'Web
Pages'. This gave me a little problem.
Hope this helps.
~Tony Kenny
Adrian Richardson wrote in message <6hjh8o$jip$1@aggedor.rmit.edu.au>...
>Recently after upgrading from IIS3.0 to IIS4.0 our Perl scripts stopped
>working. They now give errors like.....
>
>"The specified CGI application misbehaved by not returning a complete set
of
>HTTP headers. The headers it did return are:
>Can't open perl script "???????????????????l??gf???????": Invalid argument"
>
>This usually means that you don't have 'Content-type' etc in your script.
>However, all of our scripts do and they run well under IIS3.0.
>
>Does anyone know what we are missing here ?
>
>Adrian
>
>
>
>
------------------------------
Date: Wed, 22 Apr 1998 11:25:35 GMT
From: miker3@ix.netcom.com (Michael Rubenstein)
Subject: Re: Perl and IIS 4.0
Message-Id: <353dd1c3.374892466@nntp.ix.netcom.com>
On Wed, 22 Apr 1998 11:33:25 +1000, "Adrian Richardson"
<adrianr@rmitpublishing.com.au> wrote:
>Recently after upgrading from IIS3.0 to IIS4.0 our Perl scripts stopped
>working. They now give errors like.....
>
>"The specified CGI application misbehaved by not returning a complete set of
>HTTP headers. The headers it did return are:
>Can't open perl script "???????????????????l??gf???????": Invalid argument"
>
>This usually means that you don't have 'Content-type' etc in your script.
>However, all of our scripts do and they run well under IIS3.0.
>
>Does anyone know what we are missing here ?
One of the features of the IIS4.0 installation is that it screws up
the options needed for runnng perl scripts.
In the IIS management console, right click on the directory that
contains your CGI perl scripts. Click on "Configure" in the
Application Settings area of the Directory tab. In the entry for perl
you'll see that perl is called with one or two arguments of "%S".
Change these to "%s".
Under IIS3 this was in the registry. In moving the entry to the IIS4
configuration, the installation program changed the arguments to upper
case.
--
Michael M Rubenstein
------------------------------
Date: Wed, 22 Apr 1998 14:35:18 -0400
From: kpreid@ibm.net (Kevin Reid)
Subject: Re: print $fh redefinition
Message-Id: <1d7w1l3.1enc6jl1skfa68N@slip166-72-108-76.ny.us.ibm.net>
Albert Chin-A-Young <china.no-spam@pprd.abbott.com> wrote:
> I'd like to have:
> print $fh "foo";
> call my own print routine. What I have in mind is something like:
>
> use MyIO::File;
>
> my ($fh) = new MyIO::File;
> print $fh "this ", "that ";
> print $fh "theother\n";
> $fh->close;
You might want to look into tied filehandles.
--
Kevin Reid. | Macintosh.
"I'm me." | Think different.
------------------------------
Date: Tue, 21 Apr 1998 21:17:28 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: print multiple lines before or after match ?
Message-Id: <comdog-ya02408000R2104982117280001@news.panix.com>
Keywords: from just another new york perl hacker
In article <6hjdmv$d66@newsops.execpc.com>, Mike Hammernik <mhammer@execpc.com> posted:
>I'm having trouble trying to print multiple lines before or after a
>match. If I have code that reads
>
>while (<READFILE>)
>if ( /SOP603/ )
>print SOPFILE scalar (<READFILE>)
>
>In everything that I've read it seems like everyone expects you to only
>print one line at most.
you need to remember the previous lines somehow. one way might be
something like this pseudo-code
create and initialize @memory to hold previous lines
while( read a line )
{
shift off first line in @memory
push new line onto @memory
if( test for match )
{
print lines in @memory
read and print next X lines
break out of while loop
}
}
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 <URL:http://www.pm.org>
------------------------------
Date: 22 Apr 1998 10:28:49 +0100
From: Andrew Gierth <andrew@erlenstar.demon.co.uk>
Subject: Re: print reverse pack strangeness?
Message-Id: <874szmkxwu.fsf@erlenstar.demon.co.uk>
>>>>> "Marcus" == Marcus P Hertlein <hertlein@umich.edu> writes:
Marcus> Hm. I don't quite understand this:
Marcus> $factor = 1;
Marcus> $foo = pack("f",$factor);
Marcus> $foo2 = reverse(pack("f",$factor));
Scalar context.
Marcus> print OUTFILE reverse(pack("f", $factor)); # writes 3f 80 00 00
Marcus> print OUTFILE reverse(scalar pack("f", $factor)); # writes 3f 80 00 00
List context for reverse() in both cases.
What about
print OUTFILE scalar reverse(pack("f", $factor));
?
Context is everything. perldoc -f reverse and pay attention to what it
says about context.
--
Andrew.
------------------------------
Date: Wed, 22 Apr 1998 19:15:03 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Scott LeWarne <Scott_LeWarne@BigFoot.com>
Subject: Re: Problem creating users on an NT server via Perl script
Message-Id: <Pine.GSO.3.96.980422121429.6132j-100000@user2.teleport.com>
On Wed, 22 Apr 1998, Scott LeWarne wrote:
> The same code works locally when run from a command
> prompt, but not when run through IIS.
When you're having trouble with a CGI program in Perl, you should first
look at the please-don't-be-offended-by-the-name Idiot's Guide to solving
such problems. It's available on CPAN.
http://www.perl.com/CPAN/
http://www.perl.org/CPAN/
http://www.perl.org/CPAN/doc/FAQs/cgi/idiots-guide.html
http://www.perl.org/CPAN/doc/manual/html/pod/
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 22 Apr 1998 17:35:29 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Q: Simple RegExp match help required...
Message-Id: <6hl9p1$o01$2@marina.cinenet.net>
Holly Sommer (hsommer@micro.ti.com) wrote:
[snip]
: /^From \?\?\?\@\?\?\? .*/
That last .* is meaningless in terms of whether the regex will match or
not; its only effect is on what goes into $& (which should be avoided,
anyway). "Zero or more anythings" will happy match 'nothing' (an empty
string), so what follows the space makes no difference to your regex.
So, unless the intention is to look at $& afterward, I'd drop '.*'.
: Or, if you want to make it a little more legible,
: and don't mind using something equating a const, you
: can try this:
:
: $from = "From ???@??? ";
: if ( $line =~ /^$from .*/ ) {
Nope, those regex metacharacters will still be processed after string
substitution. You'd need either
$from = quotemeta 'From ???@??? ';
or
if ( $line =~ /^\Q$from\E .*/ ) {
to make that work.
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: 22 Apr 98 16:00:17 GMT
From: "James Richardson" <jamesr@aethos.co.uk.nospam>
Subject: Re: Question on: printf %o STDOUT
Message-Id: <01bd6e09$2fe771a0$26c0a4c1@kitkat.aethos.co.uk>
jessicam@llnl.gov wrote in article <6hjah2$5uq$1@nnrp1.dejanews.com>...
> How do I get the value from STDOUT and assign it to a variable without
> redirecting to a file? I'm trying to get the mode of a file in octal ( i.e.
> 100640 ) from printf %o and I want to save the STDOUT value without writing it
> to a file.
>
> Any suggestion? Thanks!
>
>From what I understand of your question, you might want to look at the docs for 'sprintf'
(perldoc -f sprintf), which allows you to assign formatted strings to variables.
James
------------------------------
Date: Tue, 21 Apr 1998 20:28:17 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Question on: printf %o STDOUT
Message-Id: <comdog-ya02408000R2104982028170001@news.panix.com>
Keywords: from just another new york perl hacker
In article <6hjah2$5uq$1@nnrp1.dejanews.com>, jessicam@llnl.gov posted:
>How do I get the value from STDOUT and assign it to a variable without
>redirecting to a file? I'm trying to get the mode of a file in octal ( i.e.
>100640 ) from printf %o and I want to save the STDOUT value without writing it
>to a file.
while jogging through perlfunc you might run into sprintf().
--
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 <URL:http://www.pm.org>
------------------------------
Date: 21 Apr 1998 18:46:48 -0500
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: Random Number Generation PERL 5.0
Message-Id: <k98ieo0n.fsf@mailhost.panix.com>
thecurz1@aol.com (The Curz1) writes:
> We are in dire need of generating a random number from 0 to
> <EndOfFile> for use on our website and opening day is scheduled for
> May 1st.
Abigail? Where are you? Your consultation is requested.
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
------------------------------
Date: 22 Apr 1998 15:31:56 -0400
From: william@mathworks.com (William York)
Subject: regexp to return list of matches from string
Message-Id: <6hlgjc$h4f@gecko.mathworks.com>
Perhaps I'm dreaming but I'd like to make a piece of regexp do
something like this:
# for this string:
$line = "<table border><tr><td><table><tr><td>HI</td></tr></table></td></tr>";
@st = $line =~ /(<table[^>]*>?)+/;
print "There are ", $#st + 1, " table starts here.\n"; # print 2
@en = $line =~ /(<\/table[^>]*>?)+/;
print "There are ", $#en + 1, " table ends here.\n"; # print 1
What I've got to work uses index and substr in a loop but that seems a
bit slow.
Any help appreciated.
Bill
--
William York
william@mathworks.com
------------------------------
Date: Wed, 22 Apr 1998 19:58:18 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: William York <william@mathworks.com>
Subject: Re: regexp to return list of matches from string
Message-Id: <Pine.GSO.3.96.980422125636.6132n-100000@user2.teleport.com>
On 22 Apr 1998, William York wrote:
> Perhaps I'm dreaming but I'd like to make a piece of regexp do
> something like this:
>
> # for this string:
> $line = "<table border><tr><td><table><tr><td>HI</td></tr></table></td></tr>";
Don't try to parse HTML with a simple regular expression. There are too
many special cases, such as comments and quoting. Use a module like
HTML::Parser instead. Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
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 2391
**************************************