[8266] in Perl-Users-Digest
Perl-Users Digest, Issue: 1883 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Feb 12 22:07:23 1998
Date: Thu, 12 Feb 98 19:00:24 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 12 Feb 1998 Volume: 8 Number: 1883
Today's topics:
Re: ? Regular Expressions ? (John Moreno)
Re: ? Regular Expressions ? (John Moreno)
Re: assigning variable names (Martien Verbruggen)
CGI vs ASP debate <psherman@frontiernet.net>
Re: CRs in scripts - ARGH! (Martien Verbruggen)
Re: Date validation (Clay Irving)
Re: FAQless Forays (was: Code Example Needed) <dformosa@st.nepean.uws.edu.au>
Re: FAQless Forays (was: Code Example Needed) <evan@garrett.hpl.hp.com>
Re: FTP as filehandle (Martien Verbruggen)
Re: getting strings (Martien Verbruggen)
Re: HTTP::Request -- Using POST to cgi forms <jsd@hudsucker.gamespot.com>
Re: MATH <corky@ultranet.com>
Re: Moderated ng [Was: Re: So what about last summer's <rra@stanford.edu>
Re: Moderated ng [Was: Re: So what about last summer's (John Stanley)
Perl and fast (big) file parsing <cybersky@generation.net_no_spam>
Re: Reload/unload modules? <zenin@best.com>
Re: time for comp.lang.perl.more-needed ? (Re: repetiti (Martien Verbruggen)
Re: Tom wins flamer of the year award! <corky@ultranet.com>
Re: Use versus Require -- One More Time <rra@stanford.edu>
Re: Using flock? <rra@stanford.edu>
Re: Why is Tom Christiansen so rude? <cybersky@generation.net_no_spam>
Re: Why is Tom Christiansen so rude? <cybersky@generation.net_no_spam>
Your Wishes Granted [was: TENDERS INVITED] <dgoddard@us.oracle.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 12 Feb 1998 21:04:49 -0500
From: phenix@interpath.com (John Moreno)
Subject: Re: ? Regular Expressions ?
Message-Id: <1d4cuck.19a15k71ezdpbgN@roxboro0-019.dyn.interpath.net>
Martien Verbruggen <mgjv@comdyn.com.au> wrote:
> In article <1d4c5o9.1tnppmthaqejN@roxboro0-019.dyn.interpath.net>,
> phenix@interpath.com (John Moreno) writes:
> > Tom, maybe what should be done is to add in a bit of self-moderation -
> > create a X header that says you've read the perl faq (or maybe even more
> > generally X-FAQs-Read: perl, cgi, etc,) and then you can killfile or
> > autorespond to anybody that post without it.
>
> The people who should see those headers probably won't even realise
> there is such a thing as a header to a post. They probably use some
> program that by default doesn't display X- headers anyway, and
> probably wouldn't know how to view them.
They don't need to SEE them - we can filter or score on it's presence
and Tom or somebody can set up a automatic reply to any post without it
(or the equivalent in the sig). Add it in to the FAQ for the group, and
we're set.
--
John Moreno
------------------------------
Date: Thu, 12 Feb 1998 21:04:52 -0500
From: phenix@interpath.com (John Moreno)
Subject: Re: ? Regular Expressions ?
Message-Id: <1d4cum7.1l0m8lx1rb521bN@roxboro0-019.dyn.interpath.net>
Graham Barr <gbarr@ti.com> wrote:
> John Moreno wrote:
> > Tom, maybe what should be done is to add in a bit of self-moderation -
> > create a X header that says you've read the perl faq (or maybe even more
> > generally X-FAQs-Read: perl, cgi, etc,) and then you can killfile or
> > autorespond to anybody that post without it.
>
> And so everyone who uses a reader which does not allow you to
> add your own headers is doomed to not get a responce because
> they will be killfiled.
>
> I think that is not very fair is it.
You obviously missed the last sentence where I said that it could also
be put in the sig for people who can't add custom headers - for example
dejanews post.
--
John Moreno
------------------------------
Date: 12 Feb 1998 23:50:37 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: assigning variable names
Message-Id: <6c01sd$b49$1@comdyn.comdyn.com.au>
In article <19980212191500.OAA04067@ladder02.news.aol.com>,
jfontaine2@aol.com (Jfontaine2) writes:
> I am looking to write a script that will take a given paramater, assign it a
> name, and then concatonate it with other parameters to assemble a file name.
> In the long run, the program will then take the filename and fetch it from the
> server. I am having trouble assigning the parameters names though. Could
> anyone provide me with some insight??
I have a very hard time understanding what you're trying to do. Get a
file from 'the server'? rcp? ftp? tftp? floppy disks?
Oh wait.. Maybe you mean http? Try using the LWP module.
Now.. As for 'trouble assigning the parameters names', what does that
mean? You can give a parameter (whatever you mean by that) any name.
You will really have to be a bit more specific. Some example code of
what you tried might be very wise.
> I can be reached at jfontaine2@aol.com
Why doesn't that surprise me?
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | Very funny Scotty, now beam down my
Commercial Dynamics Pty. Ltd. | clothes.
NSW, Australia |
------------------------------
Date: 13 Feb 1998 01:11:58 GMT
From: "Paul S" <psherman@frontiernet.net>
Subject: CGI vs ASP debate
Message-Id: <6c06ku$1q4q$1@node17.cwnet.frontiernet.net>
Anyone going to put in their two cents tonight about the continued
usefulness of Perl? I'm hosting a 2-hour chat/debate thing running
on a Perl script (PWS on Win95) from 9-11 pm EST.
I'm new to Perl myself, fairly new to scripting/programming in general.
For myself and I'm sure many others, I could use some input. There are a lot
of you out there who have answers I would be hard pressed to find elsewhere.
And there are some of you who might want to take on the MS disciples.
Anyway, the chat page can be accessed through my from door:
http://www27.pair.com/pixman1/
or, as of the moment, the URL is:
http://209.130.133.139/
Any input would be appreciated.
Paul
psherman@frontiernet.net
------------------------------
Date: 12 Feb 1998 23:57:20 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: CRs in scripts - ARGH!
Message-Id: <6c0290$b49$3@comdyn.comdyn.com.au>
In article <34E34AB2.7818C87B@beagle.colorado.edu>,
David Hardy <dhardy@beagle.colorado.edu> writes:
> Does anyone know of an easy way to make perl accept CR/LFs as well as
> just LFs in scripts? It's a pain in the neck to have to convert when I
> write scripts on my PC.
*sigh*
ftp the files in ascii mode, not binary mode.
perldoc perlfaq9
http://www.perl.com/CPAN/doc/FAQs/cgi/idiots-guide.html
http://www.perl.com/CPAN/doc/FAQs/cgi/perl-cgi-faq.html
http://www.perl.com/CPAN/doc/FAQs/win32/Perl_for_Win32_FAQ.html
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | In a world without fences, who needs
Commercial Dynamics Pty. Ltd. | Gates?
NSW, Australia |
------------------------------
Date: 12 Feb 1998 21:13:23 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: Date validation
Message-Id: <6c0a83$s04@panix.com>
In <6bv9j2$s1s$1@cronkite.ocis.temple.edu> stan@thunder.temple.edu (Stan Horwitz) writes:
>I am trying to write a date validation routine in Perl on a Unix box. The
>date is to be entered on a terminal in response to a prompt. The date is
>stored as a string in the format mm/dd/yyyy. When I try to make sure that
>"mm" is in the range 01 to 12, I run into a problem, perhaps the result of
>my being somewhat inexperienced at Perl programming.
>Here's what I came up with:
> if (substr($start_date, 0, 2) ne "01 .. 12")
> {
> $date_okay = "N"; print "\n Invalid date ".$start_date;
> }
>But this just doesn't seem to work. What am I doing wrong?
>Any suggestions you may have will be appreciated.
I'm lazy. I'd just use my friend, a Perl Module called Date::DateCalc.
#!/usr/local/bin/perl -w
use Date::DateCalc qw(leap);
while (DATA>) {
chomp;
($month, $day, $year) = split /\//;
if (check_date($year, $month, $day)) {
print "$_ is a valid date.\n";
} else {
print "$_ is not a valid date.\n";
}
}
__DATA__
02/30/1997
04/01/1997
12/20/1997
12/31/1997
would print:
02/30/1997 is not a valid date.
04/01/1997 is a valid date.
12/20/1997 is a valid date.
12/31/1997 is a valid date.
--
Clay Irving <clay@panix.com> I think, therefore I am. I think?
http://www.panix.com/~clay/
------------------------------
Date: 13 Feb 1998 00:08:06 GMT
From: ? the platypus {aka David Formosa} <dformosa@st.nepean.uws.edu.au>
Subject: Re: FAQless Forays (was: Code Example Needed)
Message-Id: <887328447.215503@cabal>
In <slrn6e5ud8.7c1.gabor@vnode.vmunix.com> gabor@vmunix.com (Gabor) writes:
[...]
>Oh, come on. I post from a PC. It just happens to be running
>FreeBSD, and has about 10 users. PC user != idiot.
If it has more then one user then it is not a PC.
--
Please excuse my spelling as I suffer from agraphia see the url in my header.
Never trust a country with more peaple then sheep.
Support NoCeM http://www.cm.org/
I'm sorry but I just don't consider 'because its yucky' a convincing argument
------------------------------
Date: 12 Feb 1998 17:42:01 -0800
From: Evan Kirshenbaum <evan@garrett.hpl.hp.com>
Subject: Re: FAQless Forays (was: Code Example Needed)
Message-Id: <v9hn2fwmgba.fsf@garrett.hpl.hp.com>
Dan Boorstein <danboo@negia.net> writes:
> isn't larry wall a linguist? how did he become a programmer
> (honestly, i am interested to know)?
Hey! The two aren't necessarily mutually exclusive. :-) And if your
specialization is formal language theory (as mine was; I don't know
about Larry's), they can actually be quite similar, and skills picked
up in one serve you in good stead in the other.
AB Linguistics, MS Computer Science, Stanford '87
--
Evan Kirshenbaum +------------------------------------
HP Laboratories |To express oneself
1501 Page Mill Road, Building 1U |In seventeen syllables
Palo Alto, CA 94304 |Is very diffic
| Tony Finch
kirshenbaum@hpl.hp.com
(650)857-7572
http://www.hpl.hp.com/personal/Evan_Kirshenbaum/
------------------------------
Date: 13 Feb 1998 00:00:52 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: FTP as filehandle
Message-Id: <6c02fk$b49$4@comdyn.comdyn.com.au>
In article <6bvms5$3v3$1@news4.ispnews.com>,
traveler@rust.net (Reilly Shea) writes:
> I open an ftp process as a filehandle doing the following..
> open(FTP,|ftp somemachine");
Bad. You don't check the return value of an open(). You should be
using one of the modules, like Net::FTP and Net::Netrc, or the LWP
stuff.
> What I want to know is how can I tell if the open fails (i.e. from an
> incorrect login, etc.)
You don't want to know if the open fails (and you should want to), but
if the program somehow cannot do what you want it to do. You most
likely will not be able to do that using a pipe, or even a system
call. Use one of the modules.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au |
Commercial Dynamics Pty. Ltd. | Curiouser and curiouser, said Alice.
NSW, Australia |
------------------------------
Date: 13 Feb 1998 00:08:23 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: getting strings
Message-Id: <6c02tn$b49$5@comdyn.comdyn.com.au>
In article <19980212184108.AAA11298@rick.internetx.net>,
rick@internetx.net ("Rick Bauman") writes:
> ajr 1998/02/09 18:28:19 1998/02/09 18:29:03
> ajr 1998/02/09 18:51:34 1998/02/09 19:20:00
> the script is as follows:
>
> $query_string = "$ENV{'QUERY_STRING'}";
If it's a cgi, you really should be using CGI.pm
> # Open logs and get the info you need
> open(SESSIONIX, "/etc/local/logscripts/userdata/sessionlog.ix");
You are not checking the return value of open()
perldoc -f open
> while(<SESSIONIX>) {
> ($userid, $therest) = split(//,$Line,2);
perldoc -f split
You're splitting on a null pattern, which will always match. You will
now have the two first characters stored in the two variables. You
will want
split(/\s+/, $Line, 2);
> if($query_string eq $userid) {
This isn't very robust
> print $_;
> print "\<br\>"
> }
> }
> next;
> close(SESSIONIX);
What about
while (<SESSIONIX>)
{
if (/^$querystring\s+/)
{
print $_;
}
}
This functionally does almost the same.
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | We are born naked, wet and hungry. Then
Commercial Dynamics Pty. Ltd. | things get worse.
NSW, Australia |
------------------------------
Date: 13 Feb 1998 00:48:26 GMT
From: Jon Drukman <jsd@hudsucker.gamespot.com>
Subject: Re: HTTP::Request -- Using POST to cgi forms
Message-Id: <6c058q$ka8$1@its.hooked.net>
Yusuf Pisan <y-pisan@nwu.edu> wrote:
: I am trying to use the program below to 'POST' a message-id to
: dehanews pages and read the response. I get the following error when
: I try to run the program
:
: Can't call method "clone" on unblessed reference at
: /usr/local/lib/perl5/site_perl/HTTP/Message.pm line 50.
: I am using perl version 5.004_04 built for aix.
: Any suggestions on what I might be doing wrong??
you didn't read the manpage for lwp. in particular it comes with one
page called lwpcook which shows precisely how to do it.
try this:
use LWP::UserAgent;
$ua = new LWP::UserAgent;
my $req = new HTTP::Request 'POST','http://search.dejanews.com/msgid.xp';
$req->content_type('application/x-www-form-urlencoded');
$req->content('MID=<199801302242.QAA04201@relay.acns.nwu.edu>&AH=1');
my $res = $ua->request($req);
print $res->as_string;
------------------------------
Date: Thu, 12 Feb 1998 20:50:54 -0500
From: Bob Trieger <corky@ultranet.com>
To: George Cushing <gcushing@exchange.nih.gov>
Subject: Re: MATH
Message-Id: <34E3A6FE.17D3@ultranet.com>
George Cushing wrote:
>
> I am doing some dividing in Perl. How do I round up my results to 2
> decimal digits?
> I am new to Perl and will appreciate some help.
printf "%.2f", $number + .005;
HTH
Bob Trieger
corky@ma.ultranet.com
------------------------------
Date: 12 Feb 1998 16:40:28 -0800
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Moderated ng [Was: Re: So what about last summer's RFD? Let's go moderated.]
Message-Id: <m3d8gscp6r.fsf@windlord.Stanford.EDU>
Malcolm Hoar <malch@malch.com> writes:
> Ummmm, "comp.lang.perl.moderated" sounds better to me. It's a more
> accurate description and doesn't smack of elitism!!!
What's wrong with elitism?
If people who thoroughly understand a topic want to discuss the
intricacies of it without being deluged with questions from people who
don't have sufficient knowledge to discuss things at that level yet, why
shouldn't they be able to do so? One of the greatest crimes that the
ideal of democracy has inflicted on the human race is this concept that
not only are all men created equal, but that they are somehow equal in all
respects.
It's simply not true.
Some people know more about things than others. Some people are capable
of behaving themselves in public and some people aren't. Some people are
capable of being grateful and courteous and not wasting other people's
time and some people are not. And there is absolutely no reason why those
people who know how to make effective use of a newsgroup should have to
put up with the people who don't.
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: 13 Feb 1998 02:52:51 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: Moderated ng [Was: Re: So what about last summer's RFD? Let's go moderated.]
Message-Id: <6c0ci3$rks$1@news.orst.edu>
In article <m3d8gscp6r.fsf@windlord.Stanford.EDU>,
Russ Allbery <rra@stanford.edu> wrote:
>What's wrong with elitism?
Well and truly spoken.
>If people who thoroughly understand a topic want to discuss the
>intricacies of it without being deluged with questions from people who
>don't have sufficient knowledge to discuss things at that level yet, why
>shouldn't they be able to do so?
Russ, you shouldn't need this clue, but here it is anyway: nothing is
stopping the elite from discussing elite things right here in this
newsgroup. The only problem that the elite might have is that scum using
scurilous newsreaders might overhear them talking. Why should this be a
problem? Is it a bad thing if the scum learn things?
------------------------------
Date: Fri, 13 Feb 1998 07:19:59 +0000
From: Amine <cybersky@generation.net_no_spam>
Subject: Perl and fast (big) file parsing
Message-Id: <34E3F41F.4D35@generation.net_no_spam>
Hello all ,
i am trying to parse every character of a big file by doing like this
while (!eof(MGRFILE))
{
seek(MGRFILE,$i,0);
read(MGRFILE,$a,1);
$i++;
}
but this is taking very very long time for big files like 10+ Mo
how can i do it more quikly without rewriting it in C ?
Note that i don't want to slurp it in memory this will take too much
memory .
Thanks in advance
Amine
------------------------------
Date: 13 Feb 1998 01:53:22 GMT
From: Zenin <zenin@best.com>
Subject: Re: Reload/unload modules?
Message-Id: <887335065.409569@thrush.omix.com>
Rauli Ruohonen <raulir@voimax.cygnnet.jkl.fi> wrote:
: Is it possible to reload or unload modules?
Yes...but why do you want to do this? I do it in a number of
my applications, but only with vary good reasons. When I do
have to do this kind of thing, I normally try to reload a code
ref instead of a full module.
: Python has "reload()" but perl seems to have nothing.
Probably because it's not really needed by most mortal programmers.
:-)
: I tried to remove a module by deleting its symbol
: table entries, but it doesn't free all the memory the module has
: allocated.
Hmm, how are you checking this? Even if you free() the memory, it
will still be "in use" by the application as no memory is freed to
the system until an exec() is called. Free()ed memory however, is
available to future malloc() calls by the same application. This
isn't perl, it's basic Unix internals.
: Is there a way to do this cleanly
Nope. Well, I guess it depends on your idea of "cleanly". It also
depends on what type of module you're talking about. Is it done in
pure perl, or as dynamically loaded C?
: or otherwise?
Maybe...you might want to post what you're trying to do. It's
*vary* rare that one ever needs to reload a module in perl, and
when one does, it's normally *much* easier to simply reload a
code reference and not a full module.
--
-Zenin
zenin@best.com
------------------------------
Date: 12 Feb 1998 23:54:21 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: time for comp.lang.perl.more-needed ? (Re: repetitive FAQ posts)
Message-Id: <6c023d$b49$2@comdyn.comdyn.com.au>
In article <7xk9b0wqk4.fsf@beavis.vcpc.univie.ac.at>,
Remove xx to reply <xxTony.Curtis@vcpc.univie.ac.at> writes:
>
> Maybe the clp hierarchy should be extended?
>
> clp.www or clp.cgi
Please not. There are already a whole bunch of www related groups, of
which at least one is about CGI. The logic you use also would need a
comp.lang.c.www and .cgi, comp.lang.c++.www and .cgi,
comp.lang.tcl.www, comp.lang.python.ww etc. CGI is just an interface,
and really has nothing to do with perl. The WWW is just a way to
display some content in a pretty way, and really has nothing to woth
perl.
$.02
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | Little girls, like butterflies, need no
Commercial Dynamics Pty. Ltd. | excuse - Lazarus Long
NSW, Australia |
------------------------------
Date: Thu, 12 Feb 1998 20:43:19 -0500
From: Bob Trieger <corky@ultranet.com>
Subject: Re: Tom wins flamer of the year award!
Message-Id: <34E3A537.81F@ultranet.com>
Douglas Clifton wrote:
>
> ;-)
Oh damn, I had my money on Elton John for that song parody of his about
Diana.
------------------------------
Date: 12 Feb 1998 16:46:55 -0800
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Use versus Require -- One More Time
Message-Id: <m37m70cow0.fsf@windlord.Stanford.EDU>
Eric Weiss <eweiss@winchendon.com> writes:
> For 5.003, the variable that is never exported or export_ok'd is always
> available as pack::var, but the subroutine that is never exported is
> never reachable. Shouldn't it be? With require, EXPORT'd subroutines
> need to be prefixed with pack:: which does not seem to be the expected
> behavior. EXPORT_OK's also need pack:: With use (list) EXPORT'd
> subroutines that are not in the list also need pack:: I thought
> everything EXPORT'd was available whether listed or not and that the
> list only affected EXPORT_OK.
I'm surprised that the documentation for use in man perlfunc didn't help
answer all of these questions. Could you read it over and let us know
what's still unclear?
use Module LIST
use Module
use Module VERSION LIST
use VERSION
Imports some semantics into the current package from the named
module, generally by aliasing certain subroutine or variable
names into your package. It is exactly equivalent to
BEGIN { require Module; import Module LIST; }
except that Module *must* be a bareword.
If the first argument to `use' is a number, it is treated as a
version number instead of a module name. If the version of the
Perl interpreter is less than VERSION, then an error message is
printed and Perl exits immediately. This is often useful if you
need to check the current Perl version before `use'ing library
modules which have changed in incompatible ways from older
versions of Perl. (We try not to do this more than we have to.)
The BEGIN forces the require and import to happen at compile
time. The require makes sure the module is loaded into memory if
it hasn't been yet. The import is not a builtin--it's just an
ordinary static method call into the "Module" package to tell
the module to import the list of features back into the current
package. The module can implement its import method any way it
likes, though most modules just choose to derive their import
method via inheritance from the Exporter class that is defined
in the Exporter module. See the Exporter manpage. If no import
method can be found then the error is currently silently
ignored. This may change to a fatal error in a future version.
If you don't want your namespace altered, explicitly supply an
empty list:
use Module ();
That is exactly equivalent to
BEGIN { require Module; }
If the VERSION argument is present between Module and LIST, then
the `use' will call the VERSION method in class Module with the
given version as an argument. The default VERSION method,
inherited from the Universal class, croaks if the given version
is larger than the value of the variable $Module::VERSION. (Note
that there is not a comma after VERSION!)
Because this is a wide-open interface, pragmas (compiler
directives) are also implemented this way. Currently implemented
pragmas are:
use integer;
use diagnostics;
use sigtrap qw(SEGV BUS);
use strict qw(subs vars refs);
use subs qw(afunc blurfl);
These pseudo-modules import semantics into the current block
scope, unlike ordinary modules, which import symbols into the
current package (which are effective through the end of the
file).
There's a corresponding "no" command that unimports meanings
imported by use, i.e., it calls `unimport Module LIST' instead
of `import'.
no integer;
no strict 'refs';
If no unimport method can be found the call fails with a fatal
error.
See the perlmod manpage for a list of standard modules and
pragmas.
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: 12 Feb 1998 16:43:51 -0800
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Using flock?
Message-Id: <m3afbwcp14.fsf@windlord.Stanford.EDU>
Jochen Wiedmann <joe@ispsoft.de> writes:
> Question arises: What does "flock FILE,8" do? Or, in other words: Is
> this even usable?
It releases the advisory lock on the file. Yes, it is actually usable;
you just don't want to use it very much.
Your lock is automatically released when you close the file, so in 99% of
all cases that's what you want to do. That way, the operating system
cleans up your locks and you don't even have to think about it. Releasing
the lock yourself with flock() is *only* useful if you want to keep the
file open but want to allow other people to lock it.
If you're using a recent (5.004 or newer) version of Perl, you should be
able to use flock FILE,8 without too many difficulties, as it now
automatically flushes the stdio buffers. However, for compatibility with
previous versions of Perl, you shouldn't rely on that, and that's the main
gotcha with flock. You *have* to make sure that all your buffered output
is flushed *before* you release your lock, or you may end up writing to
the file without it being locked, which is just asking for problems.
The solution is to either flush the file handle or set it autoflushing if
you intend to unlock it manually.
(And again, in 99% of all circumstances, you just want to close the file
and not worry about it.)
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: Fri, 13 Feb 1998 07:53:06 +0000
From: Amine <cybersky@generation.net_no_spam>
Subject: Re: Why is Tom Christiansen so rude?
Message-Id: <34E3FBE2.6C32@generation.net_no_spam>
Hello guys i am new here in this newsgroup i just come from
the ActiveState Mailing list where i was getting a little ill
and depressif cause of the ActiveState win32 Perl non-portable issues
like
(Perlscript,ISAPI,PerlEX..)
But can you tell me guys what's this newsgroup all about,i see
different things also like CGI,Perl,Perl
Porters,Newbies,Christiansen.... ?
What's that!
Think am going to shoot myself with a gun!
Thanks
Amine
------------------------------
Date: Fri, 13 Feb 1998 08:28:55 +0000
From: Amine <cybersky@generation.net_no_spam>
Subject: Re: Why is Tom Christiansen so rude?
Message-Id: <34E40447.4AA@generation.net_no_spam>
Hello GS ,
I just want to tell you that you are doing a good job with the
Perl GS Win32 port and especially the last lib10.
So hope you will continu to bring us the best .
But i have some little questions for you dear Porters
Why not write a TK Perl Debugger for Win32 ?
Best Regards
Amine Moulay Ramdane
Gurusamy Sarathy wrote:
>
> [ mailed and posted ]
>
> In article <eyhen18vinn.fsf@liddell.cstr.ed.ac.uk>,
> Richard Caley <spt@cstr.ed.ac.uk> wrote:
> >
> >He's not. He was implemented by Ken Thompson.
> >
>
> Ahh, therein lies the rub. The problem may be that he's still a
> command-line tool. People who get to know the interface _always_
> find him indispensable.
>
> At the time of his writing, Ken designed him so that he needed
> no maintainence. You see, he rewrites himself every few
> months. Originally, he preferred to use C, but for the last decade
> or so, he has chosen to rewrite himself in the most current Perl.
>
> The problem with that approach is that Perl itself did not work
> properly on Windows until recently. So the current Tom version
> hasn't had a chance to regression-test himself there. This
> usually meant that he did not even produce friendly-looking error
> messages when run on Windows. Curiously, the most recent version
> even goes ahead and crashes Windows, perhaps because he knows it
> is pointless running there if he cannot do anything useful, which
> seems logical in a cold sorta way. But it is destructive, and
> has a self-limiting effect on the widespread use of Tom.
>
> I think the time has come for The Perl Institute to sponsor a project
> to manually restart the rewrite cycle, so Tom can port himself into
> portable perl. Nobody has any idea exactly how long this will take.
>
> I advise people to stay calm, and let Tom evolve into something
> ever more beautiful. Until then, simply ignore the error messages.
>
> - Sarathy.
> gsar@umich.edu
>
> P.S: I have CC-ed the appropriate people for timely action in this
> matter.
------------------------------
Date: Thu, 12 Feb 1998 18:22:17 -0800
From: Denis Goddard <dgoddard@us.oracle.com>
Subject: Your Wishes Granted [was: TENDERS INVITED]
Message-Id: <34E3AE59.59D1FAE0@us.oracle.com>
Dear John and Windy,
I am pleased to announce that I have granted *ALL* your wishes!
I was able to do this owing to my professional experience with Software
Requirements. The requirements you have so thoughtfully supplied greatly
simplified my task, which was made all the easier by Perl itself, and
some of the more powerful modules on CPAN. Read on!
John and Widy wrote:
>
> Tenders are invited for the contruction of a software app which will:
>
> (1) Allow me to write a contents page, each item active
Okay. Here goes:
perl -e 'print "You are allowed!\n";'
That was easy, what next...?
> (2) Allow me to write chapters, occasional word active (I need to choose
> which ones after I finish writing
Not only can I do this, but I will close that dangling parenthesis:
perl -e 'print "You are allowed! )\n";'
> (3) Each page needs a [Contents], [previous page] and [next page]
> buttons
OOOOooooo... THIS one is a little harder:
#!/usr/bin/perl
use CGI; my $love = new CGI;
print $love->start_html; print $love->startform;
print $love->submit('Action','Contents');
print $love->submit('Action','previous page');
print $love->submit('Action','next page');
> (4) I need to insert graphic illustrations at will
perl -e "print img {-src=>'fred.gif',-align=>'LEFT'};"
# Right from the FAQ, jack!
> (5) Final publication must be a single exe file, or at least secure from
> tampering
chmod 0 perlscript
> (6) Final publication must be printable, but not Copy/Paste-able
chmod 444 perlscript
> (6) I will provide graphics as required for Name of App, Headers,
> Footers etc.
require 'etc.pl';
> Please reply by email, at your earliest convenience. Tenders close Feb
> 22, 1998. Lowest or any tender not necessarily accepted.
How's Free?
>
> Thanks in advance
>
> JOHN WRIGHT
You're welcome.
-Denis
--
__ __ _ __ __
~~~~(__)|-< /-\(__ |__(-_ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Denis Goddard, Senior Member, Tech. Staff |"I see the heads of men arise
email: dgoddard@us.oracle.com |with hungry minds and open eyes!"
ourworld.compuserve.com/homepages/d_goddard| -Rush, from 2112: _The Oracle_
------------------------------
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 1883
**************************************