[11963] in Perl-Users-Digest
Perl-Users Digest, Issue: 5563 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 4 19:07:21 1999
Date: Tue, 4 May 99 16:00:18 -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 Tue, 4 May 1999 Volume: 8 Number: 5563
Today's topics:
Re: "learning perl" does not seem to be written well (Damian Conway)
Re: Accelerated Perl Programming (Tad McClellan)
Re: Declaration Help Please! <nospam_earnold@requisite.com>
How do I hide my source code (was Re: Making executable (Bob Trieger)
Re: How do I hide my source code (was Re: Making execut <agjemmes@extremeonline.com>
Re: How do I hide my source code (was Re: Making execut <All@n.due.net>
how do I slurp a file into a string <brannon@quake.usc.edu>
Re: how do I slurp a file into a string (Sam Holden)
Re: how to compare standard arrays? duke@no.spam.ee
Re: how to compare standard arrays? (Larry Rosler)
Re: Limit to number of if statements??? <uri@ibnets.com>
Re: Limit to number of if statements??? (Bob Trieger)
Re: Limit to number of if statements??? (Larry Rosler)
Re: Limit to number of if statements??? (Larry Rosler)
Re: Meta Search Engine <design@raincloud-studios.com>
Re: Newbie in need (reading a file into an array) (Sam Holden)
Re: Newsfeed and Local Weather <tchrist@mox.perl.com>
Re: Pattern Matching and parsing (Larry Rosler)
Re: Perl 5: The Complete Reference, Martin Brown (Jack Applin)
perl file "busy"? how can that be? (Timothy Larson)
Re: Perl in the workplace <cassell@mail.cor.epa.gov>
Re: Permutations <bigbird@pol.com>
Re: Please help me (nobody ever does :( <agjemmes@extremeonline.com>
Re: Please help me (nobody ever does :( <gregm@well.com>
Re: Question: Updating an Array... <uri@ibnets.com>
Re: Question: Updating an Array... (Larry Rosler)
Re: Thread module + leaking memory <sugalskd@netserve.ous.edu>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 4 May 1999 22:17:13 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: Re: "learning perl" does not seem to be written well
Message-Id: <7gnrl9$h89$1@towncrier.cc.monash.edu.au>
Uri Guttman <uri@ibnets.com> writes:
> AJ> One book rather like that should be out sometime in August:
> AJ> http://www.manning.com/Johnson/
>i won't judge this book until i see it, but the publisher has left me
>cold. they spammed this group and various perl hackers via email about
>their books, never sent any followup information, and in general
>seemed to be unsavory fellows.
Up-front disclaimer: I have a book about to be published by Manning.
Various Manning staff have posted perfectly reasonable requests for
reviewers for several books here, and twice they have posted about
Andrew Johnson's upcoming book in direct response to messages
decrying the lack of a Perl book for novice programmers. That hardly
constitutes spam.
The message that was sent to "various perl hackers" was a
politely-worded invitation to write for the publisher, which is trying
to establish a presence in the Perl market. When some of those
"hackers" publicly queried the targeting and format of the message, a
public apology was posted (to p5p). That indicates an original lack of
understanding of netiquette on the part of a single Manning employee
(who is no longer with the company), but it's hardly a pattern of
unsavory behaviour.
In the case of my own forthcoming book, Manning have gone to a great
deal of trouble to find competent and reliable reviewers. Being new to
Perl publishing, they didn't have the same connections as O'Reilly, so
they were forced to make unsolicited approaches to suitable people.
They never tried to sell them anything - they just asked if they'd
be interested in writing or reviewing a new book. Again, that's
hardly spam.
Perhaps Uri is aware of other behaviour that was somehow inappropriate,
but, checking through dejanews, it's not evident to me.
Of course he's right to be wary of new Perl publishers, since the books
they publish often don't live up the high standard that O'Reilly has
set. But it's unfair to cast aspersions on the likely quality of the
books even before they've been published.
I'm sure Uri isn't prejudging the books himself, but his stature in the
Perl community means that he may be prejudicing others against them. By
all means burn Andrew and myself at the stake if our Manning-published
books eventually suck, but please don't light the fire until then.
Damian
------------------------------
Date: Tue, 4 May 1999 11:52:38 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Accelerated Perl Programming
Message-Id: <645ng7.464.ln@magna.metronet.com>
ITTE (info@itte.org) wrote:
: Accelerated Perl Programming, (Intro-Interm.)
I wondered what the Instructor's qualifications are so I went to
(even though I would never do business with an Internet Abuser):
: http://www.itte.org/TRAIN.perl.html
Got a 404 error.
That is not very impressive...
After fixing the URL, I found that there is no information on
the qualifications of their instructors.
That is not very impressive...
: To our knowledge, no other workshop provides as much learning in
: such a brief time.
So, either they teach you a lot, or they don't know much.
Kinda leaves me wondering...
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 4 May 1999 15:25:35 -0600
From: "Eric Arnold" <nospam_earnold@requisite.com>
Subject: Re: Declaration Help Please!
Message-Id: <7gnoiu$69h$1@news1.rmi.net>
You must have errors in some other part of the program, because this
fragment works in insolation. You probably need to post more of it.
CNE_Morti wrote in message <7gn3p7$c9u$1@nnrp1.dejanews.com>...
>OK, I've corrected the typo with ( and } and also removed the quotes and
used
>the -w
>
>It still does not work and I'm in a real time crunch to get this finished.
>Could someone PLEASE help me correct the code snippet so I can finish this
>project? I realize that you are not being paid to help, but I would really
>appreciate it and I promise to return the favor by helping someone else.
>
>Thank You
>Steve
>
>$department = $FORM{'dept'};
>if ( $department eq 'Information' ) {
> $recipient = 'info@company.com';
>}
>elsif ( $department eq 'Technical Support' ) {
> $recipient = 'help@company.com';
>}
>
>-----------== Posted via Deja News, The Discussion Network ==----------
>http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 04 May 1999 21:31:05 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: How do I hide my source code (was Re: Making executables from .pl files?)
Message-Id: <7gno6r$671$2@birch.prod.itd.earthlink.net>
[ courtesy cc sent by mail if address not munged ]
"Asbjorn Gjemmestad" <agjemmes@extremeonline.com> wrote:
>I am looking for a way to make executables from my .pl files to avoid
>shipping my source code with my programs. I know perl2exe does just that,
>but they charge $500 for a full package, so I thought I'd check in here
>first.
Aww come on, your source can't be that embarassing. Let them see it.
PerlFAQ3:
How can I hide the source for my Perl program?
Good luck,
------------------------------
Date: Tue, 4 May 1999 23:49:41 +0200
From: "Asbjorn Gjemmestad" <agjemmes@extremeonline.com>
Subject: Re: How do I hide my source code (was Re: Making executables from .pl files?)
Message-Id: <1WJX2.601$Co.3829@news1.online.no>
It's not that it's embarassing - Just that I don't want people to mess with
my code (not to mention re-using it).
Anywayz, thnx for your help
Asbjorn
Bob Trieger skrev i meldingen <7gno6r$671$2@birch.prod.itd.earthlink.net>...
>[ courtesy cc sent by mail if address not munged ]
>
>"Asbjorn Gjemmestad" <agjemmes@extremeonline.com> wrote:
>>I am looking for a way to make executables from my .pl files to avoid
>>shipping my source code with my programs. I know perl2exe does just that,
>>but they charge $500 for a full package, so I thought I'd check in here
>>first.
>
>Aww come on, your source can't be that embarassing. Let them see it.
>
>PerlFAQ3:
> How can I hide the source for my Perl program?
>
>
>Good luck,
>
>
------------------------------
Date: Tue, 04 May 1999 22:00:55 GMT
From: "Allan M. Due" <All@n.due.net>
Subject: Re: How do I hide my source code (was Re: Making executables from .pl files?)
Message-Id: <r6KX2.2376$612.1296@news.rdc1.ct.home.com>
Asbjorn Gjemmestad <agjemmes@extremeonline.com> wrote in message
news:1WJX2.601$Co.3829@news1.online.no...
: It's not that it's embarassing - Just that I don't want people to mess
with
: my code (not to mention re-using it).
:
: Anywayz, thnx for your help
:
: Asbjorn
Sorry, but I had a bad day, I am in a bad mood, and for some reason this
just irked me. Larry and the subsequent pumpkin holders toiled away
creating this incredible language that costs: oh yea it is free. Then
folks want to use this thing that they obtain for free to make stuff that
they want to charge others for. Creating the language is nothing but their
stuff is so important that they can't let others even see it. Are they
kicking back to Larry et al? I don't think so. For me, if you want to
develop proprietary software use a proprietary language. What is it that
Larry said? Oh yea, be consistent.
AmD
------------------------------
Date: 4 May 1999 15:20:27 -0700
From: tbrannon <brannon@quake.usc.edu>
Subject: how do I slurp a file into a string
Message-Id: <ysizu2tsfpee.fsf@nunki.usc.edu>
#!/usr/bin/perl
system "rm -f joblist.asp";
system "wget http://registry.yosemite.cc.ca.us/JobBank/joblist.asp";
open J, "joblist.asp";
## HERE: I want to slurp the file into $file_contents in one line of Perl.
$file_contents='';
while (<F>) {
$file_contents = $file_contents . $_;
}
--
Terrence Brannon * brannon@lnc.usc.edu * http://lnc.usc.edu/~brannon
(213) 740-3397 [office] (323) 294-3028 [home]
------------------------------
Date: 4 May 1999 22:51:22 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: how do I slurp a file into a string
Message-Id: <slrn7iuufa.hb9.sholden@pgrad.cs.usyd.edu.au>
On 4 May 1999 15:20:27 -0700, tbrannon <brannon@quake.usc.edu> wrote:
>
>system "rm -f joblist.asp";
Perl does have an unlink function you know. It's a lot more portable.
>system "wget http://registry.yosemite.cc.ca.us/JobBank/joblist.asp";
Perl does have the LWP module you know. It's a lot more portable and
just as easy to use.
>
>open J, "joblist.asp";
Hope this will never get run more than once at the same time...
>
>## HERE: I want to slurp the file into $file_contents in one line of Perl.
>
>$file_contents='';
>while (<F>) {
> $file_contents = $file_contents . $_;
>}
You could try :
$file_contents='';while (<F>) {$file_contents = $file_contents . $_;}
or you could try :
{ local $/ = undef; $file_contents = <>; }
opening J and reading from F is probably not want you want though...
Naming filehandles J and F is probably not what the person who gets to
maintain this script after you wants.
--
Sam
Can you sum up plan 9 in layman's terms? It does everything Unix does
only less reliably.
--Ken Thompson
------------------------------
Date: 4 May 1999 21:18:04 GMT
From: duke@no.spam.ee
Subject: Re: how to compare standard arrays?
Message-Id: <7gno6c$gm7$1@kadri.ut.ee>
du_bing@my-dejanews.com wrote:
: Why does the following code snippet generate "same array"?
: @test1 = ('one','two');
: @test2 = ('two','three');
: if (@test1 eq @test2)
: { print "same array\n";
Because you use the arrays in scalar context.
The above if statement is interpreted as
if ("2" eq "2")
--
Anti Veeranna
University of Tartu
Estonia
------------------------------
Date: Tue, 4 May 1999 14:44:39 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: how to compare standard arrays?
Message-Id: <MPG.11990a26572739d59899b9@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <7gnlv8$t9l$1@nnrp1.dejanews.com> on Tue, 04 May 1999
20:40:09 GMT, bing-du@tamu.edu <bing-du@tamu.edu> says...
> Why does the following code snippet generate "same array"?
> ------------------------------------------------------------
> #!/usr/local/bin/perl -w
> use strict;
>
> @test1 = ('one','two');
> @test2 = ('two','three');
>
> if (@test1 eq @test2)
> { print "same array\n";
> } else { print "different array\n";}
> --------------------------------------------------------------
>
> Any ideas? Thanks in advance,
Because they have the same number of elements! (That is the meaning of
using the name of an array in a scalar context, such as a string
comparison.)
perlfaq4: "How do I test whether two arrays or hashes are equal?"
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 04 May 1999 16:58:59 -0400
From: Uri Guttman <uri@ibnets.com>
To: "MHCA" <info@modularcenter.com>
Subject: Re: Limit to number of if statements???
Message-Id: <39emkwblgs.fsf@ibnets.com>
>>>>> "M" == MHCA <info@modularcenter.com> writes:
M> Hello, Is there a limit to the length of an if, elsif, else block,
M> or a limit to the number of elsif statements?
not that i know about. but since you build modular homes, why don't you
write modular perl?
just create a hash with the keys of the towns and their values as refs
to the subs to call. you can even use anon subs if they are small. that
is cleaner, faster, more maintainable than a massive if/else mess.
something like:
my %town_to_builder = (
#Homeworks Modular Homes -
Bronx => \&builder_32,
Albany => \&builder_05,
) ;
&{$town_to_builder{ $FORM{'Key4'} }} ;
tadah! nice and neat!
uri
--
Uri Guttman Hacking Perl for Ironbridge Networks
uri@sysarch.com uri@ironbridgenetworks.com
------------------------------
Date: Tue, 04 May 1999 21:17:41 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: Limit to number of if statements???
Message-Id: <7gnndn$671$1@birch.prod.itd.earthlink.net>
[ courtesy cc sent by mail if address not munged ]
"MHCA" <info@modularcenter.com> wrote:
>Hello,
>
>Is there a limit to the length of an if, elsif, else block, or a limit to
>the number of elsif statements?
>
>The following code worked until I added this one more elsif statement:
>
>elsif ($FORM{'Key4'} eq "Bronx") {
># Homeworks Modular Homes - builder_32
>&builder_32;
>}
[ bunch of elsif statements snipplified ]
>
>else {
>&unreferred;
>}
You didn't happen to add that last elsif after the else statement, did
you? There is no limit, but the way you are doing this task is not the
easiest or best.
It looks like you should be using a hash with all possible entries as
its keys.
HTH
------------------------------
Date: Tue, 4 May 1999 14:52:42 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Limit to number of if statements???
Message-Id: <MPG.11990c0687eea23e9899ba@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <39emkwblgs.fsf@ibnets.com> on 04 May 1999 16:58:59 -0400,
Uri Guttman <uri@ibnets.com> says...
...
> my %town_to_builder = (
>
> #Homeworks Modular Homes -
> Bronx => \&builder_32,
>
> Albany => \&builder_05,
> ) ;
>
> &{$town_to_builder{ $FORM{'Key4'} }} ;
>
> tadah! nice and neat!
Too neat, unfortunately. What happens if the hash lookup fails?
&{defined $town_to_builder{$FORM{Key4}} ?
$town_to_builder{$FORM{Key4}} : \&unreferred}};
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 4 May 1999 15:07:14 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Limit to number of if statements???
Message-Id: <MPG.11990f6e49fe27b9899bb@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <MPG.11990c0687eea23e9899ba@nntp.hpl.hp.com> on Tue, 4 May
1999 14:52:42 -0700, Larry Rosler <lr@hpl.hp.com> says...
> In article <39emkwblgs.fsf@ibnets.com> on 04 May 1999 16:58:59 -0400,
> Uri Guttman <uri@ibnets.com> says...
> ...
> > my %town_to_builder = (
> >
> > #Homeworks Modular Homes -
> > Bronx => \&builder_32,
> >
> > Albany => \&builder_05,
> > ) ;
> >
> > &{$town_to_builder{ $FORM{'Key4'} }} ;
> >
> > tadah! nice and neat!
>
> Too neat, unfortunately. What happens if the hash lookup fails?
>
> &{defined $town_to_builder{$FORM{Key4}} ?
> $town_to_builder{$FORM{Key4}} : \&unreferred}};
Much neater:
&{$town_to_builder{$FORM{Key4}} || \&unreferred}};
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 04 May 1999 21:35:48 GMT
From: "Charles R. Thompson" <design@raincloud-studios.com>
Subject: Re: Meta Search Engine
Message-Id: <UKJX2.900$iu1.1274@news.rdc1.tn.home.com>
You might try comp.infosystems.www.authoring.cgi . Lots of folks there
know of premade scripts available on the web. This group mainly deals
with the Perl language itself. So after you get the script and have
problems that are code specific... this is the place to be.
Best of Luck,
CT
Jeff Rus wrote in message <372F51C7.3066@postmark.net>...
>Hi,
>
>I want to add a Meta Search Engine like MetaSearch
>to my site. I would like to be able to add my
>own banners to the search results (so not a service
>like www.whatuseek.com)
>
>Does anyone know of such a script? Or how hard is
>it to create one?
>
>Thanks,
>Jeff Rus
------------------------------
Date: 4 May 1999 22:05:06 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Newbie in need (reading a file into an array)
Message-Id: <slrn7iuroi.hb9.sholden@pgrad.cs.usyd.edu.au>
On Tue, 04 May 1999 15:35:11 GMT, Steve Wood <scwood@home.com> wrote:
>I'm totally new at this (utterly), but wouldn't this work?
>(Note: So I'm answering because it helps _me_ too.)
>
>open ( INFILE, "inputfile.txt") or die "die message\n" ;
>
>@LineArray=(); # The array that holds one file line per array entry.
>
>while (<INFILE>){
>push ( @LineArray , $_ ) ; # Push the current line onto the end of @LineArray.
>}
That would work, and after all TMTOWTDI. However, I believe the vast majority
of perl programmers would use something like this instead of the while loop :
@LineArray = <INFILE>;
Also the text you are quoting to should be placed before your reply. I
think everyone reading usenet reads from top to bottom, but your
software seems to have other ideas.
--
Sam
testing? What's that? If it compiles, it is good, if it boots up it is
perfect.
--Linus Torvalds
------------------------------
Date: 4 May 1999 15:59:30 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Newsfeed and Local Weather
Message-Id: <372f6dc2@cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
kaih=7GFzapqXw-B@khms.westfalen.de (Kai Henningsen) writes:
:TwospacestoseparatesentencesisasillyEnglish-languageconceitanyway.Real
:languagesdon'tneedthis.
You're wrong. It's so you can parse one sentence to the next. Otherwise,
you have to do a real parse, which is damned rough to program. This
way sentential analysis and manipulation are feasible. Without the
habit, it is virtually hopeless.
Here is one sentence:
I heard that you live next to Susan St. James, who told me to call
early, but you weren't home yet.
Here are two sentences:
I heard that you live next to Susan St. James, who told me to call
early, thought you would be home already.
Note the difference. Now, please write a regular expression that
can tell the two apart.
Good, now remove the double-space between the two sentences in the
second example and show me the pattern that can tell the difference.
'Nuff said. Tip: learn the ( and ) target movement commands in vi. Then
you can do cool things like 3d) to delete three sentences.
--tom
--
"Software Engineers are like economists." --Rob Pike
------------------------------
Date: Tue, 4 May 1999 14:14:45 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Pattern Matching and parsing
Message-Id: <MPG.1199032212fd0da29899b7@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <372f53bf@news.one.net> on Tue, 4 May 1999 16:09:04 -0400,
Greg Waugh <bigbird@pol.com> says...
> Hi there! I was hoping I could get a bit of help with some Perl code to fix
> this little problem. I have a text file that needs to be split by keywords.
> For example:
>
> Bob: data data, data data, data data,
> data, data data, data
> Steve: moredata, moredata
> John: differentdata, differetdata, differentdata,
> differentdata, differentdata
>
> The names will remain contant, as in Bob (a unique name) will be in the file
> most of the time, but it always referrs to the same person. A list of
> keywords in an array or a text file would be adequate.
>
> The file will explicitly wrap and is then terminated with a unix \n. So
> line 2 (data, data..etc) is the beginning of a new line even though it
> referrs to Bob: and should be part of his data.
>
> Ideally, I'd like it to split by the list of all names ( @names = ("Bob",
> "Steve", "Mark", "John") ) that might or might not appear in the file. The
> order will most likely remain constant. So that the final data structure
> would contain (I use an array as an illustration):
>
> $output[0] eq "Bob: data data, data data, data data, data, data data, data"
> $output[1] eq "Steve: moredata, moredata"
> $output[2] eq "John: differentdata, differetdata, differentdata,
> differentdata, differentdata"
That may not be the best data structure. As the names are unique, they
would best serve as hash keys, for easy retrieval. You don't need to
know the names in advance, and their order in the data is irrelevant.
> I've tried slurping the file into one line (undef $/; and s/\n//g) but I
> don't know a pattern matching statement to split it the way I need to. I
> don't want to have to resort to an iterative way of doing it unless I have
> to.
#!/usr/local/bin/perl -w
use strict;
{ local $/; $_ = <DATA> }
s/\n(?!\w+:)/ /g; # Merge the data for each name into one line.
my %hash = /(\w+):\s*(.*)/g;
print map "$_: $hash{$_}\n" => sort keys %hash;
__END__
Bob: data data, data data, data data,
data, data data, data
Steve: moredata, moredata
John: differentdata, differetdata, differentdata,
differentdata, differentdata
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 4 May 1999 21:33:18 GMT
From: neutron@fc.hp.com (Jack Applin)
Subject: Re: Perl 5: The Complete Reference, Martin Brown
Message-Id: <7gnp2u$ona$1@fcnews.fc.hp.com>
Uri Guttman (uri@ibnets.com) wrote:
> the final insult is this one:
>
> <STUPID BOOK>
> Don?t use eval when you can use braces to expand information inline such as
> variable names. You can use something like :
>
> ${$prefix . $var} = "String";
> </STUPID BOOK>
>
> he advocates symbolic refs over eval!! but no mention here of data
> structures.
I agree with the book here--symbolic refs are better than eval in this case.
Using eval opens up a BIG door--anything could be in that string to
be evaluated. Symbolic refs, on the other hand, perform a symbol table
lookup and that's it. It's simpler.
There may certainly be times when you need eval, but you should use
a less powerful construct when you can. It's like goto: there are
times when using goto in C may be best, but use limited constructs
such as break and continue when you can.
-Jack Applin
neutron@fc.hp.com
------------------------------
Date: 4 May 1999 21:04:16 GMT
From: larsot2@krypton.mankato.msus.edu (Timothy Larson)
Subject: perl file "busy"? how can that be?
Message-Id: <7gnncg$m83$1@nitrogen.mankato.msus.edu>
Greetings!
I've been all over the web now, trying to find out how a file can be
busy. I've seen lots of stuff about multiple processes trying to access
a file concurrently and how you can work around that, but that's not my
problem. My problem is that my Perl script itself is busy when the web
server hits it. It's not being hit so often that one process is still
reading it when another tries, and I don't have it open in any editors,
so I don't understand what the problem is. Sometimes I can rename the
script to something else, and get a few runs out of it, then the error
might occur again. Am I the only person this happens to? It seems to
be the case.
Tim
------------------------------
Date: Tue, 04 May 1999 15:41:16 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Perl in the workplace
Message-Id: <372F778C.2A9078DA@mail.cor.epa.gov>
Ronald J Kimball wrote:
>
> David Cassell <cassell@mail.cor.epa.gov> wrote:
>
> > And point out the following:
> > [1] Support is now guaranteed.
> > www.ActiveState.com.PerlDirect [win32 & unix support]
> > www.PerlClinic.com [the Perl Clinic]
>
> Also, www.PerlSupport.com, with the services of Chip Salzenberg.
Oops. How did I overlook that one? Chip, if you're watching,
all I have to say is "Mea culpa" and "Hikeeba!"
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior Computing Specialist phone: (541) 754-4468
mathematical statistician fax: (541) 754-4716
------------------------------
Date: Tue, 4 May 1999 17:13:24 -0400
From: "Greg Waugh" <bigbird@pol.com>
Subject: Re: Permutations
Message-Id: <7gnntg$rru$1@remarQ.com>
It's not a simple algorithm actually. Try this link:
http://sue.uvic.ca/~cos/inf/perm/PermInfo.html
He has a sample C program that has the algorithm... maybe it might be
useful. Good luck!
Bob Trieger <sowmaster@juicepigs.com> wrote in message
news:7gl47d$fic$1@fir.prod.itd.earthlink.net...
> [ courtesy cc sent by mail if address not munged ]
>
> Kenneth Rose <kenrose@home.com> wrote:
> >Hi all,
> >
> >OK, have an interesting question. I've searched desperately for
> >something like this in Perl. A permutation library. Basically, I'm
> >looking for something like:
>
> Gee, you must have searched everywhere but PerlFAQ4
>
> How do I permute N elements of a list?
>
> HTH
>
------------------------------
Date: Tue, 4 May 1999 23:07:13 +0200
From: "Asbjorn Gjemmestad" <agjemmes@extremeonline.com>
Subject: Re: Please help me (nobody ever does :(
Message-Id: <6iJX2.550$Co.3703@news1.online.no>
If you want to redirect people to the ftp, you need to do the following:
#!C:\PERL\BIN\PERL.EXE
use CGI param,header,p;
$user = param("Username");
$pass = param("Password");
# print header(); Do NOT print the http header - otherways, the location
will just be printed, which apparantly is
# your problem...
print p("Location:ftp://$user:$pass\@194.134.134.??");
Asbjorn
Genie skrev i meldingen <7gnkj0$6ke$2@news.telekabel.nl>...
>Can somebody alter this script in a way that it doesnt display the FTP-URL
>but
>OPENS IT???
>
>----
>
>#!C:\PERL\BIN\PERL.EXE
>
>use CGI param,header,p;
>
>$user = param("Username");
>$pass = param("Password");
>print header();
>print p("ftp://$user:$pass\@194.134.134.??");
>
>----
>
>THANX!
>
>Genie
>
>
>
------------------------------
Date: Tue, 04 May 1999 14:04:51 -0700
From: Greg McCann <gregm@well.com>
Subject: Re: Please help me (nobody ever does :(
Message-Id: <372F60F3.6637F4BB@well.com>
Genie wrote:
> Re: Please help me (nobody ever does :(
Just a suggestion - people around here tend to be most helpful when a poster
tells what he (or she) has done to analyze a problem before posting, including a
mention of the FAQs, documentation, and reference books you have already
consulted. I'm sure you have already spent quite of bit of time researching
this problem and it may help us to know what you have already learned about it.
> THANX!
You're welcome.
Greg
--
======================
Gregory McCann
http://www.calypteanna.com
"Be kind, for everyone you meet is fighting a great battle." Saint Philo of
Alexandria
------------------------------
Date: 04 May 1999 16:52:48 -0400
From: Uri Guttman <uri@ibnets.com>
Subject: Re: Question: Updating an Array...
Message-Id: <39g15cblr3.fsf@ibnets.com>
>>>>> "SL" == Steve Linberg <linberg@literacy.upenn.edu> writes:
SL> In article <MPG.1198e601886666f09899b4@nntp.hpl.hp.com>,
SL> lr@hpl.hp.com (Larry Rosler) wrote:
>> > No. Arrays are sequential. You'll have to do some moving.
>>
>> No, you don't have to. You are *much* better off using splice.
SL> My eyes popped out when I saw those results. I had always assumed
SL> (my old-school mentality is showing here) that it's faster in
SL> general to construct a new list, rather than modify an existing
SL> one.
you also have to think in terms of perl ops. that is usually the main
bottleneck, the fewer perl op the faster as you spend more time in
optimized c code that does the work.
so one splice call will be faster than 2 slices and a list
concatenation.
also splice just copies the higher part of the list down/up and leave
the lower part alone which save a lot of work compared to using slices.
uri
--
Uri Guttman Hacking Perl for Ironbridge Networks
uri@sysarch.com uri@ironbridgenetworks.com
------------------------------
Date: Tue, 4 May 1999 14:25:47 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Question: Updating an Array...
Message-Id: <MPG.119905b95ae518419899b8@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <linberg-0405991631560001@ltl1.literacy.upenn.edu> on Tue, 04
May 1999 16:31:56 -0400, Steve Linberg <linberg@literacy.upenn.edu>
says...
> In article <MPG.1198e601886666f09899b4@nntp.hpl.hp.com>, lr@hpl.hp.com
> (Larry Rosler) wrote:
>
> > SL> No. Arrays are sequential. You'll have to do some moving.
> >
> > No, you don't have to. You are *much* better off using splice.
>
> My eyes popped out when I saw those results. I had always assumed (my
> old-school mentality is showing here) that it's faster in general to
> construct a new list, rather than modify an existing one.
>
> Does splice do some magic that makes it faster than slice in your
> examples?
Though I haven't looked at the implementation, I'll wager it moves
pointers to the data. Except that the list of pointers grows by one, no
data are reallocated or copied during the insertion of the new elemnent.
...
> I get grumpy when I have to work in C
> now, it's so damn tedious. Perl is really ruining me, in that sense.
Amen to that!
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 4 May 1999 22:59:25 GMT
From: Dan Sugalski <sugalskd@netserve.ous.edu>
Subject: Re: Thread module + leaking memory
Message-Id: <7gnu4d$c7l$1@news.NERO.NET>
Otis Gospodnetic <otis@my-dejanews.com> wrote:
: Hello,
: I'm trying to implement a 'work crew' of threads with the script below. The
: problem is that the script and/or Thread module leaks memory which means that
: it uses more RAm with each new Thread created. Do I have a bug in my script?
: The problem with Threads in perl that I see is that Thread constructor
: requires me to specify a subroutine which starts executing immediately. This
: means that I have to create a separate Thread object for each thread instead
: of creating X number of threads and reusing them (well, not 100% true, but I
: wish there is something like Java's .start() for Threads in perl)
Threads still have some issues, not the least of it being it looks like we
over-refcount the arguments to Thread::new, so thir refcounts don't ever
go down to zero and get garbage collected. This is likely your problem
here.
As for the Java model, you can do this in perl easily enough. Rather than
creating a new thread to execute your subroutine, create a new thread that
snags its sub and parameters off a queue and executes them, like this:
sub worker {
while (1) {
my $ref = $queue->dequeue;
my $sub = unshift @$ref;
$sub->(@$ref);
}
}
Then add subs to the list with this code:
$queue->enqueue([\&sub_to_run, @parameters]);
If you want to do it right, worker() ought to take the queue object as a
parameter, but this is quick-n-dirty code.
I'm beginning to wonder if this warrants an article in The Perl Journal,
given how often it comes up.
Dan
(And I know it's not nice to grumble about style, but... perl really isn't
C. &main? Sheesh. :)
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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 5563
**************************************