[7382] in Perl-Users-Digest
Perl-Users Digest, Issue: 1007 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Sep 10 16:09:32 1997
Date: Wed, 10 Sep 97 13:00:24 -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, 10 Sep 1997 Volume: 8 Number: 1007
Today's topics:
about using "require" in NT <yinso@u.washington.edu>
Re: Advice on "including" files <rootbeer@teleport.com>
Re: backreferences and /i in regex (Ilya Zakharevich)
Re: Basic question relating to ReadParse on NT (long in (Faust Gertz)
Re: Beginner's question : Perl or Java ? <fawcett@nynexst.com.SPAMMERS-OFF-EARTH-NOW>
Re: Beginner's question : Perl or Java ? (Mike Stok)
Re: Beginner's question : Perl or Java ? <ajohnson@gpu.srv.ualberta.ca>
Re: Beginner's question : Perl or Java ? <merlyn@stonehenge.com>
Re: C++Builder means Future. (Christopher Browne)
Re: Cookies (brian d foy)
flock in Win32? <camerond@mail.uca.edu>
h2ph <aaron@soltec.net>
Re: How can I prompt the user? (dmouse)
Re: How can I prompt the user? twod@not.valid
Re: How can I prompt the user? <yinso@u.washington.edu>
Macperl: Selena Sol's Groupware Calendar <aharste@mcgraw-hill.com>
Re: Memory management <rootbeer@teleport.com>
Re: Minimizing Memory Needed for Numbers Read from Bina (Ilya Zakharevich)
Re: Need to load a Perl CGI script on a Web server <rootbeer@teleport.com>
perl -Dr regex_debugger <alex.t.silverstein@bender.com>
perl and IIS <rick@mindspring.com>
perl configuration error ()
Perl5.004 and Soalris 2.6 Problem. <mandrake@netrunners.com>
saving reg expressions (Alex Krohn)
Re: Slogans (Was Re: perl and XEmacs) (Chris Nandor)
Re: sumcheck generator wanted (Jim Michael)
Re: system() use in forked server process ? <jay@rgrs.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 10 Sep 1997 10:21:42 -0700
From: Y Chen <yinso@u.washington.edu>
Subject: about using "require" in NT
Message-Id: <Pine.OSF.3.96.970910101537.5556A-100000@saul7.u.washington.edu>
hello everyone,
this may seem a dumb question, but I am not sure how to get around it. I
am trying to write some cgi scripts w/ perl. naturally I put the
functions and data that are sharable into a separate file and use
'require'. under unix it works fine. when I port the scripts to nt, the
test on the command line works too. however, when I try to access the
script over the web. I got a 500 server error stating that the output of
the script contains no blank line separating header and data. note that
if I port all the functions and data from the required file into the
script, it runs fine (that's how I conclude that the problem must be from
the require clause). Do anyone experience with this problem before? I am
using NT4.0 along with Website1.1 as the server, and ActiveWare Perl 307.
Any suggestion is appreciated :)
yin-so
------------------------------
Date: Wed, 10 Sep 1997 12:06:09 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: "Robert J. Alexander" <bob@inorbit.com.NOSPAM>
Subject: Re: Advice on "including" files
Message-Id: <Pine.GSO.3.96.970910120445.644Y-100000@julie.teleport.com>
On Wed, 10 Sep 1997, Robert J. Alexander wrote:
> If I do the following all is OK :
>
> perl.inc
> --------
> $myvar1 = "abcdef";
> $myvar2 = 12345;
>
> perlprog.pl
> -----------
> do 'perl.inc';
Consider making a module or using 'require' instead of 'do'.
> print "My include variable \$myvar1 holds $myvar1\n";
>
>
> but if I want to use the 'use strict;' clause in my perlprog.pl I
> correctly get an error $myvar1 not being declared with a my() ....
Use 'use vars' to declare this global. Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: 10 Sep 1997 18:07:06 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: backreferences and /i in regex
Message-Id: <5v6nka$je4@agate.berkeley.edu>
In article <slrn61dapq.v2n.tom@mitra.phys.uit.no>,
Tom Grydeland <tom@mitra.phys.uit.no> wrote:
> I have a problem deciding for myself exactly *how* backreferences and /i
> *should* work together. There are two possibilities:
>
> 1) The backreference *must* match have the same text (including
> capitalisation) as the original text
>
> 2) The backreference *must* match have the same text (ignoring case)
> as the original text
You can have both with the RE jumbo patch (should be merged in some
numbered Perl version some time very soon).
/(?i)(friend)\s+\1/; # Gives 2 now and later
/((?i)friend)\s+\1/; # Undefined now (and gives 2),
# later will give 1
Best,
Ilya
------------------------------
Date: Wed, 10 Sep 1997 18:56:28 GMT
From: faust@wwa.com (Faust Gertz)
Subject: Re: Basic question relating to ReadParse on NT (long inc. code)
Message-Id: <3416e1fa.924662@news.wwa.com>
On Wed, 10 Sep 1997 10:03:19 GMT, nospam@XXX.co.uk wrote:
>Hi
>
>I am running Perl32 on NT/IIS, and seem to be having many problems
>using the ReadParse function from the cgi_lib.pl
1) If you can, use CGI.pm instead of cgi_lib.pl. Migrating is
relatively painless. The info on that is at
http://www.genome.wi.mit.edu/ftp/pub/software/WWW/cgi_docs.html#migrating
Also, if you care, you can read Tom Christiansen's _Why not to use
cgi-lib.pl_ at http://language.perl.com/info/www/!cgi-lib.html
2) It appears you are using cgi_lib.pl version 1.14. If possible,
you should use cgi_lib.pl version 2.14, available at
http://www.bio.cam.ac.uk/cgi-lib/2.14/cgi-lib.pl.txt This version
addresses several, but not all, of Tom's issues in _Why not to use
cgi-lib.pl_.
3) Please be sure you are using the most recent release of Perl32.
>In an attempt to
>figure out why it doesn't work at all, I have extracted the relevant
>code and written a perl code that uses just that as a sub-routine.
>Thing is it returns some weird results!
Please just use the entire library. It won't cost you that much and
typing 'require "cgi.lib.pl";' is easier than cutting and pasting what
you think is the relevant part of the code. It also makes it easier
for folks to help you when you are having problems. :-)
>**Start Code
>
>HTML Page
>==========
>
><HTML>
><BODY>
><FORM ACTION="../cgi-bin/rich1.pl" METHOD=POST>
>1 <INPUT TYPE="text" NAME="richard" SIZE=30"><BR>
><INPUT TYPE=SUBMIT VALUE="Test it">
></FORM>
></BODY>
></HTML>
[Excerpt from cgi_lib.pl version 1.14 snipped.]
>&ReadParse(*input);
>print %input;
What do you think this line is doing? If you want to look at your key
value pairs, why not use something like:
: while ( ($key, $value) = each (%input) ) { print "Key: $key \t Value: $value\n" }
or if you load the entire library, you can do something like this:
: &PrintVariables(*input)
to print a list of all of the variables.
>$mystuff = $input{'richard'};
>print "<HTML>";
>print "<BODY>";
>print "<H1>Testing</H1>";
If you load the entire library, you could replace this with something
like:
: print &PrintHeader;
: print &HtmlTop ("Testing cgi-lib.pl");
>print "Your first input was $mystuff";
>print "</BODY>";
>print "</HTML>";
If you load the entire library, could replace this with something
like:
: print &HtmlBot;
>Page returned
>===========
>
>
>ichardtested
>
>Testing
>
>Your first input was
>
>**End Code
Yup, that ain't what you wanted.
>So as you can see the page returned does not include the value entered
>in the form, because the perl code strips the first letter of the
>name:value pair, meaning that the part of the code that writes that
>field in based on the name 'richard' cant find it. WHY?!!
Try using the entire library, and version 2.14, and then fiddle around
with the subroutines the library provides. If you still have
problems, try to use CGI.pm.
>This is a pretty good example of why it is failing when using the
>ReadParse function from teh library as well.
Again, please try the most recent library and see if that solves the
problem.
HTH
Faust Gertz
Philosopher at Large
------------------------------
Date: 10 Sep 1997 13:15:58 -0400
From: Tom Fawcett <fawcett@nynexst.com.SPAMMERS-OFF-EARTH-NOW>
Subject: Re: Beginner's question : Perl or Java ?
Message-Id: <8jk9gp3x9t.fsf@nynexst.com.SPAMMERS-OFF-EARTH-NOW>
roy@unice.fr writes:
> Say I am attracted by Perl against Java for doing small programming on
> the Web, but I am not quite sure to do the best choice. My background in
> Scheme is in favour of small languages (oooops : powerful languages
> giving small programs...). Example : I want to get the HTML source of a
> Web page every night at 8:00 pm. The name of the file is a function of
> the date of the day, say "http://foo/19970815.html" for the file on
> August 15. After that, I will locally process the file to extract some
> patterns to send them to a Scheme program. Is the Perl program *much*
> simpler than the corresponding Java one, or are they about the same size?
Well, here's the Perl code:
use LWP::Simple;
($dd,$mm,$yyyy) = (localtime)[3..5];
$yyyy = $yyyy + 1900;
$mm = "0$mm" if $mm < 10;
$dd = "0$dd" if $dd < 10;
$file = "http://foo/$yyyy$mm$dd.html";
getprint($file) or die "Problem getting $file: $!";
I'm only now learning Java (having been lured to the dark side of the
Force) so I can't say with certainty, but I'd guess the Java code is
longer than this.
-Tom
------------------------------
Date: 10 Sep 1997 18:23:32 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Beginner's question : Perl or Java ?
Message-Id: <5v6oj4$g1m@news-central.tiac.net>
In article <8jk9gp3x9t.fsf@nynexst.com.SPAMMERS-OFF-EARTH-NOW>,
Tom Fawcett <fawcett@nynexst.com.SPAMMERS-OFF-EARTH-NOW> wrote:
>roy@unice.fr writes:
>> Say I am attracted by Perl against Java for doing small programming on
>> the Web, but I am not quite sure to do the best choice. My background in
>> Scheme is in favour of small languages (oooops : powerful languages
>> giving small programs...). Example : I want to get the HTML source of a
>> Web page every night at 8:00 pm. The name of the file is a function of
>> the date of the day, say "http://foo/19970815.html" for the file on
>> August 15. After that, I will locally process the file to extract some
>> patterns to send them to a Scheme program. Is the Perl program *much*
>> simpler than the corresponding Java one, or are they about the same size?
>
>Well, here's the Perl code:
>
>use LWP::Simple;
>($dd,$mm,$yyyy) = (localtime)[3..5];
>$yyyy = $yyyy + 1900;
>$mm = "0$mm" if $mm < 10;
>$dd = "0$dd" if $dd < 10;
>$file = "http://foo/$yyyy$mm$dd.html";
>getprint($file) or die "Problem getting $file: $!";
perhaps
($dd,$mm,$yyyy) = (localtime)[3..5];
$file = sprintf 'http://foo/%04d%02d%02d.html', $yyyy + 1900, $mm + 1, $dd;
would be better as $mm is 0 based and most humans want August to be month
8
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com | Pencom Systems Administration (work)
------------------------------
Date: Wed, 10 Sep 1997 13:49:11 -0500
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: Beginner's question : Perl or Java ?
Message-Id: <3416EBA7.35F3EE5D@gpu.srv.ualberta.ca>
Tom Fawcett wrote:
>
[snip]
> Well, here's the Perl code:
>
> use LWP::Simple;
> ($dd,$mm,$yyyy) = (localtime)[3..5];
> $yyyy = $yyyy + 1900;
> $mm = "0$mm" if $mm < 10;
> $dd = "0$dd" if $dd < 10;
> $file = "http://foo/$yyyy$mm$dd.html";
> getprint($file) or die "Problem getting $file: $!";
I think you'll be about a month behind
in your filename :-)
here's a TIMTOWTDI
use LWP::Simple;
@date=(localtime)[5,4,3];
$date[0]+=1900;
$date[1]++;
$file="http://foo/".sprintf("%d%02d%02d",@date).".html";
getprint($file) or die "Problem getting $file: $!";
regards
andrew
------------------------------
Date: 10 Sep 1997 12:14:25 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
Subject: Re: Beginner's question : Perl or Java ?
Message-Id: <8c202x3rse.fsf@gadget.cscaper.com>
>>>>> "Tom" == Tom Fawcett <fawcett@nynexst.com.SPAMMERS-OFF-EARTH-NOW> writes:
Tom> roy@unice.fr writes:
>> Say I am attracted by Perl against Java for doing small programming on
>> the Web, but I am not quite sure to do the best choice. My background in
>> Scheme is in favour of small languages (oooops : powerful languages
>> giving small programs...). Example : I want to get the HTML source of a
>> Web page every night at 8:00 pm. The name of the file is a function of
>> the date of the day, say "http://foo/19970815.html" for the file on
>> August 15. After that, I will locally process the file to extract some
>> patterns to send them to a Scheme program. Is the Perl program *much*
>> simpler than the corresponding Java one, or are they about the same size?
Tom> Well, here's the Perl code:
Tom> use LWP::Simple;
Tom> ($dd,$mm,$yyyy) = (localtime)[3..5];
Tom> $yyyy = $yyyy + 1900;
Tom> $mm = "0$mm" if $mm < 10;
Tom> $dd = "0$dd" if $dd < 10;
Tom> $file = "http://foo/$yyyy$mm$dd.html";
Tom> getprint($file) or die "Problem getting $file: $!";
Tom> I'm only now learning Java (having been lured to the dark side of the
Tom> Force) so I can't say with certainty, but I'd guess the Java code is
Tom> longer than this.
'especially if you do it right, and shorter:
use LWP::Simple;
my ($d,$m,$y) = (localtime)[3..5];
my $url = sprintf "http://foo/%04d%02d%02d.html",
$y + 1900, $m + 1, $d;
getprint $url or die "Problem getting $url";
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 355 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@ora.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, 10 Sep 1997 16:47:53 GMT
From: cbbrowne@hex.net (Christopher Browne)
Subject: Re: C++Builder means Future.
Message-Id: <3416cccc.65259852@news.amrcorp.com>
On 7 Sep 1997 12:03:20 -0700, kaz@helios.crest.nt.com (Kaz Kylheku)
wrote:
>In article <3411F49F.C90A6740@MStarMedia.com>,
>John Palmieri <JohnP@MStarMedia.com> wrote:
>> It will be on IBM's AS/400 which is a UNIX derivitive. I think
>AS/400 is a UNIX derivative? What are you smoking?
You missed the news that OS/400 was made POSIX compliant. :-)
Which means that it, like OS/390 and Windows NT, are all "UNIX." (And
yes, I know that that statement is somewhat troll-bait-like. Sensible
people will leave it alone.) Or, perhaps more precisely, it means
that OS/400 is *as much like UNIX* as are Windows NT and OS/390, which
is "Usefully? Hardly at all..."
>First of all, the AS/400 is a piece of hardware, a computer. UNIX is software.
UNIX is also a philosophy and a set of standards.
And I think I'd more precisely describe AS/400 as a "Computer
Platform" integrating both hardware and software. There have been a
variety of sorts of hardware supported. Recently involving the
PowerPC CPU architecture...
>Secondly, the AS/400 commonly runs OS/400, which is more related to legacy mainframe
>operating systems than anything else.
In a lot of senses, the AS/400 platform is very competitive *in
intent* with UNIX, as both have traditionally been "midrange" systems.
First, there was System/34. Then there was System/36. System/38,
too, I believe, but S/36 was more commonly used... Pretty much all
targeted at "departmental" computing, for cases where "big iron"
mainframes were too big.
AS/400 was the "next generation" of midrange systems, eventually with
a massive conversion to the PowerPC hardware platform.
--
cbbrowne@hex.net, <http://www.hex.net/~cbbrowne> Q: Where would Microsoft
take you today? A: Confutatis maledictis, flammis acribus addictis...
Spam bait: domreg@cyberpromo.com postmaster@netvigator.com postmaster@onlinebiz.net
pmdatropos@aol.com admin@submitking.com cte@llv.com walt@pwrnet.com
------------------------------
Date: Wed, 10 Sep 1997 14:02:20 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Cookies
Message-Id: <comdog-ya02408000R1009971402200001@news.panix.com>
[ follow ups set ]
In article <3416CEA9.446B@syrres.com>, Jason Crowther <jason@syrres.com> wrote:
>Stephen Hill wrote:
>
>> Does anyone know if you can set a cookie by calling the cookie script
>> with an image tag? And if so, how do you do it?
>
>I don't think its possible because you can't set a cookie after you've
>given the content type. (You couldn't see the page if you hadn't
>already printed out the content type...)
it certainly *is* possible. can you say "doubleclick". i knew you
could. for future reference, guessing doesn't help anyone. if you
don't empirically know something to be true, don't offer "i don't
think" answers. :)
see my reply in comp.infosystems.www.authoring.cgi for a complete
demonstration of the method.
--
brian d foy <comdog@computerdog.com>
------------------------------
Date: Wed, 10 Sep 1997 13:53:27 -0500
From: Cameron Dorey <camerond@mail.uca.edu>
Subject: flock in Win32?
Message-Id: <3416ECA6.9F6A29A@mail.uca.edu>
Good afternoon, Perl hackers,
Is there any way to simulate/substitute/work around the flock() function
in Win32 Perl? My understanding is that the function is not there
because of the differences in the Win and Unix operating systems, but it
seems that somebody more knowledgable than me (and there are a *bunch*
of you out there) would have found a solution by now. Unix is not an
option with the resources available to me at this time. Thanks for any
guidance (even if it is "no.").
Cameron Dorey
camerond@mail.uca.edu
------------------------------
Date: 10 Sep 1997 19:48:03 GMT
From: "Aaron" <aaron@soltec.net>
Subject: h2ph
Message-Id: <01bcbe22$7398f1e0$b5910a9f@aurora.cna.com>
I have a little question
I am trying to automate an ftp using Perl (and if anyone has any
information on that that would be appreciated) but when trying to test out
chat2 I get a problem with sys/socket.h and it asks if I've used h2ph.
Any guidance would be appreciated.
------------------------------
Date: 10 Sep 1997 16:58:07 GMT
From: gt1535b@acmex.gatech.edu (dmouse)
Subject: Re: How can I prompt the user?
Message-Id: <5v6jiv$73k@catapult.gatech.edu>
Pascal Lamoureux (pascal@granby.net) wrote:
: Is there a way in perl to prompt the user...
: ie. getting info from the stdin.
$info_from_user = <STDIN>;
should work...
Daryl
: I tried whit read but I think I'm not using it correctly (I cannot get
: out of the prompt unless I do ^C)
: Thanks for the hint,
: Pascal
--
<>< Daryl Bowen <><
Georgia Institute of Technology
E-mail: gt1535b@prism.gatech.edu
Siemens Stromberg-Carlson Co-op
------------------------------
Date: 10 Sep 1997 17:32:53 GMT
From: twod@not.valid
Subject: Re: How can I prompt the user?
Message-Id: <5v6lk5$t7j$1@vnetnews.value.net>
Pascal Lamoureux (pascal@granby.net) wrote:
: Is there a way in perl to prompt the user...
: ie. getting info from the stdin.
: I tried whit read but I think I'm not using it correctly (I cannot get
: out of the prompt unless I do ^C)
The below is something that I use for getting a password, so I disable
echoing to the screen whilst the user enters the data- you may not need that
requirement in which case delete the calls to the external command 'stty' :-
-- snip --
print "Please enter new password for $group: ";
`stty -echo`;
$pass = <STDIN>;
`stty echo`;
print "\n";
chomp($pass);
-- snip --
IAP
--
In an attempt to reduce junk email I use an invalid 'From' address.
My correct email address can be determined by replacing 'not.valid' with with
'value.net'
------------------------------
Date: Wed, 10 Sep 1997 12:19:55 -0700
From: Y Chen <yinso@u.washington.edu>
To: Pascal Lamoureux <pascal@granby.net>
Subject: Re: How can I prompt the user?
Message-Id: <Pine.OSF.3.96.970910121822.10068A-100000@saul7.u.washington.edu>
don't exactly know what you want... but to get info from stdin, this is
all you have to do,
$variable = <STDIN>;
of course, the assignment can be more complex than that. all depends on
what you want.
yin-so
On Wed, 10 Sep 1997, Pascal Lamoureux wrote:
> Is there a way in perl to prompt the user...
> ie. getting info from the stdin.
>
> I tried whit read but I think I'm not using it correctly (I cannot get
> out of the prompt unless I do ^C)
>
> Thanks for the hint,
>
> Pascal
>
>
>
>
>
------------------------------
Date: Wed, 10 Sep 1997 13:33:57 +0100
From: Ann Harste <aharste@mcgraw-hill.com>
Subject: Macperl: Selena Sol's Groupware Calendar
Message-Id: <341693B0.35028710@mcgraw-hill.com>
I've installed this on a Unix server with no problem whatsoever.
Has anyone successfullly used this script on a WebStar server?
When I run the script through MacPerl or off the WebStar server I get
the following error message:
Content-type: text/html
I'm sorry, I was not able to open ./Library/cgi-lib.pl. Would you
please check to make sure that you gave me a valid filename and that the
permissions on are set to allow me access?
Ann Harste
McGraw-Hill Healthcare Publications Group
aharste@mcgraw-hill.com
------------------------------
Date: Wed, 10 Sep 1997 12:09:55 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Les Lesinski <mirek@lesinski.demon.co.uk>
Subject: Re: Memory management
Message-Id: <Pine.GSO.3.96.970910120648.644Z-100000@julie.teleport.com>
On Wed, 10 Sep 1997, Les Lesinski wrote:
> We have a persistent perl process running on NT. Over a period of days
> the space used grows steadily.
Sounds like a memory leak. This may or may not be Perl's fault. Are you
using 5.004, though? Many leaks in previous versions have been plugged.
> Using a "my array" is it possible that each time the array is grown that
> some space is consumed never to be recouped and would it not be
> preferable to make the array global so that it only grows to the max
> size once?
If that happens, it's a bug. But if you wish to "pre-grow" the array, you
may gain some time- and memory-efficiency.
my @foo;
$#foo = 10000; # Allot room for 10001 elements
Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: 10 Sep 1997 17:57:00 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Minimizing Memory Needed for Numbers Read from Binary Files
Message-Id: <5v6n1c$ioo@agate.berkeley.edu>
In article <3416ABCC.167E@lmtas.lmco.com>,
Brett Denner <Brett.W.Denner@lmtas.lmco.com> wrote:
>
> Ilya Zakharevich wrote:
>
> > Everything is OK in *my* perl. Your "unpack" looks broken indeed, try
> > to add 0 to the results,
> > 0 + unpack "f", $string;
>
> Curiously, adding '0 +' to my unpack() uses *more* memory than before.
> Strange.
Same here. For 84000 items (magic number) it uses 667 less 1K buckets
(apparently for SvNV data, bare doubles), and 84000 extra 24byte
buckets, which *might be* SvPVNV data, which is integer + double +
string descriptor.
However, the results should be identical (if skip the TEMP/PADTMP
designator of where it comes from):
H:\get\perl>perl -MDevel::Peek -e "Dump (0+unpack 'f', 'abcd')"
SV = NV(0x55c0c)
REFCNT = 1
FLAGS = (PADTMP,NOK,pNOK)
NV = 1.67779994080821e+22
H:\get\perl>perl -MDevel::Peek -e "Dump (unpack 'f', 'abcd')"
SV = NV(0x55c04)
REFCNT = 1
FLAGS = (TEMP,NOK,pNOK)
NV = 1.67779994080821e+22
Puzzled,
Ilya
------------------------------
Date: Wed, 10 Sep 1997 12:13:55 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Greg Aiken <grega9@mail.idt.net>
Subject: Re: Need to load a Perl CGI script on a Web server
Message-Id: <Pine.GSO.3.96.970910121149.644a-100000@julie.teleport.com>
On Wed, 10 Sep 1997, Greg Aiken wrote:
> Does anyone know where one can upload Perl CGI scripts on a configured
> Web server for the purposes of testing their script?
This is like asking if anyone has small children upon whom you can test
child car seats. :-)
If you write your script with something like CGI.pm, it's easy to test
without even using a server. Have fun with it!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Wed, 10 Sep 1997 14:58:26 -0400
From: Alex <alex.t.silverstein@bender.com>
Subject: perl -Dr regex_debugger
Message-Id: <3416EDD2.7FEC@bender.com>
Anyone know of a source more comprehensive
than Friedl's "mastering" that explains the
noation of the regex debugger? i.e. the
meaning of s'thing such as:
perl -Dr -e "/T&RO(?\!CWAT&)*TBBTV?/x"
rarest char & at 1
first 14 next 84 offset 0
1:BRANCH(81)
5:EXACTLY(15) <T&RO>
15:CURLYX {0,32767}(53)
23:UNLESSM(45)
27:BRANCH(41)
31:EXACTLY(41) <CWAT&>
41:SUCCEED(0)
45:NOTHING(49)
49:WHILEM(0)
53:NOTHING(57)
57:EXACTLY(67) <TBBT>
67:CURLY {0,1}(81)
75:EXACTLY(0) <V>
81:END(0)
start `T&RO' minlen 8
EXECUTING...
--"can do" Thanks,
ALEX
------------------------------
Date: 10 Sep 1997 17:09:27 GMT
From: "Rick Silverstein" <rick@mindspring.com>
Subject: perl and IIS
Message-Id: <01bcbe0c$28a888f0$665fde80@cscp33>
I have a perl script as a CGI script on NT 4.0 IIS 3.0.
IIS does not recognize the *.pl as a perl script.
How do I configure this?
Please email to silverst@csc.dg.com.
Thanks
Rick
------------------------------
Date: 10 Sep 1997 19:07:16 GMT
From: fina@tahiti.geodyn.psu.edu ()
Subject: perl configuration error
Message-Id: <5v6r54$1iv4@r02n01.cac.psu.edu>
------------------------------
Date: Wed, 10 Sep 1997 12:12:40 -0600
From: Isaac Ojeda <mandrake@netrunners.com>
To: mandrake@netrunners.com
Subject: Perl5.004 and Soalris 2.6 Problem.
Message-Id: <873910357.19932@dejanews.com>
When I Compile perl5.004_01 everything is fine until the test for the
dynamic loading. It fails all the time. Is there anything I should look
for when running the configuration file?
Thanks
Isaac Ojeda
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: Wed, 10 Sep 1997 17:40:54 GMT
From: alex@gossamer-threads.com (Alex Krohn)
Subject: saving reg expressions
Message-Id: <3416db9b.83500410@news.supernews.com>
This will probably sound a bit confusing, but I'll try and explain my
question as best as possible:
What I have is a search routine that can have several different
options (match case, match whole word, use reg expression, or a
combination of those). This same options are used throughout the
search and I'm not sure if it's possible to save those options?
The way my routine is running now, I have something like:
foreach $field (@fields) {
if ($case) {
if ($reg) {
$match =~ /$field/;
}
else {
$match =~ /\Q$field\E/;
}
}
else ...
You get the idea. (In the full source, I do look for bad reg
expressions etc., but the idea is the same). Now instead of going
through this series of if statements (which is 3 levels deep on the
full routine), to find out which options to use, is it possible to
save those options somehow so I can just do:
foreach $field (@fields) {
$match =~ something here.. not sure what
}
If anyone has any ideas, how I could structure this, I'd really
appreciate it!
Thanks,
Alex
------------------------------
Date: Wed, 10 Sep 1997 15:06:12 -0400
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Slogans (Was Re: perl and XEmacs)
Message-Id: <pudge-ya02408000R1009971506120001@news.idt.net>
In article <c29iuwbiwg1.fsf@ten-thousand-dollar-bill.MIT.EDU>, David
Bakhash <cadet@mit.edu> wrote:
# If you have become part of
# the Perl thing by months of pain learning the most evil syntax, to the
# point where you start to believe that you always thought in such a
# non-linear way, then you're good for Perl.
# Perl is, to say the least, difficult
# to debug if you don't know the complexities and intricacies of the
# language. If you're staring at something someone else wrote (or even
# something that you wrote a few months back), you can easily get
# confused. Lisp can even get this way for me -- esp. for huge code. But
# what saves Perl (or *can* save it) is that it can be well-written.
# Also, since it's interpreted and high-level, lots of ugly stuff is done
# internally. There is potential for nice Perl code, though most people
# don't try. I don't try too hard myself.
If you replace "Perl" with "English," the above sentences still make
perfect sense. Hm.
--
Chris Nandor pudge@pobox.com http://pudge.net/
%PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10 1FF7 7F13 8180 B6B6'])
------------------------------
Date: Wed, 10 Sep 1997 17:18:58 GMT
From: genepool@netcom.com (Jim Michael)
Subject: Re: sumcheck generator wanted
Message-Id: <genepoolEGAyrM.KpB@netcom.com>
Dennis Kowalski (dennis.kowalski@daytonoh.ncr.com) wrote:
: I would be interested in getting whatever solution you have.
: We just need something that will verify if a file is the same as it was
: when released.
Goto ftp://ftp.debian.org/OfficialCD/1.3.1/utilities and retrieve the
md5sum program for your platform. The source is there as well.
Cheers,
Jim
------------------------------
Date: 10 Sep 1997 14:23:14 -0400
From: Jay Rogers <jay@rgrs.com>
To: "Richard J. Marisa" <rjm2@cornell.edu>
Subject: Re: system() use in forked server process ?
Message-Id: <82bu21gh9p.fsf@shell2.shore.net>
"Richard J. Marisa" <rjm2@cornell.edu> writes:
> The key part that I missed was that this was a forked *server* process
> modeled after the multithreaded server example in "man perlipc". That
> means it includes code like:
>
> my $waitedpid = 0;
> my $paddr;
>
> sub REAPER {
> $waitedpid = wait;
> $SIG{CHLD} = \&REAPER; # loathe sysV
> logmsg "reaped $waitedpid" . ($? ? " with exit $?" : '');
> }
>
> $SIG{CHLD} = \&REAPER;
>
> Now, the Camel Book section on "wait" notes that system() does a wait and
> could harvest the wrong process. Indeed, when I commented out the
> installation of the handler, all of my system() calls returned meaningful
> results. But... I have the dread accumulation of zombie processes.
>
> The manual says that I need to use waitpid to solve the zombie problem.
> But how?
I think the double fork technique to avoid zombies is more robust than
mucking with sigchld. It's discussed in the first edition of the
camel book and in Rich Stevens' advanced unix programming book.
The basic idea is that you fork a child who forks a grandchild. The
child exits quickly and the parent waits for him - so now the child
can't be a zombie. The grandchild waits until he's orphaned. He
knows this when the init process adopts him and becomes his parent.
Now he can't be a zombie either because init will handle reaping the
exit status.
Here's an example:
sub prune_dir {
my($dir) = @_;
my(
$hour,
$pid,
@files,
);
## Start another process to handle deletions.
unless ($pid = fork) { # child process
die "problem forking: $!" unless defined $pid;
unless ($pid = fork) { # grandchild process
die "problem forking: $!" unless defined $pid;
## Wait until parent exits.
sleep 1 until getppid == 1;
## Close pipes to client.
open STDIN, "</dev/null";
open STDOUT, ">/dev/null";
## Read all filenames in dir except . and ..
opendir DH, $dir
or die "problem reading directory $dir: $!";
@files = grep { !/^\.\.?/ } readdir(DH);
closedir DH;
## Add the full pathname to each.
@files = map { "$dir/$_" } @files;
## Remove files older than an hour.
$hour = 1/24;
foreach (@files) {
next if -M $_ < $hour;
system "rm -rf $_";
}
exit;
} # end grandchild process
exit;
} # end child process
wait;
1;
} # end sub prune_dir
------------------------------
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 1007
**************************************