[7211] in Perl-Users-Digest
Perl-Users Digest, Issue: 836 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Aug 9 04:07:16 1997
Date: Sat, 9 Aug 97 01:00:28 -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 Sat, 9 Aug 1997 Volume: 8 Number: 836
Today's topics:
Re: ... file updates & flock (Tim Smith)
Re: ... file updates & flock (Tad McClellan)
awful suspicion about hash of arrays and dbm (Trudno zhit' v derevne bez nagana.)
Re: bug in MailTools package? <gbarr@ti.com>
can regexp do balanced match? (doritozilla)
Re: can regexp do balanced match? (Bennett Todd)
Re: chop vs chomp <rootbeer@teleport.com>
Re: Clearing browser screen before sending HTML code to <rootbeer@teleport.com>
Deleting single attribute with Netscape's LDAP PERL pac <christopher.green@nol2316.fh.zh.ubs.com>
Re: editing files via cgi <rootbeer@teleport.com>
FTP on Solaris and Linux <sparkles@pobox.com>
Re: function pointer dereferencing <tom@mitra.phys.uit.no>
Help! Migrating CGI scripts from Unix to NT (Joe MacDonald)
How do I get started with win95? <mailus@web-uk.com>
Re: How-to cut the last characters of a varibles <ajohnson@gpu.srv.ualberta.ca>
Re: JAPH (was: function pointer dereferencing) <tom@mitra.phys.uit.no>
MLDBM manual page (Eric Penn)
Re: Need help on fork FAQ (Trudno zhit' v derevne bez nagana.)
Re: parsing techniques (advice needed) <rootbeer@teleport.com>
Re: PERL for windows (Eric Bohlman)
Question about FAQ operation (Brian Lavender)
Re: Request for example select()-server <tom@mitra.phys.uit.no>
Too Many Files for Foreach Loop? <pdenman@ims.ltd.uk>
Re: Too Many Files for Foreach Loop? <seay@absyss.fr>
Uninitialized variables in scripts <fspecial@ucsd.edu>
Using Perl/Netscape in a Standalone environment <donf@eds.com>
Re: Using Perl/Netscape in a Standalone environment (Jim Michael)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 5 Aug 1997 15:24:54 -0700
From: trs@azstarnet.com (Tim Smith)
Subject: Re: ... file updates & flock
Message-Id: <5s897m$57c@web.azstarnet.com>
In article <493_9708051335@medtechnet.com>,
Bill Hliwa <bill@medtechnet.com> wrote:
>How do you keep file access locked between closing a file in input mode and
>opening again in output mode?
The most common answer is to open for input and output once and don't
close until you're really done with the file. Something like this:
use Fcntl ':flock';
open FH, "+< $file" or die "open: $!\n"; # see open in perlfunc(1)
flock FH, LOCK_EX;
while (<FH>) {
# ... process the file
}
seek FH, 0, 0; # go back to beginning of file
truncate FH, 0; # don't want old stuff at the end of our file!
# if truncate won't work on your OS, try copying
# /dev/null onto the file or something similar.
print FH "blah, blah, blah\n";
close FH; # close unlocks the file automatically - it's better
# to NOT unlock it explicitly, in general
exit 0;
__END__
One thing I often do is, while I'm processing the file I write out to
a temp file. When I'm done processing the file (before I close it) I
close the temp file, copy the temp file on top of the old file, then
close the file handle. The OS takes care of truncating the file in
that case.
I hope this helps.
Tim
------------------------------
Date: Tue, 5 Aug 1997 15:42:47 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: ... file updates & flock
Message-Id: <7838s5.kb4.ln@localhost>
Bill Hliwa (bill@medtechnet.com) wrote:
: What is the proper way to uniquely update a file from perl? For example, if I
: have a program like this (in pseudo-code):
:
: open some.file for input
: flock(some.file,2)
: stuff = contents of some.file
: flock(some.file,8)
: close some.file
:
: update stuff
:
: open some.file for output
: flock(some.file,2)
: some.file = stuff
: flock(some.file,8)
: close some.file
:
: Another process can read the file while I'm "updating stuff" and write out it's
: update after the first process finishes writing its update, effectively
: overwriting the update from the first process.
:
: How do you keep file access locked between closing a file in input mode and
: opening again in output mode?
You can't, closing the file releases the lock (even without calling flock
again).
So you open it for both read and write at the same time as
described in the perlfunc entry for open()
eg: open(FILE, "+<the_file") || die ...
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: 5 Aug 1997 20:53:02 GMT
From: alex@kawo2.rwth-aachen.de (Trudno zhit' v derevne bez nagana.)
Subject: awful suspicion about hash of arrays and dbm
Message-Id: <5s83re$lj1$1@news.rwth-aachen.de>
Hi,
please tell me that it isnt true, and it is
possible to save hash of arrays in dbm-files!
Why doent following program work, when i
uncomment the 2 lines?
# dbmopen %plan, 'test', 0666 or die;
$plan{'user'} = ['a', 'b'];
print $plan{'user'}[0];
# dbmclose %plan;
Greetings
Alex
--
russkaya literatura v ------ http://www.simplex.ru/lit.html
internete http://www.friends-partners.org/~afarber/lit.html
java preferans ------------ http://www.simplex.ru/pref.html
besplatnye kommercheskie ob'yavleniya http://www.simplex.ru
------------------------------
Date: Tue, 05 Aug 1997 16:15:09 -0500
From: Graham Barr <gbarr@ti.com>
To: Hans de Graaff <graaff@xs4all.nl>
Subject: Re: bug in MailTools package?
Message-Id: <33E797DD.25514B78@ti.com>
Hans de Graaff wrote:
>
> erik@paxp01.mipool.uni-jena.de (Erik Braun) writes:
>
> > You use a strange mail program. Try sendmail:
> >
> > ....
> > my($fh) = $msg->open('sendmail');
> > print $fh "$text";
> > $fh->close;
> > ....
> >
> > and everything will be fine.
>
> Does anyone besides me consider this a bug in the MailTools package?
Yes I do and I am the author
> Having to specify which underlying MTA to use defeats the whole
> purpose of Mailtools being there. I could just as well open a pipe to
> sendmail directly.
I would agree with that.
> I would just expect Mailtools to pick a suitable underlying MTA to
> properly send my mail.
That is not as easy as it sounds. However I am working on improving
it. sendmail will probably become the default if it is avaliable
>If I have to make such local changes,
> portability goes out the window. The above script will run on my
> current web server, but it won't on Windows
If you can tell me what I would have to do for Windows and/or
NT I will add it in.
> or at home on Linux
> running Qmail.
Hm, never heard of Qmail ??
> And /usr/bin/mail inserts these funny ~s strings, and
> usually doesn't let you set the From: header.
Ah yes. Thats because you have to determine the command line option
which will turn these into the correct header, ie ~s should
become the Subject: line. But the problem is that just about
every different version of UNIX has it's own version of mail
which has different command line options to control this.
>
> I haven't mailed the author about this, but will be happy to do so
> depending on reactions here.
I have read it :-)
--
Graham Barr <gbarr@ti.com>
It doesn't matter what you do, it only matters what you say you've done
and what you're going to do.
-- Dilbert's Laws
------------------------------
Date: 9 Aug 1997 05:17:06 GMT
From: ouij@triples.math.mcgill.ca (doritozilla)
Subject: can regexp do balanced match?
Message-Id: <5sgugi$cv9@sifon.cc.mcgill.ca>
I'm trying to tokenize a postscript language
file: so far regexp's have been able to do
it all but I'm worried about the following
case where I must gather everything inside ( )'s.
postscript allows the ( ) to be quoted to represent
the actualy character and not be string delimiter.
for example:
(this is a string \(sub string inside\) with quoted string)
I'm getting very good results with
/\(.*\)/
due to the greediness, it will go all the way out
to the rightmost closing )...
but how do I handle the erroneous cases.
I'd sleep easier knowing that the paranthesis
were balanced.]
is there some regexp magic to be able to
count the quoted parentheses. or must I
resort to my C coding mentality of examing
the string character by character and doing
the housekeeping myself?
thanks
ouij
------------------------------
Date: 9 Aug 1997 06:46:47 GMT
From: bet@network.rahul.net (Bennett Todd)
Subject: Re: can regexp do balanced match?
Message-Id: <slrn5uo4ij.6b3.bet@waltz.rahul.net>
No, regexp can't do paren-matching. Matching nesting constructs requires
keeping a count of how many you've seen; in theory this could be an
arbitrarily large count. Finite state machine pattern recognizers can't count
beyond the number of states they have, without special hacks (like the up-to-N
counter of curly braces, which can be implemented by adding N states).
If you want to do matching balenced parentheses, you need a recognition engine
that can count, like a pushdown automaton. It's a walk with a yacc.
Perl has added a lot of keen goodies to regexp, and some of them add real
power to the regexps, but as far as I know you can't do something like
/(\([^(]*)(*)([^)]*\)){$2}/
or thereabouts, to match N opens, then look for N closes. And even if you
could that wouldn't deal with e.g.
( () () )
You might want to look for a yacc that can generate perl; I seem to recall
reading about such, though I've never gone out looking for one. Faster would
be to write your recognizer in yacc, translate it to C, then turn it into a
dynamically loadable perl module.
-Bennett
------------------------------
Date: Wed, 6 Aug 1997 08:48:56 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Benarson Behajaina <Benarson.Behajaina@swh.sk>
Subject: Re: chop vs chomp
Message-Id: <Pine.GSO.3.96.970806084414.29767a-100000@kelly.teleport.com>
On Wed, 6 Aug 1997, Benarson Behajaina wrote:
> I've just looked at the perlfunc manual (on Solaris 2.5) but couldn't
> find the difference between :
> 1. chop and chomp
> 2. localtime and gmtime
Other than the differences documented in perlfunc, I don't know what
you're looking for. Can you tell us what you find lacking in the
documentation?
--
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/
------------------------------
Date: Wed, 6 Aug 1997 07:28:57 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Steve Schmitz <schmitz@sunydutchess.edu>
Subject: Re: Clearing browser screen before sending HTML code to browser.
Message-Id: <Pine.GSO.3.96.970806072707.29767J-100000@kelly.teleport.com>
On Mon, 4 Aug 1997, Steve Schmitz wrote:
> I have a PERL script that is sending the output from a COBOL program to
> the browser screen. While the program is running, I display a message
> at the top of the screen telling the person to "please wait" for the
> output from my program.
>
> The problem is that when my PERL script sends the output to the browser,
> instead of the output starting at the top of the screen, it follows the
> "please wait" message that I already have on the screen. I would like
> for the "please wait" message to be overwritten at this point.
If this is possible, you need to print something different to the browser.
Since what you print won't be Perl, I can't help you any more here. You
should check with a browser newsgroup (or its FAQ) to find out what to
print, if it's even possible. Good luck!
--
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/
------------------------------
Date: Wed, 06 Aug 1997 23:02:23 +0200
From: Christopher Green <christopher.green@nol2316.fh.zh.ubs.com>
Subject: Deleting single attribute with Netscape's LDAP PERL package
Message-Id: <33E8E65E.B4433388@nol2316.fh.zh.ubs.com>
Girls and Guys,
I'm just fiddling around with Netscape's LDAP PERL package (found under
Directory Server: An LDAP PERL package for creating an interface to LDAP API on
UNIX platforms.), and I can't get it to delete an attribute of an entry using
the "update" method.
I am doing the following:
bind as Directory Manager
"search" an entry
delete an attribute in my local hash
use the "update" method to write back the changed entry
The result: the sequence of the attributes is shuffled around a bit, but the
deleted attribute stays put. "update" works perfectly otherwise.
I'm using libs dated Oct '96 (version 1.x, whatever that means), a NS 1.02
Directory server, Solaris 2.5, perl 5.002
Any ideas?
Then there are one or two other points:
- "deleteval" can only delete the last value of an attribute... huh?
- "printentry" seems to clear out my local hash... does it do something like the
"entry" method ?
My current workaround is to suck in a complete entry, change it locally, delete
the entry in the Directory server, and add the locally changed hash as a new
entry. Not too elegant.
Are there other libs someone can recommend? (...or I could go back to the
command-line stuff and temporary files ;)
- chris
------------------------------
Date: Tue, 5 Aug 1997 07:15:13 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Mark D <MXD38@vm.cc.purdue.edu>
Subject: Re: editing files via cgi
Message-Id: <Pine.GSO.3.96.970805070704.10855D-100000@kelly.teleport.com>
On Tue, 5 Aug 1997, Mark D wrote:
> Goal: Write a CGI that reads in file A, reformats data in file A, saves
> as new file A.
> -Wrote command line executable that works fine. It uses '-npi'
> compiling options. That is: #! usr/bin/perl -npi. These options
> supported wh en trying to run a cgi.
I think you're saying that you can't do something so simple as use the
-npi options when your script is a CGI script, and you're right. You have
to implement the CGI interface, which is probably best done in this case
by using the CGI.pm module, or another module. (And are you sure you want
both -n and -p? They're contradictory, and Perl should probably complain.)
Any script which uses -p implicitly has this loop around its main code.
(Almost. There's a difference which you can ignore for these purposes, or
you can find in the docs.)
while (<>) {
#
# Your code goes here.
#
print;
}
The -n option is just the same, except without the print. The -i option
with no argument effectively does this.
BEGIN { $^I = ''; }
So, put those types of code into your script in the right places and
you'll be most of the way there.
More useful facts: The <> operator, used in the -p/-n loop, gets the
filename from @ARGV. So, once you have a filename selected, you can assign
it like this.
@ARGV = $filename;
But don't let the user choose just any old filename to edit. Make sure
it's a file which you want to modify, and not something like a server
control file! :-)
All of these things are in the Perl docs, especially perlrun and perlvar.
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/
------------------------------
Date: Wed, 06 Aug 1997 22:21:01 +1000
From: Chris <sparkles@pobox.com>
Subject: FTP on Solaris and Linux
Message-Id: <33E86C2D.4C6E@pobox.com>
I can't seem to get any of the sample FTP scripts to work under Solaris
2.5.1. I've tried the standard FTP.PL, the other FTP.PL that uses
LCHAT.PL, FTPLIB.PL and I've even played around with COMM.PL. Has
anybody else had any luck on this front?
While I'm at it, I did notice a difference in behaviour between trying
to connect to a Solaris FTP host and a Linux host, the difference being
that the scripts hang more frequently with the Linux host. Is there any
significant difference I should know about?
CS
------------------------------
Date: 06 Aug 1997 15:07:51 +0000
From: Tom Grydeland <tom@mitra.phys.uit.no>
Subject: Re: function pointer dereferencing
Message-Id: <nqo20478i48.fsf@mitra.phys.uit.no>
Clark Dorman <clark@s3i.com> writes:
> > sub AUTOLOAD{print}map{$_->($_)}split//=>"Just another Perl hacker,";
>
> Waahhh!! I don't understand!!
So, so. You were almost there.
> Ok, here's what I'm getting:
> @bar = split//=>"Just another Perl hacker,";
> makes a list (24 long) each element of which is a character.
Almost correct. There's a comma in there as well, so the length is 25.
> map{$_->($_)} applies the block $_->($_) to each of the characters,
> but while I have been trying to follow this thread, I still don't
> know what that means.
That's what started this thread. Mirroring the method invocation syntax
$obj->method(args);
perl 5.004 allows a similar syntax for references to subroutines (code
references) which I abused in the above JAPH:
$coderef->(args);
> If I try:
> @foo = map{$_->$_} @bar;
>
> I get:
>
> Undefined subroutine &main::J called at japh.pl line 8.
That's exactly what I got and what spurred me on to the above JAPH.
> The Autoloader is used to get around this, loading "J" (and "u"
> ...). Ok.
Not exactly. The Autoloader does not come into play here, as far as I
know.
> So, I gather that the map is making a reference to a subroutine that
> is really just itself, for each of the characters of the string (in
> @blah).
Almost. The map will take each character in turn and *try* to treat
it as a subroutine reference. Since it's obviously not a "hard"
reference, it interprets it as a (one-character) string and tries to
use it as a symbolic (or "soft") reference. Since no subroutines by
those names have been defined, you get the "Undefined subroutine"
error (as you experienced).
> But, why does it get printed? Why does the subroutine get called?
> Here I'm guessing: When perl tries to deal with what map is doing, it
> tries to find AUTOLOAD, which is normally brought in by "use
> AutoLoader;", but you've defined AUTOLOAD to be this subroutine that
> prints.
No. AUTOLOAD is the subroutine that is called whenever a subroutine
is called without first being defined. Try
sub AUTOLOAD {print "Hello, world!\n"}
&nngh;
In fact, since *any* unresolved subroutine call is handed over to
AUTOLOAD, this is (I believe) the basis of the autoloader, although
it's conceptually unrelated.
It turns out (as I've already pointed out) that the above JAPH was two
characters too long, since AUTOLOAD never used its argument. Let me
walk you through the first iteration of the map:
map locally sets $_ to "J"
map tries (essentially) "J"->("J")
Since "J" is used as a coderef, but isn't, it's determined that it is
a symbolic reference to a (named) subroutine. Hence, the subroutine
"J" is called.
Since "J" doesn't exist, AUTOLOAD is called instead, and with the same
arguments. In addition, $AUTOLOAD is set to the fully-qualified name
of the subroutine that was called.* In my case, AUTOLOAD is simply
{print}, which prints $_, or "J". In this case, passing $_ as an
argument to AUTOLOAD is superfluous, and can be regarded as either a
misunderstanding on the programmers part, or as an attempt at extra
obfuscation.
> My review of the pod's has left me unable to understand what the map
> is really doing though. It seems like "->" is used in a number of
> contexts and it is not clear how it is being used here, or how Perl
> knows what to do with it. How does it know that it is a function, and
> not a hash or something else?
I believe it is depends on the delimiters:
$ref->method; ($ref is object, or blessed reference)
$ref->[$i]; ($ref refers to array)
$ref->{$s}; ($ref refers to hash)
$ref->($arg); ($ref refers to subroutine)
> Clark Dorman "Evolution is cleverer than you are."
--
//Tom Grydeland <Tom.Grydeland@phys.uit.no>
------------------------------
Date: Tue, 05 Aug 1997 20:02:53 GMT
From: shrine@netcom.ca (Joe MacDonald)
Subject: Help! Migrating CGI scripts from Unix to NT
Message-Id: <33e7845d.30798431@nntp.uunet.ca>
We're migrating our website from a Unix box to an NT box, but we're
running into a problem with our CGI scripts.
Our ISP is a major international provider so I assume that all of
their software is current.
Problem is: In the local office we're dealing with, the guy who'd
normally take care of this kind of problem is on vacation this week
and the rest of the guys are either "NT guys" or "Unix guys".
I'm fairly well versed in CGI and Unix, but have had no experience
whatsoever with NT. I have a hunch that our relatively simple scripts
would be easy to convert, so I'd like to try myself rather than wait a
week.
My question:
What are the common changes ( like switching "\" to "/" for example)
you have to make to a Unix script in order to enable it for NT?
Thanks,
Joe MacDonald
------------------------------
Date: 9 Aug 97 07:42:35 GMT
From: "Richard Butcher" <mailus@web-uk.com>
Subject: How do I get started with win95?
Message-Id: <01bca498$bb3db920$0330bcc3@matthew>
Please don't flame me if this question has been answered a million times
already - believe me, I've searched for the answer.
Is it possible to get into Perl without a degree in programming other
languages? !
I've downloaded perl5 and read every faq I can find and monitored this
newsgroup for a fortnight.
The message I get is that unless you've got enough knowledge and software
to compile in C or whatever, there's no way forward.
I've written a few scripts and got them working and I'm learning more every
day but the only way I can test them is to go on-line, upload the script
and waste my Service Provider's processing time. Remember too, in some
benighted countries we still have to pay for the phone connection while
we're on line.
Has any kind soul provided a bit of software for win95 that sorts out the
installation and gets perl working?
Of course, in an ideal world, it would be perfect to have enough of what's
needed for a server to make the things work for real: like I fill in a form
on my web page, press the send button and it all happens (off line).
But even being able to work stuff in a dos window would be a step forward.
I ain't rich so don't bother pointing me to a $1000 package but I would be
happy to pay shareware rates.
I cannot be alone! Someone must have asked for this before. I must be part
of a shareware market.
Help.
richard@web-uk.com
------------------------------
Date: Wed, 06 Aug 1997 13:04:01 -0500
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: How-to cut the last characters of a varibles
Message-Id: <33E8BC91.5712F9A0@gpu.srv.ualberta.ca>
Stephane Robertson wrote:
>
> Hello,
>
> How can I cut the last characters of a variable?
>
> For example: I need to use printf "%20s", $variable;
> and if the $variable is more than 20 characters I want it
> to be cut to the 20th characters. Even if the variable is
> more then 20 characters
> I want 20 characters to be printed on the screen.
>
> How do I do that?
here's a few ways:
$_="this is a string with more than twenty characters";
printf "%.20s",$_;
print " :-| \n";
$_="this is a string with more than twenty characters";
print substr($_,0,20);
print " :-) \n";
$_="this is a string with more than twenty characters";
s/(.{20}).*/$1/s;
print;
print " :-( \n";
$_="this is a string with more than twenty characters";
chop while length>20;
print;
print " :-0 \n";
I'm sure there are more...
regards
andrew
------------------------------
Date: 06 Aug 1997 14:21:03 +0000
From: Tom Grydeland <tom@mitra.phys.uit.no>
Subject: Re: JAPH (was: function pointer dereferencing)
Message-Id: <nqo3eon8ka8.fsf@mitra.phys.uit.no>
mjtg@cus.cam.ac.uk (M.J.T. Guy) writes:
> Tom Grydeland <tom@mitra.phys.uit.no> wrote:
> >
> >The funny thing is, since I happened upon one of the previous
> >incarnations of the above JAPH, I've tried numerous other ways to
> >define a subroutine named q( ) or q(,). All in vain. Any takers?
> What's the problem? Why not just do it:
Apparently, the problem is getting the point across. Tom Phoenix has
already misunderstood (and corrected) the problem the same way, and
Randal Schwartz has comprehended and answered my question.
Considering that the post was made in a Perl newsgroup, and that the
post in which the question was posed contained
sub AUTOLOAD {print}map{$_->($_)} split//=>"Just another Perl hacker,";
which (I thought) would indicate to the casual reader that the question
might be non-trivial and to the non-casual reader that the question
involved symbolic (or "soft") references to (single-character) named
subroutines; further considering the fact that whichever way I chose to
quote a name consisting of a single space or a lone comma, I opted for
perl's delightful q// syntax. Unfortunately, with the q/(/ and q/)/
delimiters, it looked like a function call, for which I apologise.
So, the question (or challenge) was to define a subroutine named
<space> (the character) or <comma> (the character) and it
*has been answered* by Randal.
> Or do you mean you want the subroutine to be named "q(,)" ? AFAIK, you
> have to use globs to get that.
See why it's difficult? do you mean a subroutine named <comma> or
<left-paren><comma><right-paren> or <q><left-paren><comma><righ-paren>
or even <dblquote><q><left-paren><comma><righ-paren><dblquote>?
I tried to be clear and consise, and I obviously failed.
Nnngh.
> Mike Guy
sub{sub{sub{print@_[map{($_*3+5)%25}0..24]}->(@_[map{($_*6+8)%25}0..24])
}->(@_[map{($_*7+9)%25}0..24])}->(split//,"Just another Perl hacker,");
--
//Tom Grydeland <Tom.Grydeland@phys.uit.no>
------------------------------
Date: Sat, 09 Aug 1997 05:51:03 GMT
From: stupid@wco.com (Eric Penn)
Subject: MLDBM manual page
Message-Id: <33ec04ae.186402802@news.wco.com>
I tried building MLDBM on my ISP and it failed at the test stage. I'm not
good enought to know what it means, but I'm fairly certain that it is bad.
I copied the MLDBM.pm file into my perl/libs directory, but am missing
any/all of the supposed documentation that should habve come with the
module. This puts me at (I think) a bit of a disadvantage in using the
module. Can some kind sole (sic) email me the man page for MLDBM? Thanks!
--
Eric Penn STUPID's three rules to life:
stupid@wco.com Stick with what you're good at,
http://www.wco.com/~stupid/ Learn from your mistakes, and
"stoo" When in doubt, act stupid!
------------------------------
Date: 5 Aug 1997 21:01:19 GMT
From: alex@kawo2.rwth-aachen.de (Trudno zhit' v derevne bez nagana.)
Subject: Re: Need help on fork FAQ
Message-Id: <5s84av$lj1$2@news.rwth-aachen.de>
In article <33DE38F1.502F@cat.com>, nichori@cat.com says...
Hi,
i believe i have heard about it. You have to close all
file descriptors both in parent and child processes.
Otherwise WWW-server will always wait
/Alex
>Solved my own problem. It works fine on a Netscape server, but
>doesn't on the NCSA server I was using. Here's my sample code
>
>#!/usr/local/bin/perl
>$|;
>print "Content-type: text/html\n\n";
>if ($pid = fork) {
> print "Forked process is $pid.<br>\n";
> print "Output is <a href=\"/test.htm\">test.htm</a>\n";
> close(STDOUT);
> exit(0);
>} else {
> exec("./test2 < /dev/null > ../htdocs/test.htm 2>&1 &");
> exit(0);
>}
--
russkaya literatura v ------ http://www.simplex.ru/lit.html
internete http://www.friends-partners.org/~afarber/lit.html
java preferans ------------ http://www.simplex.ru/pref.html
besplatnye kommercheskie ob'yavleniya http://www.simplex.ru
------------------------------
Date: Wed, 6 Aug 1997 07:24:44 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Ryan <rmcguigan@ramresearch.com>
Subject: Re: parsing techniques (advice needed)
Message-Id: <Pine.GSO.3.96.970806071955.29767H-100000@kelly.teleport.com>
On 5 Aug 1997, Ryan wrote:
> I know there are modules for doing this, but just as an example, what is
> the best way to go about parsing links from HTML pages and other similar
> tasks?
A URL has a well-defined syntax which I believe could be matched by a
regular expression. Is that what you want, or are you needing to write a
true parser in Perl? 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/
------------------------------
Date: Wed, 6 Aug 1997 01:21:19 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: PERL for windows
Message-Id: <ebohlmanEEGx3L.D3I@netcom.com>
Paruchuri Krishna Kiran (pkkiran@imap1.asu.edu) wrote:
: I dont know anything about the PERL interpretor for windows, but I have
: to do some programming in it. Can anybody suggest if there is any free
: perl interpretor available for Win '95?
Yep. You're probably best off getting Gurusamy Sarathy's binaries,
which can be found at http://www.perl.com/CPAN/ports/nt/.
------------------------------
Date: Wed, 06 Aug 1997 07:38:41 GMT
From: brian@brie.com (Brian Lavender)
Subject: Question about FAQ operation
Message-Id: <33ed2663.53242828@nntp.netcruiser>
When I go to the FAQ index page located at
http://www.perl.com/perl/faq/ and I select the link for the FAQ as one
large html document I land at the page at
ftp://ftp.duke.edu/pub/perl/doc/FAQs/FAQ/PerlFAQ.html
Now it appears it is pulling single large FAQ document from one of the
CPAN mirrors. Now this is really cool I have to say being able to view
the FAQ as one large document. Now this where I have a problem. When I
click on one of the questions in the list of this document I get
thrown into another document located at
ftp://ftp.cdrom.com/pub/perl/CPAN/doc/manual/html/pod/
Of course this is not what I was looking for. I was looking for the
question with the answer below. So when you look at the html source of
the one large html document, you see that each question has an anchor
link which I believe is intended to place you on the question and the
answer below. On my browser it does not.
I am using Netscape 3.0 on Win95. Now is it my browser which is doing
this or is this a fault in the html of the faq? If I save the faq on
my system and I remove the base tag in the head portion and I view it
locally everything is great.
I once wrote Tom a nasty note because I thought I was getting jerked
around because when I wanted to read the question and the answer I
landed somewhere else. Of course he mailed me a nasty note back. Can
you take a look at this?
Brian
----------------
Brian Lavender
Sacramento,CA
Brie Business Directory - Napa Valley http://www.brie.com/bbd/
(916) 443-6195
"Moving sucks"
------------------------------
Date: 08 Aug 1997 09:25:00 +0000
From: Tom Grydeland <tom@mitra.phys.uit.no>
Subject: Re: Request for example select()-server
Message-Id: <nqoyb6d2fir.fsf@mitra.phys.uit.no>
chadbour@sashimi.wwa.com (James Weisberg) writes:
> Can someone point me to an example TCP/IP server written in
> Perl which uses select() on multiple filehandles? All the
man IO::Select
> Any info highly appreciated.
--
//Tom Grydeland <Tom.Grydeland@phys.uit.no>
------------------------------
Date: Wed, 6 Aug 1997 12:37:28 +0100
From: "Paul Denman" <pdenman@ims.ltd.uk>
Subject: Too Many Files for Foreach Loop?
Message-Id: <rln9s5.b8t.ln@gate.imsport.co.uk>
Hello,
I am working with a series of files which have the format:
(usernumber).dat
Unfortunately, there are quite a number of them (1000+ and rising).
I need to read in 2 lines from each file & so I am using my previously
tried & tested method of a loop as...
--- snip ---
foreach $file_in (< *.dat>) {
print "File: $file_in\n";
open (FILEIN, $file_in) || die ("unable to open file $file_in");
perform processing here...
close (FILEIN);
}
--- snip ---
This has worked when there have only been a handful of files, but it
is producing nothing with such a large number of files.
I am running Perl5 on a Unix box (Irix v.5)
Any help would be appreciated.
Thanks...Paul Denman
---
pdenman@ims.ltd.uk
------------------------------
Date: Wed, 06 Aug 1997 15:57:00 +0200
From: Doug Seay <seay@absyss.fr>
To: Paul Denman <pdenman@ims.ltd.uk>
Subject: Re: Too Many Files for Foreach Loop?
Message-Id: <33E882AC.2D0B3937@absyss.fr>
[posted and mailed]
Paul Denman wrote:
>
> --- snip ---
> foreach $file_in (< *.dat>) {
> print "File: $file_in\n";
> open (FILEIN, $file_in) || die ("unable to open file $file_in");
>
> perform processing here...
>
> close (FILEIN);
> }
> --- snip ---
>
> This has worked when there have only been a handful of files, but it
> is producing nothing with such a large number of files.
> I am running Perl5 on a Unix box (Irix v.5)
Globbing (<*.dat> in your example) is done by csh. It would not
surprise me if it had limitations of this sort. Smallish buffers and so
on. I know I have had problems with enviroment variables being too long
for csh but work perfectly well with tcsh and bash. My advice is to
chuck globbing, use opendir() followed by grep(readdir()) to get what
you want. No extra processes and no csh.
- doug
------------------------------
Date: Tue, 05 Aug 1997 12:01:59 -0700
From: Fabio Speciale <fspecial@ucsd.edu>
Subject: Uninitialized variables in scripts
Message-Id: <33E778A6.59C8@ucsd.edu>
Friends:
I am trying to run a script that controls input from an order form, and
I am getting the following error when I run the script from the command
line using "perl -w scriptname.cgi variablename=value":
"Use of uninitialized variable at microsurvey.cgi line 28."
The script is a very simple text manipulation routine that takes input
from the HTML Form, and displays a custom page, sends the input by
e-mail to me, and creates a backup file with this input, but it is just
ignoring the input. Line 28 in the script looks like this:
"read(STDIN, $incoming, $ENV{'CONTENT_LENGTH'});"
I understood that Perl does not require initialization of variables (I
thought there was no way of doing this). And the frustrating part of
this is that this same script was working perfectly a couple of weeks
ago, and there have been no changes to the script or the server. I'm
running an HP-UNIX machine with mosaic server, and Perl 4.3something
interpreter.
If anybody has ANY clue of what might be going on (short of "the little
mouse inside the computer fell of the wheel" ;-) ), I will really
really appreciate it.
Thank you all,
Fabio Speciale (fspecial@ucsd.edu)
------------------------------
Date: Tue, 05 Aug 1997 08:29:50 -0500
From: Don Frazier <donf@eds.com>
Subject: Using Perl/Netscape in a Standalone environment
Message-Id: <33E72ACE.41C67EA6@eds.com>
I want to set up my PC at home to use Perl to create
CGI scripts. This is for learning purposes for my part
(hopefully to help the old career with some new options).
I have Win 95 running, Netscape 3.0, and Perl from
activeware the 5.003 or whatever build from the end
of July. I've searched for instructions but can't seem
to make the right connection. It seems I need a server
to interpret my CGI scripts so I downloaded the Microsoft
Personal Web Server. I don't have a physical network
card so now I get several error messages on the NET START
command added by installing PWS. THe HTTP service
does not start when I view it in the PWS applet from
control panel.
Questions: Can someone point me to instructions to
setup Perl/Netscape/Win95/some server so I can use a
"standalone" PC (not connected to anything) to
create CGI scripts in Perl? Any help appreciated.
Right now, whenever my script should be called, I get
the Netscape option asking me to configure the application
for files of type ".pl". The script runs, but in a DOS
window. This is obviously not what I need to happen.
Don Frazier
Please reply to newsgroup as my e-mail
address is invalid.
------------------------------
Date: Wed, 6 Aug 1997 10:22:26 GMT
From: genepool@netcom.com (Jim Michael)
Subject: Re: Using Perl/Netscape in a Standalone environment
Message-Id: <genepoolEEHM5E.A8K@netcom.com>
Don Frazier (donf@eds.com) wrote:
: I have Win 95 running, Netscape 3.0, and Perl from
: activeware the 5.003 or whatever build from the end
: of July. I've searched for instructions but can't seem
: to make the right connection. It seems I need a server
: to interpret my CGI scripts so I downloaded the Microsoft
: Personal Web Server. I don't have a physical network
: card so now I get several error messages on the NET START
: command added by installing PWS. THe HTTP service
: does not start when I view it in the PWS applet from
: control panel.
I don't know if you can install TCP/IP in a system without a net card,
if you can use 127.0.0.1 (loopback address) as the IP address. An ISA net
card should run about $30 if required. For instructions on getting your
web server to work with Perl you should check the Microsoft web site and
the dejanews database. Try a search on 'perl personal web server' and
search the old and new databases. I bet there is even a newsgroup for cgi
questions. Good luck!
Cheers,
Jim
------------------------------
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 836
*************************************